JDBCClient

An asynchronous client interface for interacting with a JDBC 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

Create a JDBC client which maintains its own data source.

createNonShared( $arg0,  $arg1) : \io\vertx\jphp\ext\jdbc\JDBCClient
static

Arguments

$arg0

Vertx

$arg1

array

Response

\io\vertx\jphp\ext\jdbc\JDBCClient

the client

Like @see \io\vertx\jphp\ext\jdbc\JDBCClient::createShared but with the default data source name

createShared( $arg0,  $arg1,  $arg2 = null) : \io\vertx\jphp\ext\jdbc\JDBCClient
static

param $vertx [Vertx] the Vert.x instance param $config [array] the configuration createShared($vertx, $config)

Create a JDBC client which shares its data source with any other JDBC clients created with the same data source name

param $vertx [Vertx] the Vert.x instance param $config [array] the configuration param $dataSourceName [string] the data source name createShared($vertx, $config, $dataSourceName)

Arguments

$arg0

Vertx

$arg1

array

$arg2

string

Response

\io\vertx\jphp\ext\jdbc\JDBCClient

the client

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

Constants

The default data source provider is C3P0

DEFAULT_PROVIDER_CLASS
var

php文件只是为了写代码方便,常量的实际值请参考原java文件

The name of the default data source

DEFAULT_DS_NAME
var

php文件只是为了写代码方便,常量的实际值请参考原java文件