CodeIgniter v4.5 API

MockQuery extends Query
in package

Query builder

Table of Contents

Properties

$db  : ConnectionInterface
Pointer to database connection.
$bindMarker  : string
Bind marker
$binds  : array<string|int, mixed>
The binds and their values used for binding.
$endTime  : float
The end time in seconds with microseconds for when this query was executed.
$errorCode  : int
The error code, if any.
$errorString  : string
The error message, if any.
$finalQueryString  : string|null
The final query string after binding, etc.
$originalQueryString  : string
The query string, as provided by the user.
$startTime  : float|string
The start time in seconds with microseconds for when this query was executed.
$swappedQueryString  : string|null
The query string if table prefix has been swapped.

Methods

__construct()  : mixed
__toString()  : string
Return text representation of the query
debugToolbarDisplay()  : string
Returns string to display in debug toolbar
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()  : mixed
Returns the final, processed query string after binding, etal has been performed.
getStartTime()  : float|string
Returns the start time in seconds with microseconds.
hasError()  : bool
Reports whether this statement created an error not.
isWriteType()  : bool
Determines if the statement is a write-type query or not.
setBinds()  : $this
Will store the variables to bind into the query later.
setDuration()  : $this
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()  : $this
Stores the error description that happened for this query.
setQuery()  : $this
Sets the raw query string to use for this statement.
swapPrefix()  : $this
Swaps out one table prefix for a new one.
compileBinds()  : mixed
Escapes and inserts any binds into the finalQueryString property.
matchNamedBinds()  : string
Match bindings
matchSimpleBinds()  : string
Match bindings

Properties

$bindMarker

Bind marker

protected string $bindMarker = '?'

Character used to identify values in a prepared statement.

$binds

The binds and their values used for binding.

protected array<string|int, mixed> $binds = []

$endTime

The end time in seconds with microseconds for when this query was executed.

protected float $endTime

$errorCode

The error code, if any.

protected int $errorCode

$errorString

The error message, if any.

protected string $errorString

$finalQueryString

The final query string after binding, etc.

protected string|null $finalQueryString

$originalQueryString

The query string, as provided by the user.

protected string $originalQueryString

$startTime

The start time in seconds with microseconds for when this query was executed.

protected float|string $startTime

$swappedQueryString

The query string if table prefix has been swapped.

protected string|null $swappedQueryString

Methods

__toString()

Return text representation of the query

public __toString() : string
Return values
string

debugToolbarDisplay()

Returns string to display in debug toolbar

public debugToolbarDisplay() : string
Return values
string

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() : mixed

getStartTime()

Returns the start time in seconds with microseconds.

public getStartTime([bool $returnRaw = false ][, int $decimals = 6 ]) : float|string
Parameters
$returnRaw : bool = false
$decimals : int = 6
Return values
float|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

setBinds()

Will store the variables to bind into the query later.

public setBinds(array<string|int, mixed> $binds[, bool $setEscape = true ]) : $this
Parameters
$binds : array<string|int, mixed>
$setEscape : bool = true
Return values
$this

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

setError()

Stores the error description that happened for this query.

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

setQuery()

Sets the raw query string to use for this statement.

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

swapPrefix()

Swaps out one table prefix for a new one.

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

matchNamedBinds()

Match bindings

protected matchNamedBinds(string $sql, array<string|int, mixed> $binds) : string
Parameters
$sql : string
$binds : array<string|int, mixed>
Return values
string

matchSimpleBinds()

Match bindings

protected matchSimpleBinds(string $sql, array<string|int, mixed> $binds, int $bindCount, int $ml) : string
Parameters
$sql : string
$binds : array<string|int, mixed>
$bindCount : int
$ml : int
Return values
string

        
On this page

Search results