Method | Description | |
---|---|---|
__construct ( PDO $PdoConnection = null, boolean $autoQuote = true ) : Miner | Constructor. | |
__toString ( ) : string | Get the full SQL statement without value placeholders. | |
andHaving ( string $column, mixed $value, string $operator = self::EQUALS, boolean | null $quote = null ) : Miner | Add an AND HAVING condition. | |
andWhere ( string $column, mixed $value, string $operator = self::EQUALS, boolean | null $quote = null ) : Miner | Add an AND WHERE condition. | |
autoQuote ( mixed $value, boolean | null $override = null ) : mixed | false | Safely escape a value if auto-quoting is enabled, or do nothing if disabled. | |
calcFoundRows ( ) : Miner | Add SQL_CALC_FOUND_ROWS execution option. | |
closeHaving ( ) : Miner | Add a closing bracket for nesting HAVING conditions. | |
closeWhere ( ) : Miner | Add a closing bracket for nesting WHERE conditions. | |
delete ( string | false $table = false ) : Miner | Add a table to DELETE from, or false if deleting from the FROM table. | |
distinct ( ) : Miner | Add DISTINCT execution option. | |
execute ( ) : PDOStatement | false | Execute the statement using the PDO database connection. | |
from ( string $table, string $alias = null ) : Miner | Set the FROM table with optional alias. | |
getAutoQuote ( boolean | null $override = null ) : boolean | Get whether values will be automatically escaped. | |
getDeleteString ( boolean $includeText = true ) : string | Get the DELETE portion of the statement as a string. | |
getFrom ( ) : string | Get the FROM table. | |
getFromAlias ( ) : string | Get the FROM table alias. | |
getFromString ( boolean $includeText = true ) : string | Get the FROM portion of the statement, including all JOINs, as a string. | |
getGroupByString ( boolean $includeText = true ) : string | Get the GROUP BY portion of the statement as a string. | |
getHavingPlaceholderValues ( ) : array | Get the HAVING placeholder values. | |
getHavingString ( boolean $usePlaceholders = true, boolean $includeText = true ) : string | Get the HAVING portion of the statement as a string. | |
getInsert ( ) : string | Get the INSERT table. | |
getInsertString ( boolean $includeText = true ) : string | Get the INSERT portion of the statement as a string. | |
getJoinString ( ) : string | Get the JOIN portion of the statement as a string. | |
getLimit ( ) : integer | string | Get the LIMIT on number of rows to return. | |
getLimitOffset ( ) : integer | string | Get the LIMIT row number to start at. | |
getLimitString ( boolean $includeText = true ) : string | Get the LIMIT portion of the statement as a string. | |
getOptionsString ( boolean $includeTrailingSpace = false ) : string | Get the execution options portion of the statement as a string. | |
getOrderByString ( boolean $includeText = true ) : string | Get the ORDER BY portion of the statement as a string. | |
getPdoConnection ( ) : PDO | null | Get the PDO database connection to use in executing this statement. | |
getPlaceholderValues ( ) : array | Get all placeholder values (SET, WHERE, and HAVING). | |
getReplace ( ) : string | Get the REPLACE table. | |
getReplaceString ( boolean $includeText = true ) : string | Get the REPLACE portion of the statement as a string. | |
getSelectString ( boolean $includeText = true ) : string | Get the SELECT portion of the statement as a string. | |
getSetPlaceholderValues ( ) : array | Get the SET placeholder values. | |
getSetString ( boolean $usePlaceholders = true, boolean $includeText = true ) : string | Get the SET portion of the statement as a string. | |
getStatement ( boolean $usePlaceholders = true ) : string | Get the full SQL statement. | |
getUpdate ( ) : string | Get the UPDATE table. | |
getUpdateString ( boolean $includeText = true ) : string | Get the UPDATE portion of the statement as a string. | |
getWherePlaceholderValues ( ) : array | Get the WHERE placeholder values. | |
getWhereString ( boolean $usePlaceholders = true, boolean $includeText = true ) : string | Get the WHERE portion of the statement as a string. | |
groupBy ( string $column, string | null $order = null ) : Miner | Add a GROUP BY column. | |
having ( string $column, mixed $value, string $operator = self::EQUALS, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | Add a HAVING condition. | |
havingBetween ( string $column, mixed $min, mixed $max, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | Add a BETWEEN HAVING condition. | |
havingIn ( string $column, array $values, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | Add an IN WHERE condition. | |
havingNotBetween ( string $column, mixed $min, mixed $max, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | Add a NOT BETWEEN HAVING condition. | |
havingNotIn ( string $column, array $values, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | Add a NOT IN HAVING condition. | |
innerJoin ( string $table, string | array $criteria = null, string $alias = null ) : Miner | Add an INNER JOIN table with optional ON criteria. | |
insert ( string $table ) : Miner | Set the INSERT table. | |
isDelete ( ) : boolean | Whether this is a DELETE statement. | |
isInsert ( ) : boolean | Whether this is an INSERT statement. | |
isReplace ( ) : boolean | Whether this is a REPLACE statement. | |
isSelect ( ) : boolean | Whether this is a SELECT statement. | |
isUpdate ( ) : boolean | Whether this is an UPDATE statement. | |
join ( string $table, string | array $criteria = null, string $type = self::INNER_JOIN, string $alias = null ) : Miner | Add a JOIN table with optional ON criteria. | |
leftJoin ( string $table, string | array $criteria = null, string $alias = null ) : Miner | Add a LEFT JOIN table with optional ON criteria. | |
limit ( integer | string $limit, integer | string $offset ) : Miner | Set the LIMIT on number of rows to return with optional offset. | |
mergeDeleteInto ( Miner $Miner ) : Miner | Merge this Miner's DELETE into the given Miner. | |
mergeFromInto ( Miner $Miner ) : Miner | Merge this Miner's FROM into the given Miner. | |
mergeGroupByInto ( Miner $Miner ) : Miner | Merge this Miner's GROUP BY into the given Miner. | |
mergeHavingInto ( Miner $Miner ) : Miner | Merge this Miner's HAVING into the given Miner. | |
mergeInsertInto ( Miner $Miner ) : Miner | Merge this Miner's INSERT into the given Miner. | |
mergeInto ( Miner $Miner, boolean $overrideLimit = true ) : Miner | Merge this Miner into the given Miner. | |
mergeJoinInto ( Miner $Miner ) : Miner | Merge this Miner's JOINs into the given Miner. | |
mergeLimitInto ( Miner $Miner ) : Miner | Merge this Miner's LIMIT into the given Miner. | |
mergeOptionsInto ( Miner $Miner ) : Miner | Merge this Miner's execution options into the given Miner. | |
mergeOrderByInto ( Miner $Miner ) : Miner | Merge this Miner's ORDER BY into the given Miner. | |
mergeReplaceInto ( Miner $Miner ) : Miner | Merge this Miner's REPLACE into the given Miner. | |
mergeSelectInto ( Miner $Miner ) : Miner | Merge this Miner's SELECT into the given Miner. | |
mergeSetInto ( Miner $Miner ) : Miner | Merge this Miner's SET into the given Miner. | |
mergeUpdateInto ( Miner $Miner ) : Miner | Merge this Miner's UPDATE into the given Miner. | |
mergeWhereInto ( Miner $Miner ) : Miner | Merge this Miner's WHERE into the given Miner. | |
openHaving ( string $connector = self::LOGICAL_AND ) : Miner | Add an open bracket for nesting HAVING conditions. | |
openWhere ( string $connector = self::LOGICAL_AND ) : Miner | Add an open bracket for nesting WHERE conditions. | |
option ( string $option ) : Miner | Add an execution option like DISTINCT or SQL_CALC_FOUND_ROWS. | |
orHaving ( string $column, mixed $value, string $operator = self::EQUALS, boolean | null $quote = null ) : Miner | Add an OR HAVING condition. | |
orWhere ( string $column, mixed $value, string $operator = self::EQUALS, boolean | null $quote = null ) : Miner | Add an OR WHERE condition. | |
orderBy ( string $column, string $order = self::ORDER_BY_ASC ) : Miner | Add a column to ORDER BY. | |
quote ( mixed $value ) : mixed | false | Safely escape a value for use in a statement. | |
replace ( string $table ) : Miner | Set the REPLACE table. | |
rightJoin ( string $table, string | array $criteria = null, string $alias = null ) : Miner | Add a RIGHT JOIN table with optional ON criteria. | |
select ( string $column, string $alias = null ) : Miner | Add a SELECT column, table, or expression with optional alias. | |
set ( string | array $column, mixed | null $value = null, boolean | null $quote = null ) : Miner | Add one or more column values to INSERT, UPDATE, or REPLACE. | |
setAutoQuote ( boolean | null $autoQuote ) : Miner | Set whether to automatically escape values. | |
setPdoConnection ( PDO $PdoConnection = null ) : Miner | Set the PDO database connection to use in executing this statement. | |
update ( string $table ) : Miner | Set the UPDATE table. | |
values ( array $values ) : Miner | Add an array of columns => values to INSERT, UPDATE, or REPLACE. | |
where ( string $column, mixed $value, string $operator = self::EQUALS, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | Add a WHERE condition. | |
whereBetween ( string $column, mixed $min, mixed $max, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | Add a BETWEEN WHERE condition. | |
whereIn ( string $column, array $values, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | Add an IN WHERE condition. | |
whereNotBetween ( string $column, mixed $min, mixed $max, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | Add a NOT BETWEEN WHERE condition. | |
whereNotIn ( string $column, array $values, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | Add a NOT IN WHERE condition. |
Method | Description | |
---|---|---|
closeCriteria ( array &$criteria ) : Miner | Add a closing bracket for nesting conditions to the specified WHERE or HAVING criteria. | |
criteria ( array &$criteria, string $column, mixed $value, string $operator = self::EQUALS, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | Add a condition to the specified WHERE or HAVING criteria. | |
criteriaBetween ( array &$criteria, string $column, mixed $min, mixed $max, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | Add a BETWEEN condition to the specified WHERE or HAVING criteria. | |
criteriaIn ( array &$criteria, string $column, array $values, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | Add an IN condition to the specified WHERE or HAVING criteria. | |
criteriaNotBetween ( array &$criteria, string $column, mixed $min, mixed $max, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | Add a NOT BETWEEN condition to the specified WHERE or HAVING criteria. | |
criteriaNotIn ( array &$criteria, string $column, array $values, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | Add a NOT IN condition to the specified WHERE or HAVING criteria. | |
getCriteriaString ( array &$criteria, boolean $usePlaceholders = true, array &$placeholderValues = [] ) : string | Get the WHERE or HAVING portion of the statement as a string. | |
getDeleteStatement ( boolean $usePlaceholders = true ) : string | Get the full DELETE statement. | |
getInsertStatement ( boolean $usePlaceholders = true ) : string | Get the full INSERT statement. | |
getJoinCriteriaUsingPreviousTable ( integer $joinIndex, string $table, string $column ) : string | Get an ON criteria string joining the specified table and column to the same column of the previous JOIN or FROM table. | |
getReplaceStatement ( boolean $usePlaceholders = true ) : string | Get the full REPLACE statement. | |
getSelectStatement ( boolean $usePlaceholders = true ) : string | Get the full SELECT statement. | |
getUpdateStatement ( boolean $usePlaceholders = true ) : string | Get the full UPDATE statement. | |
isDeleteTableFrom ( ) : boolean | Whether the FROM table is the single table to delete from. | |
isJoinUnique ( string $table, string $alias ) : boolean | Whether the join table and alias is unique (hasn't already been joined). | |
openCriteria ( array &$criteria, string $connector = self::LOGICAL_AND ) : Miner | Add an open bracket for nesting conditions to the specified WHERE or HAVING criteria. | |
orCriteria ( array &$criteria, string $column, mixed $value, string $operator = self::EQUALS, boolean | null $quote = null ) : Miner | Add an OR condition to the specified WHERE or HAVING criteria. |
public __construct ( PDO $PdoConnection = null, boolean $autoQuote = true ) : Miner | ||
$PdoConnection | PDO | optional PDO database connection |
$autoQuote | boolean | optional auto-escape values, default true |
return | Miner |
public __toString ( ) : string | ||
return | string | full SQL statement |
public andHaving ( string $column, mixed $value, string $operator = self::EQUALS, boolean | null $quote = null ) : Miner | ||
$column | string | colum name |
$value | mixed | value |
$operator | string | optional comparison operator, default = |
$quote | boolean | null | optional auto-escape value, default to global |
return | Miner |
public andWhere ( string $column, mixed $value, string $operator = self::EQUALS, boolean | null $quote = null ) : Miner | ||
$column | string | colum name |
$value | mixed | value |
$operator | string | optional comparison operator, default = |
$quote | boolean | null | optional auto-escape value, default to global |
return | Miner |
public calcFoundRows ( ) : Miner | ||
return | Miner |
public closeHaving ( ) : Miner | ||
return | Miner |
public closeWhere ( ) : Miner | ||
return | Miner |
public execute ( ) : PDOStatement | false | ||
return | PDOStatement | false | executed statement or false if failed |
public getDeleteString ( boolean $includeText = true ) : string | ||
$includeText | boolean | optional include 'DELETE' text, default true |
return | string | DELETE portion of the statement |
public getFromAlias ( ) : string | ||
return | string | FROM table alias |
public getFromString ( boolean $includeText = true ) : string | ||
$includeText | boolean | optional include 'FROM' text, default true |
return | string | FROM portion of the statement |
public getGroupByString ( boolean $includeText = true ) : string | ||
$includeText | boolean | optional include 'GROUP BY' text, default true |
return | string | GROUP BY portion of the statement |
public getHavingPlaceholderValues ( ) : array | ||
return | array | HAVING placeholder values |
public getInsertString ( boolean $includeText = true ) : string | ||
$includeText | boolean | optional include 'INSERT' text, default true |
return | string | INSERT portion of the statement |
public getJoinString ( ) : string | ||
return | string | JOIN portion of the statement |
public getLimitOffset ( ) : integer | string | ||
return | integer | string | LIMIT row number to start at |
public getLimitString ( boolean $includeText = true ) : string | ||
$includeText | boolean | optional include 'LIMIT' text, default true |
return | string | LIMIT portion of the statement |
public getOptionsString ( boolean $includeTrailingSpace = false ) : string | ||
$includeTrailingSpace | boolean | optional include space after options |
return | string | execution options portion of the statement |
public getOrderByString ( boolean $includeText = true ) : string | ||
$includeText | boolean | optional include 'ORDER BY' text, default true |
return | string | ORDER BY portion of the statement |
public getPdoConnection ( ) : PDO | null | ||
return | PDO | null |
public getPlaceholderValues ( ) : array | ||
return | array | all placeholder values |
public getReplace ( ) : string | ||
return | string | REPLACE table |
public getReplaceString ( boolean $includeText = true ) : string | ||
$includeText | boolean | optional include 'REPLACE' text, default true |
return | string | REPLACE portion of the statement |
public getSelectString ( boolean $includeText = true ) : string | ||
$includeText | boolean | optional include 'SELECT' text, default true |
return | string | SELECT portion of the statement |
public getSetPlaceholderValues ( ) : array | ||
return | array | SET placeholder values |
public getStatement ( boolean $usePlaceholders = true ) : string | ||
$usePlaceholders | boolean | optional use ? placeholders, default true |
return | string | full SQL statement |
public getUpdateString ( boolean $includeText = true ) : string | ||
$includeText | boolean | optional include 'UPDATE' text, default true |
return | string | UPDATE portion of the statement |
public getWherePlaceholderValues ( ) : array | ||
return | array | WHERE placeholder values |
public having ( string $column, mixed $value, string $operator = self::EQUALS, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | ||
$column | string | colum name |
$value | mixed | value |
$operator | string | optional comparison operator, default = |
$connector | string | optional logical connector, default AND |
$quote | boolean | null | optional auto-escape value, default to global |
return | Miner |
public havingBetween ( string $column, mixed $min, mixed $max, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | ||
$column | string | column name |
$min | mixed | minimum value |
$max | mixed | maximum value |
$connector | string | optional logical connector, default AND |
$quote | boolean | null | optional auto-escape value, default to global |
return | Miner |
public havingIn ( string $column, array $values, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | ||
$column | string | column name |
$values | array | values |
$connector | string | optional logical connector, default AND |
$quote | boolean | null | optional auto-escape value, default to global |
return | Miner |
public havingNotBetween ( string $column, mixed $min, mixed $max, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | ||
$column | string | column name |
$min | mixed | minimum value |
$max | mixed | maximum value |
$connector | string | optional logical connector, default AND |
$quote | boolean | null | optional auto-escape value, default to global |
return | Miner |
public havingNotIn ( string $column, array $values, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | ||
$column | string | column name |
$values | array | values |
$connector | string | optional logical connector, default AND |
$quote | boolean | null | optional auto-escape value, default to global |
return | Miner |
public mergeDeleteInto ( Miner $Miner ) : Miner | ||
$Miner | Miner | to merge into |
return | Miner |
public mergeFromInto ( Miner $Miner ) : Miner | ||
$Miner | Miner | to merge into |
return | Miner |
public mergeGroupByInto ( Miner $Miner ) : Miner | ||
$Miner | Miner | to merge into |
return | Miner |
public mergeHavingInto ( Miner $Miner ) : Miner | ||
$Miner | Miner | to merge into |
return | Miner |
public mergeInsertInto ( Miner $Miner ) : Miner | ||
$Miner | Miner | to merge into |
return | Miner |
public mergeJoinInto ( Miner $Miner ) : Miner | ||
$Miner | Miner | to merge into |
return | Miner |
public mergeLimitInto ( Miner $Miner ) : Miner | ||
$Miner | Miner | to merge into |
return | Miner |
public mergeOptionsInto ( Miner $Miner ) : Miner | ||
$Miner | Miner | to merge into |
return | Miner |
public mergeOrderByInto ( Miner $Miner ) : Miner | ||
$Miner | Miner | to merge into |
return | Miner |
public mergeReplaceInto ( Miner $Miner ) : Miner | ||
$Miner | Miner | to merge into |
return | Miner |
public mergeSelectInto ( Miner $Miner ) : Miner | ||
$Miner | Miner | to merge into |
return | Miner |
public mergeSetInto ( Miner $Miner ) : Miner | ||
$Miner | Miner | to merge into |
return | Miner |
public mergeUpdateInto ( Miner $Miner ) : Miner | ||
$Miner | Miner | to merge into |
return | Miner |
public mergeWhereInto ( Miner $Miner ) : Miner | ||
$Miner | Miner | to merge into |
return | Miner |
public openHaving ( string $connector = self::LOGICAL_AND ) : Miner | ||
$connector | string | optional logical connector, default AND |
return | Miner |
public orHaving ( string $column, mixed $value, string $operator = self::EQUALS, boolean | null $quote = null ) : Miner | ||
$column | string | colum name |
$value | mixed | value |
$operator | string | optional comparison operator, default = |
$quote | boolean | null | optional auto-escape value, default to global |
return | Miner |
public orWhere ( string $column, mixed $value, string $operator = self::EQUALS, boolean | null $quote = null ) : Miner | ||
$column | string | colum name |
$value | mixed | value |
$operator | string | optional comparison operator, default = |
$quote | boolean | null | optional auto-escape value, default to global |
return | Miner |
public set ( string | array $column, mixed | null $value = null, boolean | null $quote = null ) : Miner | ||
$column | string | array | column name or array of columns => values |
$value | mixed | null | optional value for single column |
$quote | boolean | null | optional auto-escape value, default to global |
return | Miner |
public setAutoQuote ( boolean | null $autoQuote ) : Miner | ||
$autoQuote | boolean | null | whether to automatically escape values |
return | Miner |
public setPdoConnection ( PDO $PdoConnection = null ) : Miner | ||
$PdoConnection | PDO | optional PDO database connection |
return | Miner |
public where ( string $column, mixed $value, string $operator = self::EQUALS, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | ||
$column | string | column name |
$value | mixed | value |
$operator | string | optional comparison operator, default = |
$connector | string | optional logical connector, default AND |
$quote | boolean | null | optional auto-escape value, default to global |
return | Miner |
public whereBetween ( string $column, mixed $min, mixed $max, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | ||
$column | string | column name |
$min | mixed | minimum value |
$max | mixed | maximum value |
$connector | string | optional logical connector, default AND |
$quote | boolean | null | optional auto-escape value, default to global |
return | Miner |
public whereIn ( string $column, array $values, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | ||
$column | string | column name |
$values | array | values |
$connector | string | optional logical connector, default AND |
$quote | boolean | null | optional auto-escape value, default to global |
return | Miner |
public whereNotBetween ( string $column, mixed $min, mixed $max, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | ||
$column | string | column name |
$min | mixed | minimum value |
$max | mixed | maximum value |
$connector | string | optional logical connector, default AND |
$quote | boolean | null | optional auto-escape value, default to global |
return | Miner |
public whereNotIn ( string $column, array $values, string $connector = self::LOGICAL_AND, boolean | null $quote = null ) : Miner | ||
$column | string | column name |
$values | array | values |
$connector | string | optional logical connector, default AND |
$quote | boolean | null | optional auto-escape value, default to global |
return | Miner |