如何为WHERE条件传递参数?
事实上,这很好:
match (b:Book) where b.guid={guid} return b;
但是,如何传递多个guid作为此查询的参数:
match (b:Book) where b.guid in [guid1,guid2,gid3] return b;
我使用neo4jphp客户端,我的代码如下:
$client = new EverymanNeo4jClient( "neo4j server address", "7474" );
$result = new EverymanNeo4jCypherQuery( $client, "match (b:Book) where b.guid={guid} return b", array('guid'=>$guid1) );
$res = $result->getResultSet();
您应该传递一个数组作为参数,查询如下所示:
match (b:Book) where b.guid in {myMap} return b;
$client = new EverymanNeo4jClient( "neo4j server address", "7474" );
$result = new EverymanNeo4jCypherQuery( $client, "match (b:Book) where b.guid in {MyMap} return b", array('myMap'=> array($guid1, $guid2, $guid3)) );
$res = $result->getResultSet();