\PG\MSF\PoolsMiner

Class Miner

Summary

Methods
Properties
Constants
__construct()
calcFoundRows()
option()
distinct()
values()
set()
intoColumns()
intoValues()
innerJoin()
join()
leftJoin()
rightJoin()
andWhere()
orWhere()
whereIn()
whereNotIn()
whereBetween()
whereNotBetween()
andHaving()
orHaving()
havingIn()
havingNotIn()
havingBetween()
havingNotBetween()
insertInto()
insert()
replaceInto()
replace()
updateInto()
update()
__toString()
getStatement()
isSelect()
getSelectString()
getOptionsString()
getFromString()
getFrom()
getFromAlias()
getJoinString()
isUpdate()
getUpdate()
getWhereString()
getAutoQuote()
setAutoQuote()
autoQuote()
quote()
getPdoConnection()
setPdoConnection()
getGroupByString()
getHavingString()
getOrderByString()
getLimitString()
isInsert()
getInsertString()
getInsert()
getIntoString()
getSetString()
isReplace()
getReplaceString()
getReplace()
getUpdateString()
isDelete()
getDeleteString()
go()
mergeInto()
mergeSelectInto()
mergeOptionsInto()
select()
mergeFromInto()
from()
mergeJoinInto()
mergeWhereInto()
openWhere()
closeWhere()
where()
mergeGroupByInto()
groupBy()
mergeHavingInto()
openHaving()
closeHaving()
having()
mergeOrderByInto()
orderBy()
mergeLimitInto()
limit()
getLimit()
getLimitOffset()
mergeInsertInto()
mergeSetInto()
mergeReplaceInto()
mergeUpdateInto()
mergeDeleteInto()
delete()
clear()
pdoCommitTrans()
pdoBeginTrans()
pdoRollBackTrans()
pdoQuery()
pdoConnect()
getPlaceholderValues()
getSetPlaceholderValues()
getWherePlaceholderValues()
getHavingPlaceholderValues()
pdoInsertId()
$mysqlPool
INNER_JOIN
LEFT_JOIN
RIGHT_JOIN
LOGICAL_AND
LOGICAL_OR
EQUALS
NOT_EQUALS
LESS_THAN
LESS_THAN_OR_EQUAL
GREATER_THAN
GREATER_THAN_OR_EQUAL
IN
NOT_IN
LIKE
NOT_LIKE
ILIKE
REGEX
NOT_REGEX
BETWEEN
NOT_BETWEEN
IS
IS_NOT
ORDER_BY_ASC
ORDER_BY_DESC
BRACKET_OPEN
BRACKET_CLOSE
pdoExecute()
$activeConfig
N/A
isJoinUnique()
criteria()
orCriteria()
criteriaIn()
criteriaNotIn()
criteriaBetween()
criteriaNotBetween()
getSelectStatement()
getJoinCriteriaUsingPreviousTable()
getCriteriaString()
getInsertStatement()
getReplaceStatement()
getUpdateStatement()
getDeleteStatement()
isDeleteTableFrom()
openCriteria()
closeCriteria()
$PdoConnection
$autoQuote
$option
$select
$insert
$replace
$update
$delete
$set
$from
$join
$where
$groupBy
$having
$orderBy
$limit
$setPlaceholderValues
$wherePlaceholderValues
$havingPlaceholderValues
$isInto
$intoColums
$intoValues
N/A

Constants

INNER_JOIN

INNER_JOIN

INNER JOIN type.

LEFT_JOIN

LEFT_JOIN

LEFT JOIN type.

RIGHT_JOIN

RIGHT_JOIN

RIGHT JOIN type.

LOGICAL_AND

LOGICAL_AND

AND logical operator.

LOGICAL_OR

LOGICAL_OR

OR logical operator.

EQUALS

EQUALS

Equals comparison operator.

NOT_EQUALS

NOT_EQUALS

Not equals comparison operator.

LESS_THAN

LESS_THAN

Less than comparison operator.

LESS_THAN_OR_EQUAL

LESS_THAN_OR_EQUAL

Less than or equal to comparison operator.

GREATER_THAN

GREATER_THAN

Greater than comparison operator.

GREATER_THAN_OR_EQUAL

GREATER_THAN_OR_EQUAL

Greater than or equal to comparison operator.

IN

IN

IN comparison operator.

NOT_IN

NOT_IN

NOT IN comparison operator.

LIKE

LIKE

LIKE comparison operator.

NOT_LIKE

NOT_LIKE

NOT LIKE comparison operator.

ILIKE

ILIKE

ILIKE comparison operator.

REGEX

REGEX

REGEXP comparison operator.

NOT_REGEX

NOT_REGEX

NOT REGEXP comparison operator.

BETWEEN

BETWEEN

BETWEEN comparison operator.

NOT_BETWEEN

NOT_BETWEEN

NOT BETWEEN comparison operator.

IS

IS

IS comparison operator.

IS_NOT

IS_NOT

IS NOT comparison operator.

ORDER_BY_ASC

ORDER_BY_ASC

Ascending ORDER BY direction.

ORDER_BY_DESC

ORDER_BY_DESC

Descending ORDER BY direction.

BRACKET_OPEN

BRACKET_OPEN

Open bracket for grouping criteria.

BRACKET_CLOSE

BRACKET_CLOSE

Closing bracket for grouping criteria.

Properties

$activeConfig

$activeConfig : array

Type

array — MySQL连接池配置

$PdoConnection

$PdoConnection : \PDO|null

PDO database connection to use in executing the statement.

Type

\PDO|null

$autoQuote

$autoQuote : boolean|null

Whether to automatically escape values.

Type

boolean|null

$option

$option : array

Execution options like DISTINCT and SQL_CALC_FOUND_ROWS.

Type

array

$select

$select : array

Columns, tables, and expressions to SELECT from.

Type

array

$insert

$insert : string

Table to INSERT into.

Type

string

$replace

$replace : string

Table to REPLACE into.

Type

string

$update

$update : string

Table to UPDATE.

Type

string

$delete

$delete : array|true

Tables to DELETE from, or true if deleting from the FROM table.

Type

array|true

$set

$set : array

Column values to INSERT, UPDATE, or REPLACE.

Type

array

$from

$from : array

Table to select FROM.

Type

array

$join

$join : array

JOIN tables and ON criteria.

Type

array

$where

$where : array

WHERE criteria.

Type

array

$groupBy

$groupBy : array

Columns to GROUP BY.

Type

array

$having

$having : array

HAVING criteria.

Type

array

$orderBy

$orderBy : array

Columns to ORDER BY.

Type

array

$limit

$limit : array

Number of rows to return from offset.

Type

array

$setPlaceholderValues

$setPlaceholderValues : array

SET placeholder values.

Type

array

$wherePlaceholderValues

$wherePlaceholderValues : array

WHERE placeholder values.

Type

array

$havingPlaceholderValues

$havingPlaceholderValues : array

HAVING placeholder values.

Type

array

$isInto

$isInto : boolean

InTo

Type

boolean

$intoColums

$intoColums : array

into colums

Type

array

$intoValues

$intoValues : array

into values

Type

array

Methods

__construct()

__construct(  $mysqlPool = null) 

Miner constructor.

Parameters

$mysqlPool

calcFoundRows()

calcFoundRows() : \PG\MSF\Pools\Miner

Add SQL_CALC_FOUND_ROWS execution option.

Returns

\PG\MSF\Pools\Miner

option()

option(string  $option) : \PG\MSF\Pools\Miner

Add an execution option like DISTINCT or SQL_CALC_FOUND_ROWS.

Parameters

string $option

execution option to add

Returns

\PG\MSF\Pools\Miner

distinct()

distinct() : \PG\MSF\Pools\Miner

Add DISTINCT execution option.

Returns

\PG\MSF\Pools\Miner

values()

values(array  $values) : \PG\MSF\Pools\Miner

Add an array of columns => values to INSERT, UPDATE, or REPLACE.

Parameters

array $values

columns => values

Returns

\PG\MSF\Pools\Miner

set()

set(string|array  $column, mixed|null  $value = null, boolean|null  $quote = null) : \PG\MSF\Pools\Miner

Add one or more column values to INSERT, UPDATE, or REPLACE.

Parameters

string|array $column

column name or array of columns => values

mixed|null $value

optional value for single column

boolean|null $quote

optional auto-escape value, default to global

Returns

\PG\MSF\Pools\Miner

intoColumns()

intoColumns(array  $columns) : $this

配合into使用

Parameters

array $columns

Returns

$this

intoValues()

intoValues(array  $values) : $this

配合into使用

Parameters

array $values

Returns

$this

innerJoin()

innerJoin(string  $table, string|array  $criteria = null, string  $alias = null) : \PG\MSF\Pools\Miner

Add an INNER JOIN table with optional ON criteria.

Parameters

string $table

table name

string|array $criteria

optional ON criteria

string $alias

optional alias

Returns

\PG\MSF\Pools\Miner

join()

join(string  $table, string|array  $criteria = null, string  $type = self::INNER_JOIN, string  $alias = null) : \PG\MSF\Pools\Miner

Add a JOIN table with optional ON criteria.

Parameters

string $table

table name

string|array $criteria

optional ON criteria

string $type

optional type of join, default INNER JOIN

string $alias

optional alias

Returns

\PG\MSF\Pools\Miner

leftJoin()

leftJoin(string  $table, string|array  $criteria = null, string  $alias = null) : \PG\MSF\Pools\Miner

Add a LEFT JOIN table with optional ON criteria.

Parameters

string $table

table name

string|array $criteria

optional ON criteria

string $alias

optional alias

Returns

\PG\MSF\Pools\Miner

rightJoin()

rightJoin(string  $table, string|array  $criteria = null, string  $alias = null) : \PG\MSF\Pools\Miner

Add a RIGHT JOIN table with optional ON criteria.

Parameters

string $table

table name

string|array $criteria

optional ON criteria

string $alias

optional alias

Returns

\PG\MSF\Pools\Miner

andWhere()

andWhere(string  $column, mixed  $value, string  $operator = self::EQUALS, boolean|null  $quote = null) : \PG\MSF\Pools\Miner

Add an AND WHERE condition.

Parameters

string $column

colum name

mixed $value

value

string $operator

optional comparison operator, default =

boolean|null $quote

optional auto-escape value, default to global

Returns

\PG\MSF\Pools\Miner

orWhere()

orWhere(string  $column, mixed  $value, string  $operator = self::EQUALS, boolean|null  $quote = null) : \PG\MSF\Pools\Miner

Add an OR WHERE condition.

Parameters

string $column

colum name

mixed $value

value

string $operator

optional comparison operator, default =

boolean|null $quote

optional auto-escape value, default to global

Returns

\PG\MSF\Pools\Miner

whereIn()

whereIn(string  $column, array  $values, string  $connector = self::LOGICAL_AND, boolean|null  $quote = null) : \PG\MSF\Pools\Miner

Add an IN WHERE condition.

Parameters

string $column

column name

array $values

values

string $connector

optional logical connector, default AND

boolean|null $quote

optional auto-escape value, default to global

Returns

\PG\MSF\Pools\Miner

whereNotIn()

whereNotIn(string  $column, array  $values, string  $connector = self::LOGICAL_AND, boolean|null  $quote = null) : \PG\MSF\Pools\Miner

Add a NOT IN WHERE condition.

Parameters

string $column

column name

array $values

values

string $connector

optional logical connector, default AND

boolean|null $quote

optional auto-escape value, default to global

Returns

\PG\MSF\Pools\Miner

whereBetween()

whereBetween(string  $column, mixed  $min, mixed  $max, string  $connector = self::LOGICAL_AND, boolean|null  $quote = null) : \PG\MSF\Pools\Miner

Add a BETWEEN WHERE condition.

Parameters

string $column

column name

mixed $min

minimum value

mixed $max

maximum value

string $connector

optional logical connector, default AND

boolean|null $quote

optional auto-escape value, default to global

Returns

\PG\MSF\Pools\Miner

whereNotBetween()

whereNotBetween(string  $column, mixed  $min, mixed  $max, string  $connector = self::LOGICAL_AND, boolean|null  $quote = null) : \PG\MSF\Pools\Miner

Add a NOT BETWEEN WHERE condition.

Parameters

string $column

column name

mixed $min

minimum value

mixed $max

maximum value

string $connector

optional logical connector, default AND

boolean|null $quote

optional auto-escape value, default to global

Returns

\PG\MSF\Pools\Miner

andHaving()

andHaving(string  $column, mixed  $value, string  $operator = self::EQUALS, boolean|null  $quote = null) : \PG\MSF\Pools\Miner

Add an AND HAVING condition.

Parameters

string $column

colum name

mixed $value

value

string $operator

optional comparison operator, default =

boolean|null $quote

optional auto-escape value, default to global

Returns

\PG\MSF\Pools\Miner

orHaving()

orHaving(string  $column, mixed  $value, string  $operator = self::EQUALS, boolean|null  $quote = null) : \PG\MSF\Pools\Miner

Add an OR HAVING condition.

Parameters

string $column

colum name

mixed $value

value

string $operator

optional comparison operator, default =

boolean|null $quote

optional auto-escape value, default to global

Returns

\PG\MSF\Pools\Miner

havingIn()

havingIn(string  $column, array  $values, string  $connector = self::LOGICAL_AND, boolean|null  $quote = null) : \PG\MSF\Pools\Miner

Add an IN WHERE condition.

Parameters

string $column

column name

array $values

values

string $connector

optional logical connector, default AND

boolean|null $quote

optional auto-escape value, default to global

Returns

\PG\MSF\Pools\Miner

havingNotIn()

havingNotIn(string  $column, array  $values, string  $connector = self::LOGICAL_AND, boolean|null  $quote = null) : \PG\MSF\Pools\Miner

Add a NOT IN HAVING condition.

Parameters

string $column

column name

array $values

values

string $connector

optional logical connector, default AND

boolean|null $quote

optional auto-escape value, default to global

Returns

\PG\MSF\Pools\Miner

havingBetween()

havingBetween(string  $column, mixed  $min, mixed  $max, string  $connector = self::LOGICAL_AND, boolean|null  $quote = null) : \PG\MSF\Pools\Miner

Add a BETWEEN HAVING condition.

Parameters

string $column

column name

mixed $min

minimum value

mixed $max

maximum value

string $connector

optional logical connector, default AND

boolean|null $quote

optional auto-escape value, default to global

Returns

\PG\MSF\Pools\Miner

havingNotBetween()

havingNotBetween(string  $column, mixed  $min, mixed  $max, string  $connector = self::LOGICAL_AND, boolean|null  $quote = null) : \PG\MSF\Pools\Miner

Add a NOT BETWEEN HAVING condition.

Parameters

string $column

column name

mixed $min

minimum value

mixed $max

maximum value

string $connector

optional logical connector, default AND

boolean|null $quote

optional auto-escape value, default to global

Returns

\PG\MSF\Pools\Miner

insertInto()

insertInto(  $table) : \PG\MSF\Pools\Miner

ISet the INSERT INTO table.

Parameters

$table

Returns

\PG\MSF\Pools\Miner

insert()

insert(string  $table) : \PG\MSF\Pools\Miner

Set the INSERT table.

Parameters

string $table

INSERT table

Returns

\PG\MSF\Pools\Miner

replaceInto()

replaceInto(  $table) : \PG\MSF\Pools\Miner

ISet the REPLACE INTO table.

Parameters

$table

Returns

\PG\MSF\Pools\Miner

replace()

replace(string  $table) : \PG\MSF\Pools\Miner

Set the REPLACE table.

Parameters

string $table

REPLACE table

Returns

\PG\MSF\Pools\Miner

updateInto()

updateInto(  $table) : \PG\MSF\Pools\Miner

ISet the UPDATE INTO table.

Parameters

$table

Returns

\PG\MSF\Pools\Miner

update()

update(string  $table) : \PG\MSF\Pools\Miner

Set the UPDATE table.

Parameters

string $table

UPDATE table

Returns

\PG\MSF\Pools\Miner

__toString()

__toString() : string

Get the full SQL statement without value placeholders.

Returns

string —

full SQL statement

getStatement()

getStatement(boolean  $usePlaceholders = true) : string

Get the full SQL statement.

Parameters

boolean $usePlaceholders

optional use ? placeholders, default true

Returns

string —

full SQL statement

isSelect()

isSelect() : boolean

Whether this is a SELECT statement.

Returns

boolean —

whether this is a SELECT statement

getSelectString()

getSelectString(boolean  $includeText = true) : string

Get the SELECT portion of the statement as a string.

Parameters

boolean $includeText

optional include 'SELECT' text, default true

Returns

string —

SELECT portion of the statement

getOptionsString()

getOptionsString(boolean  $includeTrailingSpace = false) : string

Get the execution options portion of the statement as a string.

Parameters

boolean $includeTrailingSpace

optional include space after options

Returns

string —

execution options portion of the statement

getFromString()

getFromString(boolean  $includeText = true) : string

Get the FROM portion of the statement, including all JOINs, as a string.

Parameters

boolean $includeText

optional include 'FROM' text, default true

Returns

string —

FROM portion of the statement

getFrom()

getFrom() : string

Get the FROM table.

Returns

string —

FROM table

getFromAlias()

getFromAlias() : string

Get the FROM table alias.

Returns

string —

FROM table alias

getJoinString()

getJoinString() : string

Get the JOIN portion of the statement as a string.

Returns

string —

JOIN portion of the statement

isUpdate()

isUpdate() : boolean

Whether this is an UPDATE statement.

Returns

boolean —

whether this is an UPDATE statement

getUpdate()

getUpdate() : string

Get the UPDATE table.

Returns

string —

UPDATE table

getWhereString()

getWhereString(boolean  $usePlaceholders = true, boolean  $includeText = true) : string

Get the WHERE portion of the statement as a string.

Parameters

boolean $usePlaceholders

optional use ? placeholders, default true

boolean $includeText

optional include 'WHERE' text, default true

Returns

string —

WHERE portion of the statement

getAutoQuote()

getAutoQuote(boolean|null  $override = null) : boolean

Get whether values will be automatically escaped.

The $override parameter is for convenience in checking if a specific value should be quoted differently than the rest. 'null' defers to the global setting.

Parameters

boolean|null $override

value-specific override for convenience

Returns

boolean

setAutoQuote()

setAutoQuote(boolean|null  $autoQuote) : \PG\MSF\Pools\Miner

Set whether to automatically escape values.

Parameters

boolean|null $autoQuote

whether to automatically escape values

Returns

\PG\MSF\Pools\Miner

autoQuote()

autoQuote(mixed  $value, boolean|null  $override = null) : mixed|false

Safely escape a value if auto-quoting is enabled, or do nothing if disabled.

The $override parameter is for convenience in checking if a specific value should be quoted differently than the rest. 'null' defers to the global setting.

Parameters

mixed $value

value to escape (or not)

boolean|null $override

value-specific override for convenience

Returns

mixed|false —

value (escaped or original) or false if failed

quote()

quote(mixed  $value) : mixed|false

Safely escape a value for use in a statement.

Parameters

mixed $value

value to escape

Returns

mixed|false —

escaped value or false if failed

getPdoConnection()

getPdoConnection() : \PDO|null

Get the PDO database connection to use in executing this statement.

Returns

\PDO|null

setPdoConnection()

setPdoConnection(\PDO|null  $PdoConnection = null) : \PG\MSF\Pools\Miner

Set the PDO database connection to use in executing this statement.

Parameters

\PDO|null $PdoConnection

optional PDO database connection

Returns

\PG\MSF\Pools\Miner

getGroupByString()

getGroupByString(boolean  $includeText = true) : string

Get the GROUP BY portion of the statement as a string.

Parameters

boolean $includeText

optional include 'GROUP BY' text, default true

Returns

string —

GROUP BY portion of the statement

getHavingString()

getHavingString(boolean  $usePlaceholders = true, boolean  $includeText = true) : string

Get the HAVING portion of the statement as a string.

Parameters

boolean $usePlaceholders

optional use ? placeholders, default true

boolean $includeText

optional include 'HAVING' text, default true

Returns

string —

HAVING portion of the statement

getOrderByString()

getOrderByString(boolean  $includeText = true) : string

Get the ORDER BY portion of the statement as a string.

Parameters

boolean $includeText

optional include 'ORDER BY' text, default true

Returns

string —

ORDER BY portion of the statement

getLimitString()

getLimitString(boolean  $includeText = true) : string

Get the LIMIT portion of the statement as a string.

Parameters

boolean $includeText

optional include 'LIMIT' text, default true

Returns

string —

LIMIT portion of the statement

isInsert()

isInsert() : boolean

Whether this is an INSERT statement.

Returns

boolean —

whether this is an INSERT statement

getInsertString()

getInsertString(boolean  $includeText = true) : string

Get the INSERT portion of the statement as a string.

Parameters

boolean $includeText

optional include 'INSERT' text, default true

Returns

string —

INSERT portion of the statement

getInsert()

getInsert() : string

Get the INSERT table.

Returns

string —

INSERT table

getIntoString()

getIntoString(boolean  $usePlaceholders = true) : string

Get the INTO portion of the statement as a string.

Parameters

boolean $usePlaceholders

Returns

string

getSetString()

getSetString(boolean  $usePlaceholders = true, boolean  $includeText = true) : string

Get the SET portion of the statement as a string.

Parameters

boolean $usePlaceholders

optional use ? placeholders, default true

boolean $includeText

optional include 'SET' text, default true

Returns

string —

SET portion of the statement

isReplace()

isReplace() : boolean

Whether this is a REPLACE statement.

Returns

boolean —

whether this is a REPLACE statement

getReplaceString()

getReplaceString(boolean  $includeText = true) : string

Get the REPLACE portion of the statement as a string.

Parameters

boolean $includeText

optional include 'REPLACE' text, default true

Returns

string —

REPLACE portion of the statement

getReplace()

getReplace() : string

Get the REPLACE table.

Returns

string —

REPLACE table

getUpdateString()

getUpdateString(boolean  $includeText = true) : string

Get the UPDATE portion of the statement as a string.

Parameters

boolean $includeText

optional include 'UPDATE' text, default true

Returns

string —

UPDATE portion of the statement

isDelete()

isDelete() : boolean

Whether this is a DELETE statement.

Returns

boolean —

whether this is a DELETE statement

getDeleteString()

getDeleteString(boolean  $includeText = true) : string

Get the DELETE portion of the statement as a string.

Parameters

boolean $includeText

optional include 'DELETE' text, default true

Returns

string —

DELETE portion of the statement

go()

go(null  $bindId = null, null  $sql = null) : mixed|\PG\MSF\Coroutine\MySql

协程的方式

Parameters

null $bindId
null $sql

Returns

mixed|\PG\MSF\Coroutine\MySql

mergeInto()

mergeInto(\PG\MSF\Pools\Miner  $Miner, boolean  $overrideLimit = true) : \PG\MSF\Pools\Miner

Merge this Miner into the given Miner.

Parameters

\PG\MSF\Pools\Miner $Miner

to merge into

boolean $overrideLimit

optional override limit, default true

Returns

\PG\MSF\Pools\Miner

mergeSelectInto()

mergeSelectInto(\PG\MSF\Pools\Miner  $Miner) : \PG\MSF\Pools\Miner

Merge this Miner's SELECT into the given Miner.

Parameters

\PG\MSF\Pools\Miner $Miner

to merge into

Returns

\PG\MSF\Pools\Miner

mergeOptionsInto()

mergeOptionsInto(\PG\MSF\Pools\Miner  $Miner) : \PG\MSF\Pools\Miner

Merge this Miner's execution options into the given Miner.

Parameters

\PG\MSF\Pools\Miner $Miner

to merge into

Returns

\PG\MSF\Pools\Miner

select()

select(string  $column, string  $alias = null) : \PG\MSF\Pools\Miner

Add a SELECT column, table, or expression with optional alias.

Parameters

string $column

column name, table name, or expression

string $alias

optional alias

Returns

\PG\MSF\Pools\Miner

mergeFromInto()

mergeFromInto(\PG\MSF\Pools\Miner  $Miner) : \PG\MSF\Pools\Miner

Merge this Miner's FROM into the given Miner.

Parameters

\PG\MSF\Pools\Miner $Miner

to merge into

Returns

\PG\MSF\Pools\Miner

from()

from(string  $table, string  $alias = null) : \PG\MSF\Pools\Miner

Set the FROM table with optional alias.

Parameters

string $table

table name

string $alias

optional alias

Returns

\PG\MSF\Pools\Miner

mergeJoinInto()

mergeJoinInto(\PG\MSF\Pools\Miner  $Miner) : \PG\MSF\Pools\Miner

Merge this Miner's JOINs into the given Miner.

Parameters

\PG\MSF\Pools\Miner $Miner

to merge into

Returns

\PG\MSF\Pools\Miner

mergeWhereInto()

mergeWhereInto(\PG\MSF\Pools\Miner  $Miner) : \PG\MSF\Pools\Miner

Merge this Miner's WHERE into the given Miner.

Parameters

\PG\MSF\Pools\Miner $Miner

to merge into

Returns

\PG\MSF\Pools\Miner

openWhere()

openWhere(string  $connector = self::LOGICAL_AND) : \PG\MSF\Pools\Miner

Add an open bracket for nesting WHERE conditions.

Parameters

string $connector

optional logical connector, default AND

Returns

\PG\MSF\Pools\Miner

closeWhere()

closeWhere() : \PG\MSF\Pools\Miner

Add a closing bracket for nesting WHERE conditions.

Returns

\PG\MSF\Pools\Miner

where()

where(string  $column, mixed  $value, string  $operator = self::EQUALS, string  $connector = self::LOGICAL_AND, boolean|null  $quote = null) : \PG\MSF\Pools\Miner

Add a WHERE condition.

Parameters

string $column

column name

mixed $value

value

string $operator

optional comparison operator, default =

string $connector

optional logical connector, default AND

boolean|null $quote

optional auto-escape value, default to global

Returns

\PG\MSF\Pools\Miner

mergeGroupByInto()

mergeGroupByInto(\PG\MSF\Pools\Miner  $Miner) : \PG\MSF\Pools\Miner

Merge this Miner's GROUP BY into the given Miner.

Parameters

\PG\MSF\Pools\Miner $Miner

to merge into

Returns

\PG\MSF\Pools\Miner

groupBy()

groupBy(string  $column, string|null  $order = null) : \PG\MSF\Pools\Miner

Add a GROUP BY column.

Parameters

string $column

column name

string|null $order

optional order direction, default none

Returns

\PG\MSF\Pools\Miner

mergeHavingInto()

mergeHavingInto(\PG\MSF\Pools\Miner  $Miner) : \PG\MSF\Pools\Miner

Merge this Miner's HAVING into the given Miner.

Parameters

\PG\MSF\Pools\Miner $Miner

to merge into

Returns

\PG\MSF\Pools\Miner

openHaving()

openHaving(string  $connector = self::LOGICAL_AND) : \PG\MSF\Pools\Miner

Add an open bracket for nesting HAVING conditions.

Parameters

string $connector

optional logical connector, default AND

Returns

\PG\MSF\Pools\Miner

closeHaving()

closeHaving() : \PG\MSF\Pools\Miner

Add a closing bracket for nesting HAVING conditions.

Returns

\PG\MSF\Pools\Miner

having()

having(string  $column, mixed  $value, string  $operator = self::EQUALS, string  $connector = self::LOGICAL_AND, boolean|null  $quote = null) : \PG\MSF\Pools\Miner

Add a HAVING condition.

Parameters

string $column

colum name

mixed $value

value

string $operator

optional comparison operator, default =

string $connector

optional logical connector, default AND

boolean|null $quote

optional auto-escape value, default to global

Returns

\PG\MSF\Pools\Miner

mergeOrderByInto()

mergeOrderByInto(\PG\MSF\Pools\Miner  $Miner) : \PG\MSF\Pools\Miner

Merge this Miner's ORDER BY into the given Miner.

Parameters

\PG\MSF\Pools\Miner $Miner

to merge into

Returns

\PG\MSF\Pools\Miner

orderBy()

orderBy(string  $column, string  $order = self::ORDER_BY_ASC) : \PG\MSF\Pools\Miner

Add a column to ORDER BY.

Parameters

string $column

column name

string $order

optional order direction, default ASC

Returns

\PG\MSF\Pools\Miner

mergeLimitInto()

mergeLimitInto(\PG\MSF\Pools\Miner  $Miner) : \PG\MSF\Pools\Miner

Merge this Miner's LIMIT into the given Miner.

Parameters

\PG\MSF\Pools\Miner $Miner

to merge into

Returns

\PG\MSF\Pools\Miner

limit()

limit(integer|string  $limit, integer|string  $offset) : \PG\MSF\Pools\Miner

Set the LIMIT on number of rows to return with optional offset.

Parameters

integer|string $limit

number of rows to return

integer|string $offset

optional row number to start at, default 0

Returns

\PG\MSF\Pools\Miner

getLimit()

getLimit() : integer|string

Get the LIMIT on number of rows to return.

Returns

integer|string —

LIMIT on number of rows to return

getLimitOffset()

getLimitOffset() : integer|string

Get the LIMIT row number to start at.

Returns

integer|string —

LIMIT row number to start at

mergeInsertInto()

mergeInsertInto(\PG\MSF\Pools\Miner  $Miner) : \PG\MSF\Pools\Miner

Merge this Miner's INSERT into the given Miner.

Parameters

\PG\MSF\Pools\Miner $Miner

to merge into

Returns

\PG\MSF\Pools\Miner

mergeSetInto()

mergeSetInto(\PG\MSF\Pools\Miner  $Miner) : \PG\MSF\Pools\Miner

Merge this Miner's SET into the given Miner.

Parameters

\PG\MSF\Pools\Miner $Miner

to merge into

Returns

\PG\MSF\Pools\Miner

mergeReplaceInto()

mergeReplaceInto(\PG\MSF\Pools\Miner  $Miner) : \PG\MSF\Pools\Miner

Merge this Miner's REPLACE into the given Miner.

Parameters

\PG\MSF\Pools\Miner $Miner

to merge into

Returns

\PG\MSF\Pools\Miner

mergeUpdateInto()

mergeUpdateInto(\PG\MSF\Pools\Miner  $Miner) : \PG\MSF\Pools\Miner

Merge this Miner's UPDATE into the given Miner.

Parameters

\PG\MSF\Pools\Miner $Miner

to merge into

Returns

\PG\MSF\Pools\Miner

mergeDeleteInto()

mergeDeleteInto(\PG\MSF\Pools\Miner  $Miner) : \PG\MSF\Pools\Miner

Merge this Miner's DELETE into the given Miner.

Parameters

\PG\MSF\Pools\Miner $Miner

to merge into

Returns

\PG\MSF\Pools\Miner

delete()

delete(string|false  $table = false) : \PG\MSF\Pools\Miner

Add a table to DELETE from, or false if deleting from the FROM table.

Parameters

string|false $table

optional table name, default false

Returns

\PG\MSF\Pools\Miner

clear()

clear() 

清除Build Query相关变量数据

pdoCommitTrans()

pdoCommitTrans() 

提交事务

pdoBeginTrans()

pdoBeginTrans() 

开始事务

pdoRollBackTrans()

pdoRollBackTrans() 

事务回滚

pdoQuery()

pdoQuery(string  $sql = null, array  $palceholderValues = null, integer  $fetchmode = \PDO::FETCH_ASSOC) : array|boolean|integer|null|string

pdo Query

Parameters

string $sql
array $palceholderValues
integer $fetchmode

Returns

array|boolean|integer|null|string

pdoConnect()

pdoConnect(  $activeConfig) 

PDO连接

Parameters

$activeConfig

getPlaceholderValues()

getPlaceholderValues() : array

Get all placeholder values (SET, WHERE, and HAVING).

Returns

array —

all placeholder values

getSetPlaceholderValues()

getSetPlaceholderValues() : array

Get the SET placeholder values.

Returns

array —

SET placeholder values

getWherePlaceholderValues()

getWherePlaceholderValues() : array

Get the WHERE placeholder values.

Returns

array —

WHERE placeholder values

getHavingPlaceholderValues()

getHavingPlaceholderValues() : array

Get the HAVING placeholder values.

Returns

array —

HAVING placeholder values

pdoInsertId()

pdoInsertId() : string

返回 lastInsertId

Returns

string

pdoExecute()

pdoExecute(  $sql,   $palceholderValues) : \PDOStatement|false

Execute the statement using the PDO database connection.

Parameters

$sql

string

$palceholderValues

array

Returns

\PDOStatement|false —

executed statement or false if failed

isJoinUnique()

isJoinUnique(string  $table, string  $alias) : boolean

Whether the join table and alias is unique (hasn't already been joined).

Parameters

string $table

table name

string $alias

table alias

Returns

boolean —

whether the join table and alias is unique

criteria()

criteria(array  $criteria, string  $column, mixed  $value, string  $operator = self::EQUALS, string  $connector = self::LOGICAL_AND, boolean|null  $quote = null) : \PG\MSF\Pools\Miner

Add a condition to the specified WHERE or HAVING criteria.

Parameters

array $criteria

WHERE or HAVING criteria

string $column

column name

mixed $value

value

string $operator

optional comparison operator, default =

string $connector

optional logical connector, default AND

boolean|null $quote

optional auto-escape value, default to global

Returns

\PG\MSF\Pools\Miner

orCriteria()

orCriteria(array  $criteria, string  $column, mixed  $value, string  $operator = self::EQUALS, boolean|null  $quote = null) : \PG\MSF\Pools\Miner

Add an OR condition to the specified WHERE or HAVING criteria.

Parameters

array $criteria

WHERE or HAVING criteria

string $column

column name

mixed $value

value

string $operator

optional comparison operator, default =

boolean|null $quote

optional auto-escape value, default to global

Returns

\PG\MSF\Pools\Miner

criteriaIn()

criteriaIn(array  $criteria, string  $column, array  $values, string  $connector = self::LOGICAL_AND, boolean|null  $quote = null) : \PG\MSF\Pools\Miner

Add an IN condition to the specified WHERE or HAVING criteria.

Parameters

array $criteria

WHERE or HAVING criteria

string $column

column name

array $values

values

string $connector

optional logical connector, default AND

boolean|null $quote

optional auto-escape value, default to global

Returns

\PG\MSF\Pools\Miner

criteriaNotIn()

criteriaNotIn(array  $criteria, string  $column, array  $values, string  $connector = self::LOGICAL_AND, boolean|null  $quote = null) : \PG\MSF\Pools\Miner

Add a NOT IN condition to the specified WHERE or HAVING criteria.

Parameters

array $criteria

WHERE or HAVING criteria

string $column

column name

array $values

values

string $connector

optional logical connector, default AND

boolean|null $quote

optional auto-escape value, default to global

Returns

\PG\MSF\Pools\Miner

criteriaBetween()

criteriaBetween(array  $criteria, string  $column, mixed  $min, mixed  $max, string  $connector = self::LOGICAL_AND, boolean|null  $quote = null) : \PG\MSF\Pools\Miner

Add a BETWEEN condition to the specified WHERE or HAVING criteria.

Parameters

array $criteria

WHERE or HAVING criteria

string $column

column name

mixed $min

minimum value

mixed $max

maximum value

string $connector

optional logical connector, default AND

boolean|null $quote

optional auto-escape value, default to global

Returns

\PG\MSF\Pools\Miner

criteriaNotBetween()

criteriaNotBetween(array  $criteria, string  $column, mixed  $min, mixed  $max, string  $connector = self::LOGICAL_AND, boolean|null  $quote = null) : \PG\MSF\Pools\Miner

Add a NOT BETWEEN condition to the specified WHERE or HAVING criteria.

Parameters

array $criteria

WHERE or HAVING criteria

string $column

column name

mixed $min

minimum value

mixed $max

maximum value

string $connector

optional logical connector, default AND

boolean|null $quote

optional auto-escape value, default to global

Returns

\PG\MSF\Pools\Miner

getSelectStatement()

getSelectStatement(boolean  $usePlaceholders = true) : string

Get the full SELECT statement.

Parameters

boolean $usePlaceholders

optional use ? placeholders, default true

Returns

string —

full SELECT statement

getJoinCriteriaUsingPreviousTable()

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.

Parameters

integer $joinIndex

index of current join

string $table

current table name

string $column

current column name

Returns

string —

ON join criteria

getCriteriaString()

getCriteriaString(array  $criteria, boolean  $usePlaceholders = true, array  $placeholderValues = array()) : string

Get the WHERE or HAVING portion of the statement as a string.

Parameters

array $criteria

WHERE or HAVING criteria

boolean $usePlaceholders

optional use ? placeholders, default true

array $placeholderValues

optional placeholder values array

Returns

string —

WHERE or HAVING portion of the statement

getInsertStatement()

getInsertStatement(boolean  $usePlaceholders = true) : string

Get the full INSERT statement.

Parameters

boolean $usePlaceholders

optional use ? placeholders, default true

Returns

string —

full INSERT statement

getReplaceStatement()

getReplaceStatement(boolean  $usePlaceholders = true) : string

Get the full REPLACE statement.

Parameters

boolean $usePlaceholders

optional use ? placeholders, default true

Returns

string —

full REPLACE statement

getUpdateStatement()

getUpdateStatement(boolean  $usePlaceholders = true) : string

Get the full UPDATE statement.

Parameters

boolean $usePlaceholders

optional use ? placeholders, default true

Returns

string —

full UPDATE statement

getDeleteStatement()

getDeleteStatement(boolean  $usePlaceholders = true) : string

Get the full DELETE statement.

Parameters

boolean $usePlaceholders

optional use ? placeholders, default true

Returns

string —

full DELETE statement

isDeleteTableFrom()

isDeleteTableFrom() : boolean

Whether the FROM table is the single table to delete from.

Returns

boolean —

whether the delete table is FROM

openCriteria()

openCriteria(array  $criteria, string  $connector = self::LOGICAL_AND) : \PG\MSF\Pools\Miner

Add an open bracket for nesting conditions to the specified WHERE or HAVING criteria.

Parameters

array $criteria

WHERE or HAVING criteria

string $connector

optional logical connector, default AND

Returns

\PG\MSF\Pools\Miner

closeCriteria()

closeCriteria(array  $criteria) : \PG\MSF\Pools\Miner

Add a closing bracket for nesting conditions to the specified WHERE or HAVING criteria.

Parameters

array $criteria

WHERE or HAVING criteria

Returns

\PG\MSF\Pools\Miner