Skip to content
PommeVerte edited this page Aug 24, 2014 · 9 revisions

This is going to be an overview of the Methods provided by the rexpro-php Connection class.

Methods

bindValue($bind,$value)

Bind values for the gremlin script.

  • $bind (String) : The name of the binding
  • $value (Mixed) : The value that is meant to replace the binding

close()

Close a connection.

getSerializer()

Returns the current serializer as a String:

isConnected()

Checks if the client is connected to the server.

  • return (bool)

open($host,$graph,$username,$password,$graphObject)

Open a connection with Rexster.

  • $host (String) : Host and port seperated by :. This defaults to localhost:8184.
  • $graph (String) : Name of the graph to load. This has to be defined within the Rexster configuration xml. Defaults to tinkergraph
  • $username (String) : Username used to connect to Rexster. Defaults to null
  • $password (String) : Password used to connect to Rexster as user $username. Defaults to null
  • $graphObject (String) : The name you want to store the graph object into. Defaults to g
  • return (Bool) : true on success, false on error

runScript($inSession,$isolated)

Run the script contained inside Connection::script.

  • $inSession (Bool) : Whether or not to run the script within the session that was created on connection. Defaults to true
  • isolated (Bool) : Whether or not you want to isolate the bindings from this script. This means that bindings will not be accessible to other queries. Defaults to true
  • return (Mixed) : Array with query result or false on error

setSerializer($value)

Sets the serializer to use.

  • $value (Int) :
    * Messages::SERIALIZER_MSGPACK : 0 * Messages::SERIALIZER_JSON : 1

transactionStart()

Start a transaction. All runScript() calls after this method call will not be committed to the graph until transactionStop(true) is called.

  • return (Bool) : true on success, false on error (if already in a transaction current transaction will be rolled back)

transactionStop($success)

Stops a transaction started by transactionStart().

  • success (Bool) : whether or not to commit changes. If false then changes made within the transaction will be rolled back. Defaults to true.
  • return (Bool) : true on success, false on error (if no transaction exists)

Properties

$bindings (Array)

Bindings set in for the current script

$error (Exceptions)

_Error object containing information about the last error to occur. Only relevant parts are Exceptions::code and Exceptions::description

$graph (String)

Name of the graph to load. This has to be defined within the Rexster configuration xml. You might need to define this on the fly in the case of a session-less script request.

$graphObject (String)

The name you want to store the graph object into. You might need to define this on the fly in the case of a session-less script request

$host (String)

_Host and port seperated by :. _

$password (String)

Password used to connect to Rexster.

$sessionUuid (String)

The sesssion UUID for this connection.

$script (String)

The Gremlin script to run.

$timeout (Float)

The time in seconds after which the client times out. Default to the php.ini value ini_get("default_socket_timeout").

$username (String)

Username used to connect to Rexster.