\CodeIgniter\DatabaseQueryInterface

Interface QueryInterface

Represents a single statement that can be executed against the database. Statements are platform-specific and can handle binding of binds.

Summary

Methods
Constants
setQuery()
getQuery()
setDuration()
getDuration()
setError()
hasError()
getErrorCode()
getErrorMessage()
isWriteType()
swapPrefix()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

setQuery()

setQuery(string  $sql, mixed  $binds = null, boolean  $setEscape = true) : mixed

Sets the raw query string to use for this statement.

Parameters

string $sql
mixed $binds
boolean $setEscape

Returns

mixed

getQuery()

getQuery() : mixed

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

Returns

mixed

setDuration()

setDuration(float  $start, float  $end = null) : 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.

Parameters

float $start
float $end

Returns

mixed

getDuration()

getDuration(integer  $decimals = 6) : string

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

Parameters

integer $decimals

The accuracy of the returned time.

Returns

string

setError()

setError(integer  $code, string  $error) 

Stores the error description that happened for this query.

Parameters

integer $code
string $error

hasError()

hasError() : boolean

Reports whether this statement created an error not.

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

isWriteType()

isWriteType() : boolean

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

Returns

boolean

swapPrefix()

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

Swaps out one table prefix for a new one.

Parameters

string $orig
string $swap

Returns

mixed