query($sql, $params[], $fetch_type)
executes prepared$sql
with$params
. it can be used for custom queriesgetSql()
returns SQL query string which will be executedgetParams()
returns an array of parameters for a querygetResult()
returns query's resultsgetCount()
returns results' rows countgetDriver()
returns DB driver name in lowercasehasError()
returnstrue
if an error is hadgetErrorMessage()
returns an error message if an error is hadsetError($message)
sets$error
totrue
and$errorMessage
getFirst()
returns the first item of resultsgetLast()
returns the last item of resultsreset()
resets state to default values (except PDO property)all()
executes SQL query and returns all rows of result (fetchAll()
)one()
executes SQL query and returns the first row of result (fetch()
)column($col)
executes SQL query and returns the needed column of result by its name,col
is'id'
by defaultpluck($key, $col)
executes SQL query and returns an array (the key (usually ID) and the needed column of result) by their names,key
isid
andcol
is''
by defaultgo()
this method is for nonSELECT
queries. it executes SQL query and returns nothing (but returns the last inserted row ID forINSERT
method)count()
prepares a query with SQLCOUNT(*)
function and executes itexists()
returnstrue
if SQL query has at least one row andfalse
if it hasn't
'SQL' methods are presented in the next section.