Open max-kuk opened 5 years ago
I tried to recreate your problem and got another exception.
com.orientechnologies.orient.core.exception.OCommandExecutionException: No edge has been created because no target vertices DB name="flight"
When I execute the queries in 2 batches it works for me.
So try to first create the vertexes, then create the 2 edges between them in a single batchSql statement.
There seem to be a problem with adding a vertex
and using that vertex in a "edge insert" at the same time.
Executing the query through the frontend with type=batch
and language=sql
works for me. So it might be a problem with the php driver.
Maybe this helps :)
good point @cb0! Yep, I can confirm that. When I execute the query via frontend it runs perfectly. I get problems only when it runs via outdated php Driver.
Hi all, PhpOrient do not perform any special action on the sql the user runs on the DB, it is passed directily to OrientDB. The exception you see is raised by OrientDb. I think this could be a bug with the binary protocol.
sqlBatch() doesn't work as it should:
I always get such errors:
2018-11-29T11:20:54+01:00 ERR (3): message {"message":"com.orientechnologies.orient.core.exception.OCommandExecutionException: Invalid script:Encountered \" <CREATE> \"CREATE \"\" at line 1, column 7.\nWas expecting one of:\n <WHILE> ...\n <IF> ...\n <FOREACH> ...\n \";\" ...\n \r\n\tDB name=\"flightcms\"","trace":"#0 /var/www/html/vendor/ostico/phporient/src/PhpOrient/Protocols/Binary/Abstracts/Operation.php(145): PhpOrient\\Protocols\\Binary\\Abstracts\\Operation->_readError()\n#1 /var/www/html/vendor/ostico/phporient/src/PhpOrient/Protocols/Binary/Abstracts/Operation.php(286): PhpOrient\\Protocols\\Binary\\Abstracts\\Operation->_readHeader()\n#2 /var/www/html/vendor/ostico/phporient/src/PhpOrient/Protocols/Binary/SocketTransport.php(163): PhpOrient\\Protocols\\Binary\\Abstracts\\Operation->getResponse()\n#3 /var/www/html/vendor/ostico/phporient/src/PhpOrient/PhpOrient.php(336): PhpOrient\\Protocols\\Binary\\SocketTransport->execute('command', Array)\n#4 /var/www/html/module/Core/src/Client/Orient.php(106): PhpOrient\\PhpOrient->sqlBatch('begin;CREATE VE...')\n#5 /var/www/html/module/Core/src/Import/FlightImporter.php(217): Core\\Client\\Orient->sqlBatch('begin;CREATE VE...')\n#6 /var/www/html/module/Core/src/Controller/ImportController.php(59): Core\\Import\\FlightImporter->importFlights()\n#7 /var/www/html/vendor/zendframework/zend-mvc/src/Controller/AbstractActionController.php(78): Core\\Controller\\ImportController->importFlightsAction()\n#8 /var/www/html/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\\Mvc\\Controller\\AbstractActionController->onDispatch(Object(Zend\\Mvc\\MvcEvent))\n#9 /var/www/html/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\\EventManager\\EventManager->triggerListeners(Object(Zend\\Mvc\\MvcEvent), Object(Closure))\n#10 /var/www/html/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php(106): Zend\\EventManager\\EventManager->triggerEventUntil(Object(Closure), Object(Zend\\Mvc\\MvcEvent))\n#11 /var/www/html/vendor/zendframework/zend-mvc/src/DispatchListener.php(138): Zend\\Mvc\\Controller\\AbstractController->dispatch(Object(Zend\\Http\\PhpEnvironment\\Request), Object(Zend\\Http\\PhpEnvironment\\Response))\n#12 /var/www/html/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\\Mvc\\DispatchListener->onDispatch(Object(Zend\\Mvc\\MvcEvent))\n#13 /var/www/html/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\\EventManager\\EventManager->triggerListeners(Object(Zend\\Mvc\\MvcEvent), Object(Closure))\n#14 /var/www/html/vendor/zendframework/zend-mvc/src/Application.php(332): Zend\\EventManager\\EventManager->triggerEventUntil(Object(Closure), Object(Zend\\Mvc\\MvcEvent))\n#15 /var/www/html/public/index.php(61): Zend\\Mvc\\Application->run()\n#16 {main}"}
executed query:
Alternative solution Of course, I can use alternatively command() or execute(), but it really pity, that PHP-Driver doesn't support such simple things and rarely gets updates.