You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@age.apache.org by GitBox <gi...@apache.org> on 2022/12/13 02:02:22 UTC

[GitHub] [age] Maytch opened a new pull request, #384: Implement PHP Driver and Client

Maytch opened a new pull request, #384:
URL: https://github.com/apache/age/pull/384

   Implemented AGTypeParse to parse results from PHP PostgreSQL fetch functions
   Implemented AgeClient wrapper for PHP PostgreSQL Functions https://www.php.net/manual/en/ref.pgsql.php
   
   AgeClient includes basic DIY query method:
   
   ```
   $this->ageClient->query("
       SELECT * FROM cypher('$graphName', $$
           CREATE
               (a:Part {part_num: '123'}),
               (b:Part {part_num: '345'}),
               (c:Part {part_num: '456'}),
               (d:Part {part_num: '789'})
       $$) as (a agtype);
   ");
   
   $results = $this->ageClient->query("
       SELECT * FROM cypher('$graphName', $$
           MATCH
               (a:Part)
           RETURN a
       $$) as (a agtype);
   ")->fetchAll();
   ```
   
   And a Cypher-specific prepared statement method to remove PostgreSQL statement clutter and might prevent potential injections:
   ```
   $this->ageClient->cypherQuery($graphName, 0, "
       CREATE
           (a:Person {name: \$p1}),
           (b:Person {name: \$p2}),
           (a)-[:KNOWS]->(b)
   ",[
       'p1' => 'Steven',
       'p2' => 'Mary'
   ]);
   
   $results = $this->ageClient->cypherQuery($graphName, 3, "
       MATCH
           (a:Person {name: \$p1})-[r]-(b)
       RETURN *
   ",[
       'p1' => 'Steven'
   ])->fetchRow();
   ```


-- 
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: commits-unsubscribe@age.apache.org

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