简体   繁体   中英

Is running a transaction followed by php code and then a commit atomical in neo4j-php-client?

Is the run query in the second code line part of the atomical transaction, or in other words: is it possible that another thread runs a query successfully between the 2nd and 4th line of the following code?

$tx = $client->transaction();
$result = $tx->run('CREATE (n:Person) SET n.name = {name} RETURN id(n)', ['name' => 'Michal']);
$tx->push('CREATE (n:Person) RETURN id(n)');
$results = $tx->commit();

PHP is thread safe and shares nothing between threads.

So no, it is not possible that another thread will run a query in the same transaction as the one opened by the current thread, it will rather use its own transaction.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM