|
Flupdo
v1.3-5-ge5a1c59
|
Flupdo Builder for SELECT statement.
– http://dev.mysql.com/doc/refman/5.5/en/select.html
SELECT
[ALL | DISTINCT | DISTINCTROW ]
[HIGH_PRIORITY]
[STRAIGHT_JOIN]
[SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]
[SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]
select_expr [, select_expr ...]
[FROM table_references
[WHERE where_condition]
[GROUP BY {col_name | expr | position}
[ASC | DESC], ... [WITH ROLLUP]]
[HAVING where_condition]
[ORDER BY {col_name | expr | position}
[ASC | DESC], ...]
[LIMIT {[offset,] row_count | row_count OFFSET offset}]
[PROCEDURE procedure_name(argument_list)]
[INTO OUTFILE 'file_name'
[CHARACTER SET charset_name]
export_options
| INTO DUMPFILE 'file_name'
| INTO var_name [, var_name]]
[FOR UPDATE | LOCK IN SHARE MODE]] Public Member Functions | |
| headerComment ($sql_statement,...) | |
Replaces content of buffer -- HEADER with $sql_statement. More... | |
| select ($sql_statement,...) | |
Appends $sql_statement to buffer SELECT. More... | |
| selectFirst ($sql_statement,...) | |
Appends $sql_statement to buffer SELECT_FIRST. More... | |
| all () | |
Sets content of buffer DISTINCT to ALL. More... | |
| distinct () | |
Sets content of buffer DISTINCT to DISTINCT. More... | |
| distinctRow () | |
Sets content of buffer DISTINCT to DISTINCTROW. More... | |
| highPriority () | |
Sets content of buffer HIGH_PRIORITY to HIGH_PRIORITY. More... | |
| straightJoin ($sql_statement,...) | |
Appends $sql_statement prefixed with STRAIGHT_JOIN to buffer JOIN. More... | |
| sqlSmallResult () | |
Sets content of buffer SQL_SMALL_RESULT to SQL_SMALL_RESULT. More... | |
| sqlBigResult () | |
Sets content of buffer SQL_BIG_RESULT to SQL_BIG_RESULT. More... | |
| sqlBufferResult () | |
Sets content of buffer SQL_BUFFER_RESULT to SQL_BUFFER_RESULT. More... | |
| sqlCache () | |
Sets content of buffer SQL_CACHE to SQL_CACHE. More... | |
| sqlNoCache () | |
Sets content of buffer SQL_CACHE to SQL_NO_CACHE. More... | |
| sqlCalcFoundRows () | |
Sets content of buffer SQL_CALC_FOUND_ROWS to SQL_CALC_FOUND_ROWS. More... | |
| from ($sql_statement,...) | |
Appends $sql_statement to buffer FROM. More... | |
| join ($sql_statement,...) | |
Appends $sql_statement prefixed with JOIN to buffer JOIN. More... | |
| innerJoin ($sql_statement,...) | |
Appends $sql_statement prefixed with INNER JOIN to buffer JOIN. More... | |
| crossJoin ($sql_statement,...) | |
Appends $sql_statement prefixed with CROSS JOIN to buffer JOIN. More... | |
| leftJoin ($sql_statement,...) | |
Appends $sql_statement prefixed with LEFT JOIN to buffer JOIN. More... | |
| rightJoin ($sql_statement,...) | |
Appends $sql_statement prefixed with RIGHT JOIN to buffer JOIN. More... | |
| leftOuterJoin ($sql_statement,...) | |
Appends $sql_statement prefixed with LEFT OUTER JOIN to buffer JOIN. More... | |
| rightOuterJoin ($sql_statement,...) | |
Appends $sql_statement prefixed with RIGHT OUTER JOIN to buffer JOIN. More... | |
| naturalLeftJoin ($sql_statement,...) | |
Appends $sql_statement prefixed with NATURAL LEFT JOIN to buffer JOIN. More... | |
| naturalRightJoin ($sql_statement,...) | |
Appends $sql_statement prefixed with NATURAL RIGHT JOIN to buffer JOIN. More... | |
| naturalLeftOuterJoin ($sql_statement,...) | |
Appends $sql_statement prefixed with NATURAL LEFT OUTER JOIN to buffer JOIN. More... | |
| naturalRightOuterJoin ($sql_statement,...) | |
Appends $sql_statement prefixed with NATURAL RIGHT OUTER JOIN to buffer JOIN. More... | |
| where ($sql_statement,...) | |
Appends $sql_statement to buffer WHERE. More... | |
| groupBy ($sql_statement,...) | |
Appends $sql_statement to buffer GROUP BY. More... | |
| having ($sql_statement,...) | |
Appends $sql_statement to buffer HAVING. More... | |
| orderBy ($sql_statement,...) | |
Appends $sql_statement to buffer ORDER BY. More... | |
| limit ($sql_statement,...) | |
Replaces content of buffer LIMIT with $sql_statement. More... | |
| offset ($sql_statement,...) | |
Replaces content of buffer OFFSET with $sql_statement. More... | |
| procedure ($sql_statement,...) | |
Replaces content of buffer PROCEDURE with $sql_statement. More... | |
| into ($sql_statement,...) | |
Replaces content of buffer INTO with $sql_statement. More... | |
| forUpdate () | |
Sets content of buffer LOCK to FOR UPDATE. More... | |
| lockInShareMode () | |
Sets content of buffer LOCK to LOCK IN SHARE MODE. More... | |
| option ($sql_statement,...) | |
Appends $sql_statement to buffer OPTION. More... | |
| footerComment ($sql_statement,...) | |
Replaces content of buffer -- FOOTER with $sql_statement. More... | |
Public Member Functions inherited from FlupdoBuilder | |
| __construct ($pdo, $log_query=false, $log_explain=false, $no_parenthesis_in_conditions=false) | |
| Constructor. More... | |
| __call ($method, $args) | |
| Call buffer-specific method to process arguments. More... | |
| quoteIdent ($ident) | |
Quote identifier, preserve dot. More... | |
| compile () | |
| Call compile function in a safe way. More... | |
| uncompile () | |
| "Uncompile" the query. More... | |
| debugDump () | |
| Fluently dump query to error log. More... | |
| getSqlQuery () | |
| Get compiled SQL query, use only for debugging. More... | |
| getSqlParams () | |
| Get parameters for compiled SQL query, use only for debugging. More... | |
| quote ($value) | |
| Quotes a string for use in a query. More... | |
| rawSql ($sql) | |
| Returns object marking raw SQL statement. More... | |
| exec () | |
| Builds and executes an SQL statement, returning the number of affected rows. More... | |
| query () | |
| Builds, binds and executes an SQL statement, returning a result set as a PDOStatement object. More... | |
| prepare ($driver_options=array()) | |
| Builds and prepares a statement for execution, returns a statement object. More... | |
| lastInsertId () | |
| Proxy to PDO::lastInsertId(). More... | |
| fetchSingleRow () | |
| Fetch one row from result and close cursor. More... | |
| fetchSingleValue () | |
| Fetch one row from result and close cursor. More... | |
| fetchAll ($key_column=null) | |
| Fetch everything into array. More... | |
| __toString () | |
| Get SQL query as a string. More... | |
Protected Member Functions | |
| compileQuery () | |
| Process all buffers and build SQL query. More... | |
Protected Member Functions inherited from FlupdoBuilder | |
| add ($args, $buffer_id) | |
| Add SQL fragment to buffer. More... | |
| replace ($args, $buffer_id) | |
| Replace buffer content with SQL fragment. More... | |
| setFlag ($args, $buffer_id, $label) | |
| Set flag. More... | |
| addJoin ($args, $buffer_id, $label) | |
| Add join statement to buffer. More... | |
| compileQuery () | |
| Process all buffers and build SQL query. More... | |
| explain () | |
| Explain the query and dump result to log. More... | |
| sqlStart () | |
| Start SQL generating. More... | |
| sqlFinish () | |
| Finish SQL generating. More... | |
| sqlBuffer ($buf) | |
| Add SQL with parameters. More... | |
| sqlRawBuffer ($buf) | |
| Generate raw SQL fragment. More... | |
| sqlComment ($buffer_id) | |
| Generate SQL comment. More... | |
| sqlFlag ($buffer_id) | |
| Generate flag fragment. More... | |
| sqlStatementFlags ($buffer_id, $flag_buffer_ids, $decorations) | |
| Generate SQL fragment made of flags. More... | |
| sqlList ($buffer_id, $decorations) | |
| Generate SQL fragment made of list. More... | |
| sqlValuesList ($buffer_id) | |
| Generate SQL fragment made of list values. More... | |
| sqlJoins ($buffer_id) | |
| Generate SQL fragment made of joins. More... | |
| sqlConditions ($buffer_id) | |
| Generate SQL fragment made of conditions in AND statement. More... | |
Protected Attributes | |
| $can_explain = true | |
Protected Attributes inherited from FlupdoBuilder | |
| $log_query | |
| Log all queries as they are executed. More... | |
| $log_explain | |
| Explain each query to log. More... | |
| $no_parenthesis_in_conditions | |
| Sphinx does not like parenthesis in WHERE. More... | |
| $can_explain = false | |
| Is it possible to explain this query? More... | |
| $indent = "\t" | |
| Indentation string. More... | |
| $sub_indent = "\t::t" | |
| Second level indentation string. More... | |
| $query_sql = null | |
| Built query. More... | |
| $query_params = null | |
| Parameters for prepared statement (to be bound before query is executed). More... | |
| $buffers = array() | |
| Buffers containing SQL fragments. More... | |
Static Protected Attributes | |
| static | $methods |
Static Protected Attributes inherited from FlupdoBuilder | |
| static | $clauses = array() |
| List of clauses used to composed result query. More... | |
| static | $methods = array() |
| List of methods used to fill the $buffers. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from FlupdoBuilder | |
| static | generateDoxygenDocumentation () |
| Generate documentation for methods defined in $methods array. More... | |
Public Attributes inherited from FlupdoBuilder | |
| $pdo | |
| PDO driver used to execute query and escape strings. More... | |
| const | INDENT = 0x01 |
| List items should be indented. More... | |
| const | LABEL = 0x02 |
| SQL fragment has a label. More... | |
| const | BRACKETS = 0x04 |
| There are brackets around each item in the list. More... | |
| const | NO_SEPARATOR = 0x08 |
| No separator between list items. More... | |
| const | SUB_INDENT = 0x20 |
| Indent more the first line. More... | |
| const | COMMA = 0x40 |
| Add comma after the SQL fragment. More... | |
| const | EOL = 0x80 |
| Add EOL after the SQL fragment. More... | |
| const | ALL_DECORATIONS = 0xFF |
| Make it fancy! More... | |
|
protected |
Process all buffers and build SQL query.
Side product is array of parameters (stored in $this->args) to bind with query.
This function is called by FlupdoBuilder, do not call it directly.
Example:
$this->sqlStart(); // ... return $this->sqlFinish();
| headerComment | ( | $sql_statement, | |
| ... | |||
| ) |
Replaces content of buffer -- HEADER with $sql_statement.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| select | ( | $sql_statement, | |
| ... | |||
| ) |
Appends $sql_statement to buffer SELECT.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| selectFirst | ( | $sql_statement, | |
| ... | |||
| ) |
Appends $sql_statement to buffer SELECT_FIRST.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| all | ( | ) |
Sets content of buffer DISTINCT to ALL.
| distinct | ( | ) |
Sets content of buffer DISTINCT to DISTINCT.
| distinctRow | ( | ) |
Sets content of buffer DISTINCT to DISTINCTROW.
| highPriority | ( | ) |
Sets content of buffer HIGH_PRIORITY to HIGH_PRIORITY.
| straightJoin | ( | $sql_statement, | |
| ... | |||
| ) |
Appends $sql_statement prefixed with STRAIGHT_JOIN to buffer JOIN.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| sqlSmallResult | ( | ) |
Sets content of buffer SQL_SMALL_RESULT to SQL_SMALL_RESULT.
| sqlBigResult | ( | ) |
Sets content of buffer SQL_BIG_RESULT to SQL_BIG_RESULT.
| sqlBufferResult | ( | ) |
Sets content of buffer SQL_BUFFER_RESULT to SQL_BUFFER_RESULT.
| sqlCache | ( | ) |
Sets content of buffer SQL_CACHE to SQL_CACHE.
| sqlNoCache | ( | ) |
Sets content of buffer SQL_CACHE to SQL_NO_CACHE.
| sqlCalcFoundRows | ( | ) |
Sets content of buffer SQL_CALC_FOUND_ROWS to SQL_CALC_FOUND_ROWS.
| from | ( | $sql_statement, | |
| ... | |||
| ) |
Appends $sql_statement to buffer FROM.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| join | ( | $sql_statement, | |
| ... | |||
| ) |
Appends $sql_statement prefixed with JOIN to buffer JOIN.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| innerJoin | ( | $sql_statement, | |
| ... | |||
| ) |
Appends $sql_statement prefixed with INNER JOIN to buffer JOIN.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| crossJoin | ( | $sql_statement, | |
| ... | |||
| ) |
Appends $sql_statement prefixed with CROSS JOIN to buffer JOIN.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| leftJoin | ( | $sql_statement, | |
| ... | |||
| ) |
Appends $sql_statement prefixed with LEFT JOIN to buffer JOIN.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| rightJoin | ( | $sql_statement, | |
| ... | |||
| ) |
Appends $sql_statement prefixed with RIGHT JOIN to buffer JOIN.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| leftOuterJoin | ( | $sql_statement, | |
| ... | |||
| ) |
Appends $sql_statement prefixed with LEFT OUTER JOIN to buffer JOIN.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| rightOuterJoin | ( | $sql_statement, | |
| ... | |||
| ) |
Appends $sql_statement prefixed with RIGHT OUTER JOIN to buffer JOIN.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| naturalLeftJoin | ( | $sql_statement, | |
| ... | |||
| ) |
Appends $sql_statement prefixed with NATURAL LEFT JOIN to buffer JOIN.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| naturalRightJoin | ( | $sql_statement, | |
| ... | |||
| ) |
Appends $sql_statement prefixed with NATURAL RIGHT JOIN to buffer JOIN.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| naturalLeftOuterJoin | ( | $sql_statement, | |
| ... | |||
| ) |
Appends $sql_statement prefixed with NATURAL LEFT OUTER JOIN to buffer JOIN.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| naturalRightOuterJoin | ( | $sql_statement, | |
| ... | |||
| ) |
Appends $sql_statement prefixed with NATURAL RIGHT OUTER JOIN to buffer JOIN.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| where | ( | $sql_statement, | |
| ... | |||
| ) |
Appends $sql_statement to buffer WHERE.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| groupBy | ( | $sql_statement, | |
| ... | |||
| ) |
Appends $sql_statement to buffer GROUP BY.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| having | ( | $sql_statement, | |
| ... | |||
| ) |
Appends $sql_statement to buffer HAVING.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| orderBy | ( | $sql_statement, | |
| ... | |||
| ) |
Appends $sql_statement to buffer ORDER BY.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| limit | ( | $sql_statement, | |
| ... | |||
| ) |
Replaces content of buffer LIMIT with $sql_statement.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| offset | ( | $sql_statement, | |
| ... | |||
| ) |
Replaces content of buffer OFFSET with $sql_statement.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| procedure | ( | $sql_statement, | |
| ... | |||
| ) |
Replaces content of buffer PROCEDURE with $sql_statement.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| into | ( | $sql_statement, | |
| ... | |||
| ) |
Replaces content of buffer INTO with $sql_statement.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| forUpdate | ( | ) |
Sets content of buffer LOCK to FOR UPDATE.
| lockInShareMode | ( | ) |
Sets content of buffer LOCK to LOCK IN SHARE MODE.
| option | ( | $sql_statement, | |
| ... | |||
| ) |
Appends $sql_statement to buffer OPTION.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
| footerComment | ( | $sql_statement, | |
| ... | |||
| ) |
Replaces content of buffer -- FOOTER with $sql_statement.
| $sql_statement | SQL statement (a fragment of SQL query) with placeholders. |
| ... | Values of placeholders (when positional placeholders are used). |
|
protected |
|
staticprotected |
1.8.13