CodeIgniter v4.7 API

QueryInterface

Represents a single statement that can be executed against the database.

Statements are platform-specific and can handle binding of binds.

Table of Contents

Methods

getDuration()  : string
Returns the duration of this query during execution, or null if the query has not been executed yet.
getErrorCode()  : int
Returns the error code created while executing this statement.
getErrorMessage()  : string
Returns the error message created while executing this statement.
getOriginalQuery()  : string
Returns the original SQL that was passed into the system.
getQuery()  : string
Returns the final, processed query string after binding, etal has been performed.
hasError()  : bool
Reports whether this statement created an error not.
isWriteType()  : bool
Determines if the statement is a write-type query or not.
setDuration()  : self
Records the execution time of the statement using microtime(true) for it's start and end values. If no end value is present, will use the current time to determine total duration.
setError()  : self
Stores the error description that happened for this query.
setQuery()  : self
Sets the raw query string to use for this statement.
swapPrefix()  : self
Swaps out one table prefix for a new one.

Methods

getDuration()

Returns the duration of this query during execution, or null if the query has not been executed yet.

public getDuration([int $decimals = 6 ]) : string
Parameters
$decimals : int = 6

The accuracy of the returned time.

Return values
string

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

getOriginalQuery()

Returns the original SQL that was passed into the system.

public getOriginalQuery() : string
Return values
string

getQuery()

Returns the final, processed query string after binding, etal has been performed.

public getQuery() : string
Return values
string

hasError()

Reports whether this statement created an error not.

public hasError() : bool
Return values
bool

isWriteType()

Determines if the statement is a write-type query or not.

public isWriteType() : bool
Return values
bool

setDuration()

Records the execution time of the statement using microtime(true) for it's start and end values. If no end value is present, will use the current time to determine total duration.

public setDuration(float $start[, float|null $end = null ]) : self
Parameters
$start : float
$end : float|null = null
Return values
self

setError()

Stores the error description that happened for this query.

public setError(int $code, string $error) : self
Parameters
$code : int
$error : string
Return values
self

setQuery()

Sets the raw query string to use for this statement.

public setQuery(string $sql[, mixed $binds = null ][, bool $setEscape = true ]) : self
Parameters
$sql : string
$binds : mixed = null
$setEscape : bool = true
Return values
self

swapPrefix()

Swaps out one table prefix for a new one.

public swapPrefix(string $orig, string $swap) : self
Parameters
$orig : string
$swap : string
Return values
self

        
On this page

Search results