Documentation

PreparedQuery extends BasePreparedQuery
in package

Prepared query for Postgre

Table of Contents

$db  : BaseConnection
A reference to the db connection to use.
$errorCode  : int
The error code, if any.
$errorString  : string
The error message, if any.
$name  : string
Stores the name this query can be used under by postgres. Only used internally.
$query  : Query
Holds the prepared query object that is cloned during execute.
$result  : Result|bool
The result resource from a successful pg_exec. Or false.
$statement  : object|resource
The prepared statement itself.
__construct()  : mixed
Constructor.
_execute()  : bool
Takes a new set of data and runs it against the currently prepared query. Upon success, will return a Results object.
_getResult()  : mixed
Returns the result object for the prepared query.
_prepare()  : mixed
Prepares the query against the database, and saves the connection info necessary to execute the query later.
close()  : void
Explicitly closes the statement.
execute()  : ResultInterface
Takes a new set of data and runs it against the currently prepared query. Upon success, will return a Results object.
getErrorCode()  : int
Returns the error code created while executing this statement.
getErrorMessage()  : string
Returns the error message created while executing this statement.
getQueryString()  : string
Returns the SQL that has been prepared.
hasError()  : bool
A helper to determine if any error exists.
parameterize()  : string
Replaces the ? placeholders with $1, $2, etc parameters for use within the prepared query.
prepare()  : mixed
Prepares the query against the database, and saves the connection info necessary to execute the query later.

Properties

$name

Stores the name this query can be used under by postgres. Only used internally.

protected string $name

$result

The result resource from a successful pg_exec. Or false.

protected Result|bool $result

$statement

The prepared statement itself.

protected object|resource $statement

Methods

_execute()

Takes a new set of data and runs it against the currently prepared query. Upon success, will return a Results object.

public _execute(array<string|int, mixed> $data) : bool
Parameters
$data : array<string|int, mixed>
Return values
bool

_getResult()

Returns the result object for the prepared query.

public _getResult() : mixed
Return values
mixed

_prepare()

Prepares the query against the database, and saves the connection info necessary to execute the query later.

public _prepare(string $sql[, array<string|int, mixed> $options = [] ]) : mixed

NOTE: This version is based on SQL code. Child classes should override this method.

Parameters
$sql : string
$options : array<string|int, mixed> = []

Passed to the connection's prepare statement. Unused in the MySQLi driver.

Tags
throws
Exception
Return values
mixed

close()

Explicitly closes the statement.

public close() : void
Return values
void

execute()

Takes a new set of data and runs it against the currently prepared query. Upon success, will return a Results object.

public execute(array<string|int, mixed> ...$data) : ResultInterface
Parameters
$data : array<string|int, mixed>
Return values
ResultInterface

getErrorCode()

Returns the error code created while executing this statement.

public getErrorCode() : int
Return values
int

getErrorMessage()

Returns the error message created while executing this statement.

public getErrorMessage() : string
Return values
string

getQueryString()

Returns the SQL that has been prepared.

public getQueryString() : string
Return values
string

hasError()

A helper to determine if any error exists.

public hasError() : bool
Return values
bool

parameterize()

Replaces the ? placeholders with $1, $2, etc parameters for use within the prepared query.

public parameterize(string $sql) : string
Parameters
$sql : string
Return values
string

prepare()

Prepares the query against the database, and saves the connection info necessary to execute the query later.

public prepare(string $sql[, array<string|int, mixed> $options = [] ][, string $queryClass = 'CodeIgniter\Database\Query' ]) : mixed

NOTE: This version is based on SQL code. Child classes should override this method.

Parameters
$sql : string
$options : array<string|int, mixed> = []

Passed to the connection's prepare statement.

$queryClass : string = 'CodeIgniter\Database\Query'
Return values
mixed

Search results