MySQLClient

Represents an asynchronous MySQL client

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 MySQL client which maintains its own pool.

createNonShared( $arg0,  $arg1) : \io\vertx\jphp\ext\asyncsql\AsyncSQLClient
static

Arguments

$arg0

Vertx

$arg1

array

Response

\io\vertx\jphp\ext\asyncsql\AsyncSQLClient

the client

Like @see \io\vertx\jphp\ext\asyncsql\MySQLClient::createShared but with the default pool name

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

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

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

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

Arguments

$arg0

Vertx

$arg1

array

$arg2

string

Response

\io\vertx\jphp\ext\asyncsql\AsyncSQLClient

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 name used for the MySQL pool.

DEFAULT_POOL_NAME
var

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

The default host.

DEFAULT_HOST
var

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

The default port.

DEFAULT_PORT
var

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

The default database.

DEFAULT_DATABASE
var

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

The default database user.

DEFAULT_USER
var

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

The default database password.

DEFAULT_PASSWORD
var

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

The default charset.

DEFAULT_CHARSET
var

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

The default timeout for connect.

DEFAULT_CONNECT_TIMEOUT
var

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

The default timeout for tests.

DEFAULT_TEST_TIMEOUT
var

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