1

如何为 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();
4

1 回答 1

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();
于 2014-11-05T11:07:01.560 回答