orientechnologies / phporient Goto Github PK
View Code? Open in Web Editor NEWThis project forked from ostico/phporient
PhpOrient - PHP binary client for OrientDB
License: Other
This project forked from ostico/phporient
PhpOrient - PHP binary client for OrientDB
License: Other
dev-master:today
Hi, I am inserting an int and it is returned as a string. Here is my schema setup (it is integer obviously and saved): http://i.imgur.com/vc93Yq6.png
$data = ["IsOfTypeCount" => 10];
var_dump($data);
$transaction = $db->getTransactionStatement();
$transaction = $transaction->begin();
$record = (new Record())
->setOData( $data )
->setOClass( "Entity" )
->setRid( new ID() );
$createCommand = $db->recordCreate($record);
$transaction->attach( $createCommand );
$transaction->commit();
$record = $db->query("select from Entity where @rid ='".$record->getRid()."'")[0];
$dataNew = $record->getOData();
var_dump($dataNew);
//results:
array(1) {
["IsOfTypeCount"]=>
int(10)
}
array(1) {
["IsOfTypeCount"]=>
string(2) "10"
}
Thanks
Michail
HI,
I am using ostico/phporient official driver it will work fine in windows but not working in centos.
The below error was thrown.
Fatal error: Uncaught exception 'PhpOrient\Exceptions\SocketException' with message 'Error 111 : Connection refused ' in /home/jackraj/public_html/application/third_party/vendor/ostico/phporient/src/PhpOrient/Protocols/Binary/OrientSocket.php:86 Stack trace: #0 /home/jackraj/public_html/application/third_party/vendor/ostico/phporient/src/PhpOrient/Protocols/Binary/SocketTransport.php(138): PhpOrient\Protocols\Binary\OrientSocket->connect() #1 /home/jackraj/public_html/application/third_party/vendor/ostico/phporient/src/PhpOrient/Protocols/Binary/Abstracts/Operation.php(73): PhpOrient\Protocols\Binary\SocketTransport->getSocket() #2 /home/jackraj/public_html/application/third_party/vendor/ostico/phporient/src/PhpOrient/Protocols/Binary/SocketTransport.php(174): PhpOrient\Protocols\Binary\Abstracts\Operation->__construct(Object(PhpOrient\Protocols\Binary\SocketTransport)) #3 /home/jackraj/public_html/application/third_party/vendor/ostico/phporient/src/PhpOrient/Protocols/Binary/SocketTransport.php(153): PhpOrient\Protocols in/home/jackraj/public_html/application/third_party/vendor/ostico/phporient/src/PhpOrient/Protocols/Binary/OrientSocket.phpon line 86
Please help asap.
I'm constantly getting out of memory exceptions when trying to dbOpen. I've even tried to delete + using the sample code to create a new DB animals, still gives me the same exception ..
Allowed memory size of 67108864 bytes exhausted (tried to allocate 824191075 bytes) in /PhpOrient/Protocols/Binary/OrientSocket.php on line 141
If I increase my PHP memory (Shouldn't have to be so high) to for example 4000M, it then gives me a SocketException Uncaught exception 'PhpOrient\Exceptions\SocketException' with message 'socket_read(): unable to read from socket [104]: Connection reset by peer
Any help would be appreciated, am at my last straw before I switch to a different graph db I can't debug this any longer.
Hi,
What is the preferred method to prevent SQL injections using this library?
Thanks ๐
If you try to use new orientdb 3.0 i will get an error. But all you need to do is to change protocol version in constants to 37. Basic features work.
Will the library support new orinetdb 3?
Hi, I have the follwing query:
$db->query('select address from user', 1, '*:1');
where address is a LINKSET. The result is an array of Record-IDs, why doesn't the fetchplan *:1 include the address?
In studio everything works as expected. I also tried this with the example db GratefulDeadConcerts:
$db->query('select out("sung_by") from #9:1', 1, '*:1');
The result should contain 'name': 'Garcia', but only a PhpOrient\Protocols\Binary\Data\ID object is returned with value "#9:8"
Is fetchplan not implemented yet in the beta?
After an ALTER PROPERTY command is executed all others commands / query executed results with a raised exception:
PhpOrient\Exceptions\PhpOrientException: Unknown payload type H in ..\PhpOrient\Protocols\Binary\Abstracts\Operation.php on line 577
... the command is successfully executed on the server, I can see the changes on the schema, unfortunately I can't get a result no more due the raised error, this then makes query commands useless.
So for example
->query('select ...'); # execution OK, result OK
->command('ALTER PROPERTY ...'); # execution OK, result OK
->command('ALTER PROPERTY ...'); # execution OK, result Exception
->query('select ...'); # execution OK, result Exception
Tested on:
orientdb 2.0.5 ubuntu php 5.4.39 & windows 7 php 5.4.38
orientdb 2.0.6 windows 7 php 5.4.38
Is it recommended to use with php7? I was trying out and it's working well.
I just want to know if there are any known issues or not.
Thanks,
Is there any reason why the call to socket_create() is masked (prepended with an '@' symbol) on line 78 in file PhpOrient/src/PhpOrient/Protocols/Binary/OrientSocket.php?
My call to $client->connect() failed silently and only after stepping through the PhpOrient code did I find that a compilation of php needs the '--enable-sockets' flag in order to work with PhpOrient.
The connection is working correctly and I have the database selected.
$client->dbOpen('dbName');
All works until I try to run the command:
$client->command('IMPORT DATABASE /path/to/file/export.gz');
When I get this exception:
Message: com.orientechnologies.orient.core.command.OCommandExecutorNotFoundException: Cannot find a command executor for the command request: sql.IMPORT DATABASE /path/to/file/export.gz -preserveClusterIDs=true DB name="dbname"
If the command command is not correct, then what can be use instead?
There is a way to create an edge with recordCreate
?
I don't see anything about this.
I'm mean somenthing like this:
$record = (new Record())->setOClass('E')->setRid(new ID(109))->setOData([
'out' => new ID($ridAsStringItem),
'in' => new ID($ridAsStringBrand),
'created_at' => time()
]);
$result = $instance->recordCreate($record);
As stated in orientechnologies/orientdb#4191 when I use dbOpen with password null
require 'PhpOrient/vendor/autoload.php';
use PhpOrient\PhpOrient;
$client = new PhpOrient( 'localhost', 2424 );
$client->dbOpen('GratefulDeadConcerts', 'root', null);
I get root acces to the db without knowing the real password. @Ostico can you confirm this? I tried with OrientDB 2.0.8/2.1-rc2. and PhpOrient v1.1.8
Running binary network protocol on orientdb server 2.0.5, storing server token on client and re-using it for multiple requests works fine. However, if enough time elapses (15 minutes I think but can't be sure) between server requests then token expires and orientdb server does not return a message and close the connection. Instead, the socket_read just hangs and eventually times out. In testing, I can get the same thing to happen if I append a character to the end of a valid token like this:
$this->db = new PhpOrient(env('orientDB_HOST'),2424, $orientdbSessionToken . 'a');
$this->db->query("select from V limit 10");
Expected behavior: when token expires or server receives unrecognized token then it should return an error message and close the connection.
I filed this issue with the OrientDB team and they said the server is correctly responding with a bad token message but that the php driver isn't picking it up. Luca asked me to submit the issue here. Thanks
Fatal error: Uncaught PhpOrient\Exceptions\SocketException: socket_read(): unable to read from socket [104]: Connection reset by peer in D:\laragon\www\PhpOrient\src\PhpOrient\Protocols\Binary\OrientSocket.php:147 Stack trace: #0 D:\laragon\www\PhpOrient\src\PhpOrient\Protocols\Binary\OrientSocket.php(94): PhpOrient\Protocols\Binary\OrientSocket->read(2) #1 D:\laragon\www\PhpOrient\src\PhpOrient\Protocols\Binary\SocketTransport.php(146): PhpOrient\Protocols\Binary\OrientSocket->connect() #2 D:\laragon\www\PhpOrient\src\PhpOrient\Protocols\Binary\Abstracts\Operation.php(76): PhpOrient\Protocols\Binary\SocketTransport->getSocket() #3 D:\laragon\www\PhpOrient\src\PhpOrient\Protocols\Binary\SocketTransport.php(223): PhpOrient\Protocols\Binary\Abstracts\Operation->__construct(Object(PhpOrient\Protocols\Binary\SocketTransport)) #4 D:\laragon\www\PhpOrient\src\PhpOrient\Protocols\Binary\SocketTransport.php(161): PhpOrient\Protocols\Binary\SocketTransport->operationFactory('PhpOrient\Proto...', Array) #5 D:\laragon\www\PhpOrient in D:\laragon\www\PhpOrient\src\PhpOrient\Protocols\Binary\OrientSocket.php on line 147
what mean of this error?
i get this error trying to connect:
PHP Fatal error: Uncaught exception 'PhpOrient\Exceptions\PhpOrientWrongProtocolVersionException' with message 'Protocol version 36 is not supported.' in /home2/WORK/BTGI/Clustering/CODE/PhpOrient-1.2.1/src/PhpOrient/Protocols/Binary/OrientSocket.php:92
Hi Team,
I am trying to use fetchplan but its not working.
$return= $client->query('select from make',1,'*:2');
Do m doing something wrong. Tried various option but no luck.
Thanks.
Hi Guys
I'm not sure if my OrientDB is not compatible, but I keep getting a clusterID of -2 for a record that should have a clusterID of 12.
I checked, it happens right in Operations.php. It is misreading the raw protocol data.
My OrientDB version is OrientDB Server v2.0.3
Any guidance on how I could fix that would be appreciated.
Thank you
OrientDB main repo has a branch structure like following:
plus, final releases are tagged with "2.1.0", "2.1.1" etc.
It would be good to have the same branch structure here, to make dependencies clearer.
Hi
I'm having a piece of code that generates Clusters on the fly, depending on the client performing the request.
For this, the first thing I do, is to perform an Insert:
$query = 'INSERT INTO Event CLUSTER '.$clusterName.' CONTENT '.json_encode($event);
$orientDBClient->command($query);
if the commands raises an exception, then I proceed to check if the cluster exists or not, then create the cluster and attach it to the class and as final step, attempt to insert the content once again
$db = $orientDBClient->dbReload();
if (null == $db->getClusterID($clusterName)) {
$command = 'CREATE CLUSTER '.$clusterName;
$orientDBClient->command($command);
$command = 'ALTER CLASS Event ADDCLUSTER '.$clusterName;
$orientDBClient->command($command);
$query = 'INSERT INTO Event CLUSTER '.$clusterName.' CONTENT '.json_encode($event);
$orientDBClient->command($query);
}
The issue comes with the last command execution getting exceptions like these:
PhpOrient\Exceptions\PhpOrientException: Unknown payload type โ in .../ostico/phporient/src/PhpOrient/Protocols/Binary/Abstracts/Operation.php on line 577
PhpOrient\Exceptions\PhpOrientException: Unknown payload type in .../ostico/phporient/src/PhpOrient/Protocols/Binary/Abstracts/Operation.php on line 577
PhpOrient\Exceptions\PhpOrientException: Unknown payload type % in ..../ostico/phporient/src/PhpOrient/Protocols/Binary/Abstracts/Operation.php on line 577
Notice that the character after '...payload type' is different for the exact same code.
The last record insert attempt is actually having place, creating the record in the db.
I'm using version 1.1.7
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.