class Statement

The class JsonSQLStatement represents a prepared statement and, after the statement is executed, an associated result set.

Properties

protected JsonSQL $jsonsql
protected stdClass $request
protected array $result
protected int $rowCount
protected array $params
protected Engine $engine

Methods

__construct(JsonSQL $jsonsql, stdClass $request)

Class Constructor

create(JsonSQL $jsonsql, stdClass $request)

Statement factory

bool
bindValue(mixed $parameter, mixed $value, int $type = \PDO::PARAM_STR)

Binds a value to a corresponding named or question mark placeholder in the SQL statement that was used to prepare the statement.

bool
bindParam($parameter, $variable, $type = \PDO::PARAM_STR)

Binds a PHP variable to a corresponding named or question mark placeholder in the SQL statement that was used to prepare the statement.

bool
execute($parameters = array())

Executes a prepared statement.

int
rowCount()

Returns the number of rows affected by the last SQL statement

int
columnCount()

Returns the number of columns in the result set

void
checkValue(string $value, int $type = \PDO::PARAM_STR)

Checks if a value corresponds to its type and if it is safety in case of string

Details

at line 92
protected __construct(JsonSQL $jsonsql, stdClass $request)

Class Constructor

Parameters

JsonSQL $jsonsql The JsonSQL instance
stdClass $request The prepared statement

at line 109
create(JsonSQL $jsonsql, stdClass $request)

Statement factory

Parameters

JsonSQL $jsonsql The JsonSQL instance
stdClass $request The prepared statement

at line 138
bool bindValue(mixed $parameter, mixed $value, int $type = \PDO::PARAM_STR)

Binds a value to a corresponding named or question mark placeholder in the SQL statement that was used to prepare the statement.

Parameters

mixed $parameter The parameter identifier
mixed $value The value to bind to the parameter
int $type The data type for the parameter using the PDO::PARAM_* constants.

Return Value

bool true on success or false on failure.

at line 189
bool bindParam($parameter, $variable, $type = \PDO::PARAM_STR)

Binds a PHP variable to a corresponding named or question mark placeholder in the SQL statement that was used to prepare the statement.

the variable is bound as a reference and will only be evaluated at the time that execute() is called.

Parameters

$parameter
$variable
$type

Return Value

bool true on success or false on failure.

at line 202
bool execute($parameters = array())

Executes a prepared statement.

Parameters

$parameters

Return Value

bool true on success or false on failure.

at line 244
int rowCount()

Returns the number of rows affected by the last SQL statement

Return Value

int The number of rows.

at line 255
int columnCount()

Returns the number of columns in the result set

Return Value

int The number of columns in the result set. If there is no result set, returns 0.

at line 268
protected void checkValue(string $value, int $type = \PDO::PARAM_STR)

Checks if a value corresponds to its type and if it is safety in case of string

Parameters

string $value The value
int $type The expected type

Return Value

void

Exceptions

JsonSQLException