SQLClient

A common asynchronous client interface for interacting with SQL compliant database

package

Default

Methods

__construct

__construct() 

Calls the given SQL <code>PROCEDURE</code> which returns the result from the procedure.

call( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

callable

Response

$this

Calls the given SQL <code>PROCEDURE</code> which returns the result from the procedure.

callWithParams( $arg0,  $arg1,  $arg2,  $arg3) : $this

The index of params and outputs are important for both arrays, for example when dealing with a prodecure that takes the first 2 arguments as input values and the 3 arg as an output then the arrays should be like:

  params = [VALUE1, VALUE2, null]
  outputs = [null, null, "VARCHAR"]

Arguments

$arg0

string

$arg1

array

$arg2

array

$arg3

callable

Response

$this

Close the client

close( $arg0 = null) : void

close()

Close the client and release all resources. Call the handler when close is complete.

param $handler [callable] the handler that will be called when close is complete close($handler)

Arguments

$arg0

callable

Returns a connection that can be used to perform SQL operations on. It's important to remember to close the connection when you are done, so it is returned to the pool.

getConnection( $arg0) : $this

Arguments

$arg0

callable

Response

$this

Execute a single SQL statement, this method acquires a connection from the the pool and executes the SQL statement and returns it back after the execution.

query( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

callable

Response

$this

self

Execute a one shot SQL statement that returns a single SQL row. This method will reduce the boilerplate code by getting a connection from the pool (this object) and return it back after the execution. Only the first result from the result set is returned.

querySingle( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

callable

Response

$this

self

Execute a one shot SQL statement with arguments that returns a single SQL row. This method will reduce the boilerplate code by getting a connection from the pool (this object) and return it back after the execution.

querySingleWithParams( $arg0,  $arg1,  $arg2) : $this

Only the first result from the result set is returned.

Arguments

$arg0

string

$arg1

array

$arg2

callable

Response

$this

self

Executes the given SQL <code>SELECT</code> statement which returns the results of the query as a read stream.

queryStream( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

callable

Response

$this

Executes the given SQL <code>SELECT</code> statement which returns the results of the query as a read stream.

queryStreamWithParams( $arg0,  $arg1,  $arg2) : $this

Arguments

$arg0

string

$arg1

array

$arg2

callable

Response

$this

Execute a single SQL prepared statement, this method acquires a connection from the the pool and executes the SQL prepared statement and returns it back after the execution.

queryWithParams( $arg0,  $arg1,  $arg2) : $this

Arguments

$arg0

string

$arg1

array

$arg2

callable

Response

$this

self

Executes the given SQL statement which may be an <code>INSERT</code>, <code>UPDATE</code>, or <code>DELETE</code> statement.

update( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

callable

Response

$this

Executes the given prepared statement which may be an <code>INSERT</code>, <code>UPDATE</code>, or <code>DELETE</code> statement with the given parameters

updateWithParams( $arg0,  $arg1,  $arg2) : $this

Arguments

$arg0

string

$arg1

array

$arg2

callable

Response

$this