class SQLite3Stmt (View source)

A class that handles prepared statements for the SQLite 3 extension.

Methods

int
paramCount()

Returns the number of parameters within the prepared statement

bool
close()

Closes the prepared statement

bool
reset()

Resets the prepared statement

bool
clear()

Clears all current bound parameters

SQLite3Result|false
execute()

Executes a prepared statement and returns a result set object

bool
bindParam(string $param, mixed $var, int $type = SQLITE3_TEXT)

Binds a parameter to a statement variable

bool
bindValue(string $param, mixed $value, int $type = SQLITE3_TEXT)

Binds the value of a parameter to a statement variable

bool
readOnly()

No description

string|false
getSQL(bool $expand = false)

Retrieves the SQL of the prepared statement. If expanded is FALSE, the unmodified SQL is retrieved.

Details

int paramCount()

Returns the number of parameters within the prepared statement

Return Value

int

the number of parameters within the prepared statement.

bool close()

Closes the prepared statement

Return Value

bool TRUE

bool reset()

Resets the prepared statement

Return Value

bool

TRUE if the statement is successfully reset, FALSE on failure.

bool clear()

Clears all current bound parameters

Return Value

bool

TRUE on successful clearing of bound parameters, FALSE on failure.

SQLite3Result|false execute()

Executes a prepared statement and returns a result set object

Return Value

SQLite3Result|false

an SQLite3Result object on successful execution of the prepared statement, FALSE on failure.

bool bindParam(string $param, mixed $var, int $type = SQLITE3_TEXT)

Binds a parameter to a statement variable

Parameters

string $param

An string identifying the statement variable to which the parameter should be bound.

mixed $var

The parameter to bind to a statement variable.

int $type

[optional]

The data type of the parameter to bind.

SQLITE3_INTEGER: The value is a signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value.

Return Value

bool

TRUE if the parameter is bound to the statement variable, FALSE on failure.

bool bindValue(string $param, mixed $value, int $type = SQLITE3_TEXT)

Binds the value of a parameter to a statement variable

Parameters

string $param

An string identifying the statement variable to which the value should be bound.

mixed $value

The value to bind to a statement variable.

int $type

[optional]

The data type of the value to bind.

SQLITE3_INTEGER: The value is a signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value.

Return Value

bool

TRUE if the value is bound to the statement variable, FALSE on failure.

bool readOnly()

No description

Return Value

bool

string|false getSQL(bool $expand = false)

Since: 7.4

Retrieves the SQL of the prepared statement. If expanded is FALSE, the unmodified SQL is retrieved.

If expanded is TRUE, all query parameters are replaced with their bound values, or with an SQL NULL, if not already bound.

Parameters

bool $expand

Whether to retrieve the expanded SQL. Passing TRUE is only supported as of libsqlite 3.14.

Return Value

string|false

Returns the SQL of the prepared statement, or FALSE on failure.