SQLConnection

Represents a connection to a SQL database

package

Default

Methods

__construct

__construct() 

Batch simple SQL strings and execute the batch where the async result contains a array of Integers.

batch( $arg0,  $arg1) : $this

Arguments

$arg0

array

$arg1

callable

Response

$this

Batch a callable statement with all entries from the args list. Each entry is a batch.

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

The size of the lists inArgs and outArgs MUST be the equal. The operation completes with the execution of the batch where the async result contains a array of Integers.

Arguments

$arg0

string

$arg1

array

$arg2

array

$arg3

callable

Response

$this

Batch a prepared statement with all entries from the args list. Each entry is a batch.

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

The operation completes with the execution of the batch where the async result contains a array of Integers.

Arguments

$arg0

string

$arg1

array

$arg2

callable

Response

$this

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

Closes the connection. Important to always close the connection when you are done so it's returned to the pool.

close( $arg0 = null) : void

close()

Closes the connection. Important to always close the connection when you are done so it's returned to the pool.

param $handler [callable] the handler called when this operation completes. close($handler)

Arguments

$arg0

callable

Commits all changes made since the previous commit/rollback.

commit( $arg0) : $this

Arguments

$arg0

callable

Response

$this

Executes the given SQL statement

execute( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

callable

Response

$this

Attempts to return the transaction isolation level for this Connection object to the one given.

getTransactionIsolation( $arg0) : $this

Arguments

$arg0

callable

Response

$this

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

query( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

callable

Response

$this

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

Executes the given SQL <code>SELECT</code> prepared statement which returns the results of the query.

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

Arguments

$arg0

string

$arg1

array

$arg2

callable

Response

$this

Rolls back all changes made since the previous commit/rollback.

rollback( $arg0) : $this

Arguments

$arg0

callable

Response

$this

Sets the auto commit flag for this connection. True by default.

setAutoCommit( $arg0,  $arg1) : $this

Arguments

$arg0

boolean

$arg1

callable

Response

$this

Sets the desired options to be applied to the current connection when statements are executed.

setOptions( $arg0) : $this

The options are not applied globally but applicable to the current connection. For example changing the transaction isolation level will only affect statements run on this connection and not future or current connections acquired from the connection pool.

This method is not async in nature since the apply will only happen at the moment a query is run.

Arguments

$arg0

array | SQLOptions

Response

$this

Sets a connection wide query timeout.

setQueryTimeout( $arg0) : $this

It can be over written at any time and becomes active on the next query call.

deprecated

Arguments

$arg0

integer

Response

$this

Attempts to change the transaction isolation level for this Connection object to the one given.

setTransactionIsolation( $arg0,  $arg1) : $this

The constants defined in the interface Connection are the possible transaction isolation levels.

Arguments

$arg0

string

$arg1

callable

Response

$this

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