dehowef commented on issue #445:
URL: https://github.com/apache/age/issues/445#issuecomment-1507752381
> @dehowef For safe parameter handling, the solution I landed on is built on
PostgresNIO's string interpolation. This code:
>
> ```swift
> let params: Dictionary<String,AGValue> = ["newName": "Little'Bobby'Tables"]
> let paramsWrapper: AGValueWrapper = AGValueWrapper.init(value: params)
> let agRows = try await connection.execCypher(
> "SELECT * FROM cypher('test_graph_1', $$ CREATE (v:Person {name:
$newName}) RETURN v $$, \( paramsWrapper )) as (v agtype);",
> logger: logger)
> ```
>
> will send the following query to Postgres:
>
> ```sql
> SELECT * FROM cypher('test_graph_1', $$ CREATE (v:Person {name: $newName})
RETURN v $$, $1) as (v agtype);
> ```
>
> with the `$1` parameter being a jsonb encoding of that Dictionary. Let me
know if you see any concerns with that approach.
Hey! I was taking a break but I will take a look when I have a chance thank
you for your contribution~
>
That's awesome to know. Great work! Thank you for your contribution
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]