joshjacob commented on issue #445:
URL: https://github.com/apache/age/issues/445#issuecomment-1492379808

   @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.


-- 
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: dev-unsubscr...@age.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to