如何传递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 Everyman\Neo4j\Client( "neo4j server address", "7474" );
$result = new Everyman\Neo4j\Cypher\Query( $client, "match (b:Book) where b.guid={guid} return b", array('guid'=>$guid1) );
$res = $result->getResultSet();
答案 0 :(得分:1)
您应该将数组作为参数传递,查询将如下所示:
match (b:Book) where b.guid in {myMap} return b;
$client = new Everyman\Neo4j\Client( "neo4j server address", "7474" );
$result = new Everyman\Neo4j\Cypher\Query( $client, "match (b:Book) where b.guid in {MyMap} return b", array('myMap'=> array($guid1, $guid2, $guid3)) );
$res = $result->getResultSet();