Class MockBuilder

Summary

Fully Qualified Name: CodeIgniter\Test\Mock\MockBuilder
Extends: BaseBuilder

Description

Methods

Name Description Defined By
__construct() MockBuilder
countAll() "Count All" query BaseBuilder
countAllResults() "Count All Results" query BaseBuilder
decrement() Decrements a numeric column by the specified value. BaseBuilder
delete() Delete BaseBuilder
distinct() DISTINCT BaseBuilder
emptyTable() Empty Table BaseBuilder
from() From BaseBuilder
get() Get BaseBuilder
getBinds() Returns an array of bind values and their named parameters for binding in the Query object later. BaseBuilder
getCompiledDelete() Get DELETE query string BaseBuilder
getCompiledInsert() Get INSERT query string BaseBuilder
getCompiledQBWhere() Get compiled 'where' condition string BaseBuilder
getCompiledSelect() Get SELECT query string BaseBuilder
getCompiledUpdate() Get UPDATE query string BaseBuilder
getSetData() Returns the previously set() data, alternatively resetting it if needed. BaseBuilder
getWhere() Get_Where BaseBuilder
groupBy() GROUP BY BaseBuilder
groupEnd() Ends a query group BaseBuilder
groupStart() Starts a query group. BaseBuilder
having() HAVING BaseBuilder
havingGroupEnd() Ends a query group for HAVING clause. BaseBuilder
havingGroupStart() Starts a query group for HAVING clause. BaseBuilder
havingIn() HAVING IN BaseBuilder
havingLike() LIKE with HAVING clause BaseBuilder
havingNotIn() HAVING NOT IN BaseBuilder
ignore() Ignore BaseBuilder
increment() Increments a numeric column by the specified value. BaseBuilder
insert() Insert BaseBuilder
insertBatch() Insert_Batch BaseBuilder
join() JOIN BaseBuilder
like() LIKE BaseBuilder
limit() LIMIT BaseBuilder
notGroupStart() Starts a query group, but NOTs the group BaseBuilder
notHavingGroupStart() Starts a query group for HAVING clause, but NOTs the group. BaseBuilder
notHavingLike() NOT LIKE with HAVING clause BaseBuilder
notLike() NOT LIKE BaseBuilder
offset() Sets the OFFSET value BaseBuilder
orGroupStart() Starts a query group, but ORs the group BaseBuilder
orHaving() OR HAVING BaseBuilder
orHavingGroupStart() Starts a query group for HAVING clause, but ORs the group. BaseBuilder
orHavingIn() OR HAVING IN BaseBuilder
orHavingLike() OR LIKE with HAVING clause BaseBuilder
orHavingNotIn() OR HAVING NOT IN BaseBuilder
orLike() OR LIKE BaseBuilder
orNotGroupStart() Starts a query group, but OR NOTs the group BaseBuilder
orNotHavingGroupStart() Starts a query group for HAVING clause, but OR NOTs the group. BaseBuilder
orNotHavingLike() OR NOT LIKE with HAVING clause BaseBuilder
orNotLike() OR NOT LIKE BaseBuilder
orWhere() OR WHERE BaseBuilder
orWhereIn() OR WHERE IN BaseBuilder
orWhereNotIn() OR WHERE NOT IN BaseBuilder
orderBy() ORDER BY BaseBuilder
replace() Replace BaseBuilder
resetQuery() Reset Query Builder values. BaseBuilder
select() Select BaseBuilder
selectAvg() Select Average BaseBuilder
selectCount() Select Count BaseBuilder
selectMax() Select Max BaseBuilder
selectMin() Select Min BaseBuilder
selectSum() Select Sum BaseBuilder
set() The "set" function. BaseBuilder
setInsertBatch() The "setInsertBatch" function. Allows key/value pairs to be set for batch inserts BaseBuilder
setUpdateBatch() The "setUpdateBatch" function. Allows key/value pairs to be set for batch updating BaseBuilder
testMode() Sets a test mode status. BaseBuilder
truncate() Truncate BaseBuilder
update() UPDATE BaseBuilder
updateBatch() Update_Batch BaseBuilder
where() WHERE BaseBuilder
whereIn() WHERE IN BaseBuilder
whereNotIn() WHERE NOT IN BaseBuilder

Method Details

__construct()

Parameter Name Type Description
$tableName
$db
$options

Returns: void

countAll()

"Count All" query

Generates a platform-specific query string that counts all records in the specified database

Parameter Name Type Description
$reset bool Are

Returns: int|string when $test = true

countAllResults()

"Count All Results" query

Generates a platform-specific query string that counts all records returned by an Query Builder query.

Parameter Name Type Description
$reset bool

Returns: int|string when $test = true

decrement()

Decrements a numeric column by the specified value.

Parameter Name Type Description
$column string
$value int

Returns: bool

delete()

Delete

Compiles a delete string and runs the query

Parameter Name Type Description
$where mixed The
$limit int The
$reset_data bool

Returns: mixed

distinct()

DISTINCT

Sets a flag which tells the query string compiler to add DISTINCT

Parameter Name Type Description
$val bool

Returns: \BaseBuilder

emptyTable()

Empty Table

Compiles a delete string and runs "DELETE FROM table"

Returns: bool TRUE on success, FALSE on failure

from()

From

Generates the FROM portion of the query

Parameter Name Type Description
$from mixed can
$overwrite bool Should

Returns: \BaseBuilder

get()

Get

Compiles the select statement based on the other functions called and runs the query

Parameter Name Type Description
$limit int The
$offset int The
$reset bool Are

Returns: \ResultInterface

getBinds()

Returns an array of bind values and their named parameters for binding in the Query object later.

Returns: array

getCompiledDelete()

Get DELETE query string

Compiles a delete query string and returns the sql

Parameter Name Type Description
$reset bool TRUE:

Returns: string

getCompiledInsert()

Get INSERT query string

Compiles an insert query and returns the sql

Parameter Name Type Description
$reset bool TRUE:

Returns: string

getCompiledQBWhere()

Get compiled 'where' condition string

Compiles the set conditions and returns the sql statement

Returns: string

getCompiledSelect()

Get SELECT query string

Compiles a SELECT query string and returns the sql.

Parameter Name Type Description
$reset bool TRUE:

Returns: string

getCompiledUpdate()

Get UPDATE query string

Compiles an update query and returns the sql

Parameter Name Type Description
$reset bool TRUE:

Returns: string

getSetData()

Returns the previously set() data, alternatively resetting it if needed.

Parameter Name Type Description
$clean bool

Returns: array

getWhere()

Get_Where

Allows the where clause, limit and offset to be added directly

Parameter Name Type Description
$where string|array Where
$limit int Limit
$offset int Offset
$reset bool Are

Returns: \ResultInterface

groupBy()

GROUP BY

Parameter Name Type Description
$by string|array
$escape bool

Returns: \BaseBuilder

groupEnd()

Ends a query group

Returns: \BaseBuilder

groupStart()

Starts a query group.

Returns: \BaseBuilder

having()

HAVING

Separates multiple calls with 'AND'.

Parameter Name Type Description
$key string|array
$value mixed
$escape bool

Returns: \BaseBuilder

havingGroupEnd()

Ends a query group for HAVING clause.

Returns: \BaseBuilder

havingGroupStart()

Starts a query group for HAVING clause.

Returns: \BaseBuilder

havingIn()

HAVING IN

Generates a HAVING field IN('item', 'item') SQL query, joined with 'AND' if appropriate.

Parameter Name Type Description
$key string The
$values array|string|\Closure The
$escape bool

Returns: \BaseBuilder

havingLike()

LIKE with HAVING clause

Generates a %LIKE% portion of the query. Separates multiple calls with 'AND'.

Parameter Name Type Description
$field mixed
$match string
$side string
$escape bool
$insensitiveSearch

Returns: \BaseBuilder

havingNotIn()

HAVING NOT IN

Generates a HAVING field NOT IN('item', 'item') SQL query, joined with 'AND' if appropriate.

Parameter Name Type Description
$key string The
$values array|string|\Closure The
$escape bool

Returns: \BaseBuilder

ignore()

Ignore

Set ignore Flag for next insert, update or delete query.

Parameter Name Type Description
$ignore bool

Returns: \BaseBuilder

increment()

Increments a numeric column by the specified value.

Parameter Name Type Description
$column string
$value int

Returns: bool

insert()

Insert

Compiles an insert string and runs the query

Parameter Name Type Description
$set array An
$escape bool Whether

Returns: \BaseResult|\Query|bool

insertBatch()

Insert_Batch

Compiles batch insert strings and runs the queries

Parameter Name Type Description
$set array An
$escape bool Whether
$batchSize int Batch

Returns: int Number of rows inserted or FALSE on failure

join()

JOIN

Generates the JOIN portion of the query

Parameter Name Type Description
$table string
$cond string The
$type string The
$escape bool Whether

Returns: \BaseBuilder

like()

LIKE

Generates a %LIKE% portion of the query. Separates multiple calls with 'AND'.

Parameter Name Type Description
$field mixed
$match string
$side string
$escape bool
$insensitiveSearch bool IF

Returns: \BaseBuilder

limit()

LIMIT

Parameter Name Type Description
$value int LIMIT
$offset int OFFSET

Returns: \BaseBuilder

notGroupStart()

Starts a query group, but NOTs the group

Returns: \BaseBuilder

notHavingGroupStart()

Starts a query group for HAVING clause, but NOTs the group.

Returns: \BaseBuilder

notHavingLike()

NOT LIKE with HAVING clause

Generates a NOT LIKE portion of the query. Separates multiple calls with 'AND'.

Parameter Name Type Description
$field mixed
$match string
$side string
$escape bool
$insensitiveSearch

Returns: \BaseBuilder

notLike()

NOT LIKE

Generates a NOT LIKE portion of the query. Separates multiple calls with 'AND'.

Parameter Name Type Description
$field mixed
$match string
$side string
$escape bool
$insensitiveSearch bool IF

Returns: \BaseBuilder

offset()

Sets the OFFSET value

Parameter Name Type Description
$offset int OFFSET

Returns: \BaseBuilder

orGroupStart()

Starts a query group, but ORs the group

Returns: \BaseBuilder

orHaving()

OR HAVING

Separates multiple calls with 'OR'.

Parameter Name Type Description
$key string|array
$value mixed
$escape bool

Returns: \BaseBuilder

orHavingGroupStart()

Starts a query group for HAVING clause, but ORs the group.

Returns: \BaseBuilder

orHavingIn()

OR HAVING IN

Generates a HAVING field IN('item', 'item') SQL query, joined with 'OR' if appropriate.

Parameter Name Type Description
$key string The
$values array|string|\Closure The
$escape bool

Returns: \BaseBuilder

orHavingLike()

OR LIKE with HAVING clause

Generates a %LIKE% portion of the query. Separates multiple calls with 'OR'.

Parameter Name Type Description
$field mixed
$match string
$side string
$escape bool
$insensitiveSearch

Returns: \BaseBuilder

orHavingNotIn()

OR HAVING NOT IN

Generates a HAVING field NOT IN('item', 'item') SQL query, joined with 'OR' if appropriate.

Parameter Name Type Description
$key string The
$values array|string|\Closure The
$escape bool

Returns: \BaseBuilder

orLike()

OR LIKE

Generates a %LIKE% portion of the query. Separates multiple calls with 'OR'.

Parameter Name Type Description
$field mixed
$match string
$side string
$escape bool
$insensitiveSearch bool IF

Returns: \BaseBuilder

orNotGroupStart()

Starts a query group, but OR NOTs the group

Returns: \BaseBuilder

orNotHavingGroupStart()

Starts a query group for HAVING clause, but OR NOTs the group.

Returns: \BaseBuilder

orNotHavingLike()

OR NOT LIKE with HAVING clause

Generates a NOT LIKE portion of the query. Separates multiple calls with 'OR'.

Parameter Name Type Description
$field mixed
$match string
$side string
$escape bool
$insensitiveSearch

Returns: \BaseBuilder

orNotLike()

OR NOT LIKE

Generates a NOT LIKE portion of the query. Separates multiple calls with 'OR'.

Parameter Name Type Description
$field mixed
$match string
$side string
$escape bool
$insensitiveSearch bool IF

Returns: \BaseBuilder

orWhere()

OR WHERE

Generates the WHERE portion of the query. Separates multiple calls with 'OR'.

Parameter Name Type Description
$key mixed
$value mixed
$escape bool

Returns: \BaseBuilder

orWhereIn()

OR WHERE IN

Generates a WHERE field IN('item', 'item') SQL query, joined with 'OR' if appropriate.

Parameter Name Type Description
$key string The
$values array|string|\Closure The
$escape bool

Returns: \BaseBuilder

orWhereNotIn()

OR WHERE NOT IN

Generates a WHERE field NOT IN('item', 'item') SQL query, joined with 'OR' if appropriate.

Parameter Name Type Description
$key string The
$values array|string|\Closure The
$escape bool

Returns: \BaseBuilder

orderBy()

ORDER BY

Parameter Name Type Description
$orderBy string
$direction string ASC,
$escape bool

Returns: \BaseBuilder

replace()

Replace

Compiles an replace into string and runs the query

Parameter Name Type Description
$set array An

Returns: \BaseResult|\Query|string|bool

resetQuery()

Reset Query Builder values.

Publicly-visible method to reset the QB values.

Returns: \BaseBuilder

select()

Select

Generates the SELECT portion of the query

Parameter Name Type Description
$select string|array
$escape bool

Returns: \BaseBuilder

selectAvg()

Select Average

Generates a SELECT AVG(field) portion of a query

Parameter Name Type Description
$select string The
$alias string An

Returns: \BaseBuilder

selectCount()

Select Count

Generates a SELECT COUNT(field) portion of a query

Parameter Name Type Description
$select string The
$alias string An

Returns: \BaseBuilder

selectMax()

Select Max

Generates a SELECT MAX(field) portion of a query

Parameter Name Type Description
$select string The
$alias string An

Returns: \BaseBuilder

selectMin()

Select Min

Generates a SELECT MIN(field) portion of a query

Parameter Name Type Description
$select string The
$alias string An

Returns: \BaseBuilder

selectSum()

Select Sum

Generates a SELECT SUM(field) portion of a query

Parameter Name Type Description
$select string The
$alias string An

Returns: \BaseBuilder

set()

The "set" function.

Allows key/value pairs to be set for insert(), update() or replace().

Parameter Name Type Description
$key string|array|object Field
$value string Field
$escape bool Whether

Returns: \BaseBuilder

setInsertBatch()

The "setInsertBatch" function. Allows key/value pairs to be set for batch inserts

Parameter Name Type Description
$key mixed
$value string
$escape bool

Returns: \BaseBuilder|null

setUpdateBatch()

The "setUpdateBatch" function. Allows key/value pairs to be set for batch updating

Parameter Name Type Description
$key array|object
$index string
$escape bool

Returns: \BaseBuilder|null

testMode()

Sets a test mode status.

Parameter Name Type Description
$mode bool Mode

Returns: \BaseBuilder

truncate()

Truncate

Compiles a truncate string and runs the query If the database does not support the truncate() command This function maps to "DELETE FROM table"

Returns: bool TRUE on success, FALSE on failure

update()

UPDATE

Compiles an update string and runs the query.

Parameter Name Type Description
$set array An
$where mixed
$limit int

Returns: bool TRUE on success, FALSE on failure

updateBatch()

Update_Batch

Compiles an update string and runs the query

Parameter Name Type Description
$set array An
$index string The
$batchSize int The

Returns: mixed Number of rows affected, SQL string, or FALSE on failure

where()

WHERE

Generates the WHERE portion of the query. Separates multiple calls with 'AND'.

Parameter Name Type Description
$key mixed
$value mixed
$escape bool

Returns: \BaseBuilder

whereIn()

WHERE IN

Generates a WHERE field IN('item', 'item') SQL query, joined with 'AND' if appropriate.

Parameter Name Type Description
$key string The
$values array|string|\Closure The
$escape bool

Returns: \BaseBuilder

whereNotIn()

WHERE NOT IN

Generates a WHERE field NOT IN('item', 'item') SQL query, joined with 'AND' if appropriate.

Parameter Name Type Description
$key string The
$values array|string|\Closure The
$escape bool

Returns: \BaseBuilder

Top