Coder Social home page Coder Social logo

phporient's Introduction

PhpOrient

Build Status Coverage Status

PHPOrient is a php driver based on the binary protocol of OrientDB.

status: Stable Please report any bugs you find so that we can improve the library for everyone.

Requires

  • PHP Version >= 5.4 ( Socket extension enabled )
  • Orientdb version 1.7.4 or later.
PhpOrient works even on 32bit and 64bit platforms.
Warning, if you use a 32bit platform, you must use one of these libraries into YOUR application to avoid the loss of significant digits with Java long integers. Furthermore, these php modules should be loaded to achieve better driver performances on these systems.
In PhpOrient, by design, numbers are always treated as strings because of the platform dependant nature of PHP. In 32bit platform numbers must be treated as string because values greater than 2^32 would be lost and the BCMath/GMP modules must be used to avoid this. To make the results consistent for all platforms ( 32 and 64bit ) and leave to the user/developer the decision on how to use it's own data ( by manual cast ) strings are used for all numeric data types.

Installation

Main public repository of PhpOrient is hosted at https://github.com/Ostico/PhpOrient.git.

To install most recent version of library, just type

git clone https://github.com/Ostico/PhpOrient.git

where you want its file to be located.

If you have not already installed globally, you have to download composer. Just run this command inside your PhpOrient directory.

php -r "readfile('https://getcomposer.org/installer');" | php

Now get the required libraries to work with PhpOrient:

php composer.phar --no-dev install
Note:

If you already have a composer installed or your existing project use it, you can install/add PhpOrient via Composer https://packagist.org/packages/ostico/phporient, it is linked to this GitHub repository ( so it is everityme updated ), and add it as dependecy to your project.

php composer.phar require "ostico/phporient:dev-master" --update-no-dev

Contributions

  • Fork the project.
  • Make your changes.
  • Add tests for it. This is important so I don’t break it in a future version unintentionally.
  • Send me a pull request (pull request to master will be rejected)
  • ???
  • PROFIT

How to run tests

  • Get the development libraries with:
php composer.phar install
  • Bootsrap orient by running ./ci/ci-start.sh from project directory it will download latest orient and make some change on config and database for the tests
  • Run : ./vendor/bin/phpunit

Usage

PhpOrient specify autoload information, Composer generates a vendor/autoload.php file. You can simply include this file and you will get autoloading for free and declare the use of PhpOrient Client with fully qualified name.

require "vendor/autoload.php";
use PhpOrient\PhpOrient;

A complete phpdoc reference can be found here ApiIndex or in the PhpOrient Wiki

Client initialization

There are several ways to initialize the client

$client = new PhpOrient( 'localhost', 2424 );
$client->username = 'root';
$client->password = 'root_pass';
$client = new PhpOrient();
$client->hostname = 'localhost';
$client->port     = 2424;
$client->username = 'root';
$client->password = 'root_pass';
$client = new PhpOrient();
$client->configure( array(
    'username' => 'root',
    'password' => 'root_pass',
    'hostname' => 'localhost',
    'port'     => 2424,
) );

Connect to perform Server Management Operations

$client = new PhpOrient( 'localhost', 2424 );
$client->username = 'root';
$client->password = 'root_pass';
$client->connect();
$client = new PhpOrient( 'localhost', 2424 );
$client->connect( 'root', 'root_pass' );

Database Create

$new_cluster_id = $client->dbCreate( 'my_new_database',
    PhpOrient::STORAGE_TYPE_MEMORY,   # optional, default: STORAGE_TYPE_PLOCAL
    PhpOrient::DATABASE_TYPE_GRAPH    # optional, default: DATABASE_TYPE_GRAPH
);

Drop a Database

$client->dbDrop( $this->db_name, 
    PhpOrient::STORAGE_TYPE_MEMORY  # optional, default: STORAGE_TYPE_PLOCAL
);

Check if a DB Exists

$client->dbExists( 'my_database', 
    PhpOrient::DATABASE_TYPE_GRAPH   # optional, default: DATABASE_TYPE_GRAPH
);

Get the the list of databases

$client->dbList();

Open a Database

$ClusterMap = $client->dbOpen( 'GratefulDeadConcerts', 'admin', 'admin' );

Send a command

This should be used only to perform not idempotent commands on a database

$client->command( 'create class Animal extends V' );
$client->command( "insert into Animal set name = 'rat', specie = 'rodent'" );

Make a query

$client->query( 'select from followed_by limit 10' );

Make an Async query ( callback )

$myFunction = function( Record $record) { var_dump( $record ); };
$client->queryAsync( 'select from followed_by', [ 'fetch_plan' => '*:1', '_callback' => $myFunction ] );

Load a Record

$record = $client->recordLoad( new ID( '#3:0' ) )[0];
$record = $client->recordLoad( new ID( 3, 0 ) )[0];
$record = $client->recordLoad( new ID( [ 'cluster' => 3, 'position' => 0 ] ) )[0];

Create a Record

$recordContent = [ 'accommodation' => 'houses', 'work' => 'bazar', 'holiday' => 'sea' ];
$rec = ( new Record() )->setOData( $recordContent )->setRid( new ID( 9 /* set only the cluster ID */ ) ); 
$record = $this->client->recordCreate( $rec );

Update a Record

To update a Record you must have one.

If you have not a record you can build up a new one specifying a RID and the data:

$_recUp = [ 'accommodation' => 'hotel', 'work' => 'office', 'holiday' => 'mountain' ];
$recUp = ( new Record() )->setOData( $_recUp )->setOClass( 'V' )->setRid( new ID( 9, 0 ) );
$updated = $client->recordUpdate( $recUp );

Otherwise you can work with a previous loaded/created Record

/*
 Create/Load or Query for a Record
*/
$recordContent = [ 'accommodation' => 'houses', 'work' => 'bazar', 'holiday' => 'sea' ];
$rec = ( new Record() )->setOData( $recordContent )->setRid( new ID( 9 ) );
$record = $client->recordCreate( $rec );

/*
or Query for an existent one
*/
$record = $client->query( "select from V where @rid = '#9:0'" )[0];

/*
 NOW UPDATE
*/
$_recUp = [ 'accommodation' => 'bridge', 'work' => 'none', 'holiday' => 'what??' ];
$recUp = $record->setOData( $_recUp );
$updated = $client->recordUpdate( $recUp );

Load a Record with node depth navigation ( callback )

$myFunction = function( Record $record) { var_dump( $record ); };
$client->recordLoad( new ID( "9", "1" ), [ 'fetch_plan' => '*:2', '_callback' => $myFunction ] );

Delete a Record

$delete = $client->recordDelete( new ID( 11, 1 ) );

Execute OrientDB SQL Batch

$cmd = 'begin;' .
       'let a = create vertex set script = true;' .
       'let b = select from v limit 1;' .
       'let e = create edge from $a to $b;' .
       'commit retry 100;';

$lastRecord = $client->sqlBatch( $cmd );

Transactions

// create some record stuffs
$rec2Create = [ 'oClass' => 'V', 'oData' => [ 'alloggio' => 'albergo' ] ];
$rec        = Record::fromConfig( $rec2Create );
$first_rec  = $client->recordCreate( $rec );

$rec3Create = [ 'oClass' => 'V', 'oData' => [ 'alloggio' => 'house' ] ];
$rec        = Record::fromConfig( $rec3Create );
$sec_rec    = $client->recordCreate();

//get the transaction and start it
$tx = $client->getTransactionStatement();

//BEGIN THE TRANSACTION
$tx = $tx->begin();

//IN TRANSACTION
$recUp = [ 'accommodation' => 'mountain cabin' ];
$rec2 = new Record();
$rec2->setOData( $recUp );
$rec2->setOClass( 'V' );
$rec2->setRid( $first_rec->getRid() );
$rec2->setVersion( $first_rec->getVersion() );

$updateCommand = $client->recordUpdate( $rec2 );

$createCommand = $client->recordCreate(
    ( new Record() )
        ->setOData( [ 'accommodation' => 'bungalow' ] )
        ->setOClass( 'V' )
        ->setRid( new ID( 9 ) )
);

$deleteCommand = $client->recordDelete( $sec_rec->getRid() );

//Attach to the transaction statement, they will be executed in the same order
$tx->attach( $updateCommand );  // first
$tx->attach( $createCommand );  // second
$tx->attach( $deleteCommand );  // third

$result = $tx->commit();

/**
 * @var Record $record
 */
foreach ( $result as $record ){
    if( $record->getRid() == $first_rec->getRid() ){
        $this->assertEquals( $record->getOData(), [ 'accommodation' => 'mountain cabin' ] );
        $this->assertEquals( $record->getOClass(), $first_rec->getOClass() );
    } else {
        $this->assertEquals( $record->getOData(), [ 'accommodation' => 'bungalow' ] );
        $this->assertEquals( $record->getOClass(), 'V' );
    }
}

//check for deleted record
$deleted = $client->recordLoad( $sec_rec->getRid() );
$this->assertEmpty( $deleted );

Get the size of a database ( needs a DB opened )

$client->dbSize();

Get the range of record ids for a cluster

$data = $client->dataClusterDataRange( 9 );

Get the number of records in one or more clusters

$client->dataClusterCount( $client->getTransport()->getClusterMap()->getIdList() );

Get the number of records in an open database

$result = $client->dbCountRecords();

Reload the Database info

This method automatically updates the client Cluster Map. Can be used after a Class creation or a DataCluster Add/Drop

$reloaded_list = $client->dbReload();  # $reloaded_list === $client->getTransport()->getClusterMap()

Create a new data Cluster

$client->dataClusterAdd( 'new_cluster', 
    PhpOrient::CLUSTER_TYPE_MEMORY  # optional, default: PhpOrient::CLUSTER_TYPE_PHYSICAL
);

Drop a data cluster

$client->dataClusterDrop( 11 );

Persistent Connections ( Session Token )

Since version 27 is introduced an extension to allow use a token based session. This functionality must be enabled on the server config.

  • In the first negotiation the client can ask for a token based authentication using the PhpOrient::setSessionToken method.
  • The server will reply with a token or with an empty string meaning that it not support token based session and is using an old style session.
  • For each request, the client will send the token and eventually it will get a new one if token lifetime ends.

When using the token based authentication, the connections can be shared between users of the same server.

$client = new PhpOrient( 'localhost', 2424 ); 
$client->setSessionToken( true );  // set true to enable the token based authentication
$clusterID = $client->dbOpen( "GratefulDeadConcerts", 'admin', 'admin' );
$sessionToken = $client->getSessionToken(); // store this token somewhere

//destroy the old client, equals to another user/socket/ip ecc.
unset($client);

// create a new client
$client = new PhpOrient( 'localhost', 2424 ); 

// set the previous obtained token to re-attach to the old session
$client->setSessionToken( $sessionToken );  

//now the dbOpen is not needed to perform database operations
$records = $client->query( 'select * from V limit 10' );

//set the flag again to true if you want to renew the token
$client->setSessionToken( true );  // set true
$clusterID = $client->dbOpen( "GratefulDeadConcerts", 'admin', 'admin' );
$new_sessionToken = $client->getSessionToken();

$this->assertNotEquals( $sessionToken, $new_sessionToken );

A GRAPH Example

require "vendor/autoload.php";
use PhpOrient\PhpOrient;

$client = new PhpOrient();
$client->configure( array(
    'username' => 'admin',
    'password' => 'admin',
    'hostname' => 'localhost',
    'port'     => 2424,
) );

$client->connect();

$client->dbCreate( 'animals', PhpOrient::STORAGE_TYPE_MEMORY );
$client->dbOpen( 'animals', 'admin', 'admin' );

$client->command( 'create class Animal extends V' );
$client->command( "insert into Animal set name = 'rat', specie = 'rodent'" );
$animal = $client->query( "select * from Animal" );


$client->command( 'create class Food extends V' );
$client->command( "insert into Food set name = 'pea', color = 'green'" );

$client->command( 'create class Eat extends E' );

$client->command( "create edge Eat from ( select from Animal where name = 'rat' ) to ( select from Food where name = 'pea' )" );

$pea_eaters = $client->query( "select expand( in( Eat )) from Food where name = 'pea'" );

$animal_foods = $client->query( "select expand( out( Eat )) from Animal" );

foreach ( $animal_foods as $food ) {
    $animal = $client->query(
        "select name from ( select expand( in('Eat') ) from Food where name = 'pea' )"
    )[0];
    $this->assertEquals( 'pea', $food[ 'name' ] );
    $this->assertEquals( 'green', $food[ 'color' ] );
    $this->assertEquals( 'rat', $animal[ 'name' ] );
}

License

Apache License, Version 2.0, see LICENSE.md.

phporient's People

Contributors

bazo avatar lvca avatar ostico avatar pjmazenot avatar robfrank avatar yoann-losbar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phporient's Issues

php7 support

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,

Exception after command ALTER PROPERTY

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

Unknown payload type issue

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

security issue in binary protocol

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

FetchPlan not working

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.

No support for OrientDB3.0 but it actually works

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?

i want to use orientdb with php but get connecting error

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?

Fetchplan doesn't work

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?

Allowed memory size exhausted w/ OrientDB 2.2.X

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.

int is returned as string

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

Is it possible to run IMPORT DATABASE command in 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?

Keep getting the wrong $cluster from $record->getRid()

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

Protocol version 36 is not supported

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

branch structure conforming to orientdb

OrientDB main repo has a branch structure like following:

  • master: last stable release
  • 2.0.x: hotfix branch for release 2.0
  • 2.1.x: hotfix branch for release 2.1
    ...
  • develop: branch for next (major or minor) release

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.

Status of socket_create() call is masked

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.

ostico/phporient socket connection error in centos

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.

Create Edge with recordCreate

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);

Bad token incorrectly results in socket timeout

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.