CodeIgniter v4.5 API

QueryInterface

Interface 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.
getQuery()  : mixed
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()  : mixed
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()  : mixed
Stores the error description that happened for this query.
setQuery()  : mixed
Sets the raw query string to use for this statement.
swapPrefix()  : mixed
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

getQuery()

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

public getQuery() : mixed

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 ]) : mixed
Parameters
$start : float
$end : float|null = null

setError()

Stores the error description that happened for this query.

public setError(int $code, string $error) : mixed
Parameters
$code : int
$error : string

setQuery()

Sets the raw query string to use for this statement.

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

swapPrefix()

Swaps out one table prefix for a new one.

public swapPrefix(string $orig, string $swap) : mixed
Parameters
$orig : string
$swap : string

        
On this page

Search results