PreparedQuery
extends BasePreparedQuery
in package
Prepared query for Postgre
Tags
Table of Contents
Properties
- $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 : false|Result
- The result resource from a successful pg_exec. Or false.
- $statement : object|resource|null
- The prepared statement itself.
Methods
- __construct() : mixed
- _execute() : bool
- Takes a new set of data and runs it against the currently prepared query. Upon success, will return a Results object.
- _getResult() : Result|null
- Returns the result object for the prepared query or false on failure.
- _prepare() : $this
- Prepares the query against the database, and saves the connection info necessary to execute the query later.
- close() : bool
- Explicitly closes the prepared statement.
- execute() : bool|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() : $this
- Prepares the query against the database, and saves the connection info necessary to execute the query later.
- _close() : bool
- Deallocate prepared statements.
Properties
$db
A reference to the db connection to use.
protected
BaseConnection
$db
Tags
$errorCode
The error code, if any.
protected
int
$errorCode
$errorString
The error message, if any.
protected
string
$errorString
$name
Stores the name this query can be used under by postgres. Only used internally.
protected
string
$name
$query
Holds the prepared query object that is cloned during execute.
protected
Query
$query
$result
The result resource from a successful pg_exec. Or false.
protected
false|Result
$result
$statement
The prepared statement itself.
protected
object|resource|null
$statement
Tags
Methods
__construct()
public
__construct(BaseConnection $db) : mixed
Parameters
- $db : BaseConnection
_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 or false on failure.
public
_getResult() : Result|null
Return values
Result|null_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 = [] ]) : $this
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
Return values
$thisclose()
Explicitly closes the prepared statement.
public
close() : bool
Tags
Return values
boolexecute()
Takes a new set of data and runs it against the currently prepared query. Upon success, will return a Results object.
public
execute(mixed ...$data) : bool|ResultInterface
Parameters
- $data : mixed
Tags
Return values
bool|ResultInterfacegetErrorCode()
Returns the error code created while executing this statement.
public
getErrorCode() : int
Return values
intgetErrorMessage()
Returns the error message created while executing this statement.
public
getErrorMessage() : string
Return values
stringgetQueryString()
Returns the SQL that has been prepared.
public
getQueryString() : string
Return values
stringhasError()
A helper to determine if any error exists.
public
hasError() : bool
Return values
boolparameterize()
Replaces the ? placeholders with $1, $2, etc parameters for use within the prepared query.
public
parameterize(string $sql) : string
Parameters
- $sql : string
Return values
stringprepare()
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 = Query::class ]) : $this
NOTE: This version is based on SQL code. Child classes should override this method.
Parameters
- $sql : string
- $options : array<string|int, mixed> = []
- $queryClass : string = Query::class
Return values
$this_close()
Deallocate prepared statements.
protected
_close() : bool