\CodeIgniter\Database\PostgrePreparedQuery

Prepared query for Postgre

Summary

Methods
Properties
Constants
__construct()
prepare()
_prepare()
execute()
_execute()
_getResult()
close()
getQueryString()
hasError()
getErrorCode()
getErrorMessage()
parameterize()
No public properties found
No constants found
No protected methods found
$statement
$errorCode
$errorString
$query
$db
$name
$result
N/A
No private methods found
No private properties found
N/A

Properties

$statement

$statement : resource|\mysqli_stmt

The prepared statement itself.

Type

resource|\mysqli_stmt

$errorCode

$errorCode : integer

The error code, if any.

Type

integer

$errorString

$errorString : string

The error message, if any.

Type

string

$query

$query : \CodeIgniter\Database\Query

Holds the prepared query object that is cloned during execute.

Type

\CodeIgniter\Database\Query

$name

$name : string

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

Type

string

$result

$result : 

The result resource from a successful pg_exec. Or false.

Type

Methods

prepare()

prepare(string  $sql, array  $options = array(), string  $queryClass = 'CodeIgniter\\Database\\Query') : mixed

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

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

Parameters

string $sql
array $options

Passed to the connection's prepare statement.

string $queryClass

Returns

mixed

_prepare()

_prepare(string  $sql, array  $options = array()) : mixed

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

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

Parameters

string $sql
array $options

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

Throws

\Exception

Returns

mixed

execute()

execute(array  $data) : \CodeIgniter\Database\ResultInterface

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

Parameters

array $data

Returns

\CodeIgniter\Database\ResultInterface

_execute()

_execute(array  $data) : boolean

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

Parameters

array $data

Returns

boolean

_getResult()

_getResult() : mixed

Returns the result object for the prepared query.

Returns

mixed

close()

close() : null|void

Explicitly closes the statement.

Returns

null|void

getQueryString()

getQueryString() : string

Returns the SQL that has been prepared.

Returns

string

hasError()

hasError() : boolean

A helper to determine if any error exists.

Returns

boolean

getErrorCode()

getErrorCode() : integer

Returns the error code created while executing this statement.

Returns

integer

getErrorMessage()

getErrorMessage() : string

Returns the error message created while executing this statement.

Returns

string

parameterize()

parameterize(string  $sql) : string

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

Parameters

string $sql

Returns

string