Flupdo  v1.2
Public Member Functions | Protected Member Functions | Static Protected Attributes | List of all members
DeleteBuilder Class Reference

Flupdo Builder for DELETE statement. More...

Inheritance diagram for DeleteBuilder:
Inheritance graph

Public Member Functions

 headerComment ($sql_statement,...)
 Replaces content of buffer -- HEADER with $sql_statement. More...
 
 delete ($sql_statement,...)
 Appends $sql_statement to buffer DELETE. More...
 
 from ($sql_statement,...)
 Appends $sql_statement to buffer FROM. More...
 
 using ($sql_statement,...)
 Appends $sql_statement to buffer USING. 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...
 
 straightJoin ($sql_statement,...)
 Appends $sql_statement prefixed with STRAIGHT_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...
 
 lowPriority ()
 Sets content of buffer PRIORITY to LOW_PRIORITY. More...
 
 quick ()
 Sets content of buffer QUICK to QUICK. More...
 
 ignore ()
 Sets content of buffer IGNORE to IGNORE. More...
 
 where ($sql_statement,...)
 Appends $sql_statement to buffer WHERE. More...
 
 orderBy ($sql_statement,...)
 Appends $sql_statement to buffer ORDER BY. More...
 
 limit ($sql_statement,...)
 Replaces content of buffer LIMIT with $sql_statement. 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.
 
 __call ($method, $args)
 Call buffer-specific method to process arguments. More...
 
 quoteIdent ($ident)
 Quote identifier, preserve dot.
 
 compile ()
 Call compile function in a safe way.
 
 uncompile ()
 "Uncompile" the query. More...
 
 debugDump ()
 Fluently dump query to error log.
 
 getSqlQuery ()
 Get compiled SQL query, use only for debugging.
 
 getSqlParams ()
 Get parameters for compiled SQL query, use only for debugging.
 
 quote ($value)
 Quotes a string for use in a query. More...
 
 rawSql ($sql)
 Returns object marking raw SQL statement.
 
 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().
 
 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.
 

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.
 
 replace ($args, $buffer_id)
 Replace buffer content with SQL fragment.
 
 setFlag ($args, $buffer_id, $label)
 Set flag. More...
 
 addJoin ($args, $buffer_id, $label)
 Add join statement to buffer.
 
 compileQuery ()
 Process all buffers and build SQL query. More...
 
 explain ()
 Explain the query and dump result to log.
 
 sqlStart ()
 Start SQL generating. More...
 
 sqlFinish ()
 Finish SQL generating. More...
 
 sqlBuffer ($buf)
 Add SQL with parameters. More...
 
 sqlRawBuffer ($buf)
 Generate raw SQL fragment.
 
 sqlComment ($buffer_id)
 Generate SQL comment.
 
 sqlFlag ($buffer_id)
 Generate flag fragment.
 
 sqlStatementFlags ($buffer_id, $flag_buffer_ids, $decorations)
 Generate SQL fragment made of flags.
 
 sqlList ($buffer_id, $decorations)
 Generate SQL fragment made of list.
 
 sqlValuesList ($buffer_id)
 Generate SQL fragment made of list values. More...
 
 sqlJoins ($buffer_id)
 Generate SQL fragment made of joins.
 
 sqlConditions ($buffer_id)
 Generate SQL fragment made of conditions in AND statement.
 

Static Protected Attributes

static $methods
 Magic methods mapped to SQL fragments.
 
- 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.
 
- Public Attributes inherited from FlupdoBuilder
 $pdo
 PDO driver used to execute query and escape strings.
 
const INDENT = 0x01
 List items should be indented.
 
const LABEL = 0x02
 SQL fragment has a label.
 
const BRACKETS = 0x04
 There are brackets around each item in the list.
 
const NO_SEPARATOR = 0x08
 No separator between list items.
 
const SUB_INDENT = 0x20
 Indent more the first line.
 
const COMMA = 0x40
 Add comma after the SQL fragment.
 
const EOL = 0x80
 Add EOL after the SQL fragment.
 
const ALL_DECORATIONS = 0xFF
 Make it fancy!
 
- Protected Attributes inherited from FlupdoBuilder
 $log_query
 Log all queries as they are executed.
 
 $log_explain
 Explain each query to log.
 
 $no_parenthesis_in_conditions
 Sphinx does not like parenthesis in WHERE.
 
 $can_explain = false
 Is it possible to explain this query?
 
 $indent = "\t"
 Indentation string.
 
 $sub_indent = "\t::t"
 Second level indentation string.
 
 $query_sql = null
 Built query.
 
 $query_params = null
 Parameters for prepared statement (to be bound before query is executed).
 
 $buffers = array()
 Buffers containing SQL fragments.
 

Detailed Description

Flupdo Builder for DELETE statement.

http://dev.mysql.com/doc/refman/5.5/en/delete.html

DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name
 [WHERE where_condition]
 [ORDER BY ...]
 [LIMIT row_count]

– OR –

DELETE [LOW_PRIORITY] [QUICK] [IGNORE]
 tbl_name[.*] [, tbl_name[.*]] ...
 FROM table_references
 [WHERE where_condition]

– OR –

DELETE [LOW_PRIORITY] [QUICK] [IGNORE]
 FROM tbl_name[.*] [, tbl_name[.*]] ...
 USING table_references
 [WHERE where_condition]

Member Function Documentation

compileQuery ( )
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();

Here is the call graph for this function:

headerComment (   $sql_statement,
  ... 
)

Replaces content of buffer -- HEADER with $sql_statement.

Parameters
$sql_statementSQL statement (a fragment of SQL query) with placeholders.
...Values of placeholders (when positional placeholders are used).
Note
This method is generated from FlupdoBuilder::$methods array. See compileQuery() method for buffer usage.
delete (   $sql_statement,
  ... 
)

Appends $sql_statement to buffer DELETE.

Parameters
$sql_statementSQL statement (a fragment of SQL query) with placeholders.
...Values of placeholders (when positional placeholders are used).
Note
This method is generated from FlupdoBuilder::$methods array. See compileQuery() method for buffer usage.
from (   $sql_statement,
  ... 
)

Appends $sql_statement to buffer FROM.

Parameters
$sql_statementSQL statement (a fragment of SQL query) with placeholders.
...Values of placeholders (when positional placeholders are used).
Note
This method is generated from FlupdoBuilder::$methods array. See compileQuery() method for buffer usage.
using (   $sql_statement,
  ... 
)

Appends $sql_statement to buffer USING.

Parameters
$sql_statementSQL statement (a fragment of SQL query) with placeholders.
...Values of placeholders (when positional placeholders are used).
Note
This method is generated from FlupdoBuilder::$methods array. See compileQuery() method for buffer usage.
join (   $sql_statement,
  ... 
)

Appends $sql_statement prefixed with JOIN to buffer JOIN.

Parameters
$sql_statementSQL statement (a fragment of SQL query) with placeholders.
...Values of placeholders (when positional placeholders are used).
Note
This method is generated from FlupdoBuilder::$methods array. See compileQuery() method for buffer usage.
innerJoin (   $sql_statement,
  ... 
)

Appends $sql_statement prefixed with INNER JOIN to buffer JOIN.

Parameters
$sql_statementSQL statement (a fragment of SQL query) with placeholders.
...Values of placeholders (when positional placeholders are used).
Note
This method is generated from FlupdoBuilder::$methods array. See compileQuery() method for buffer usage.
crossJoin (   $sql_statement,
  ... 
)

Appends $sql_statement prefixed with CROSS JOIN to buffer JOIN.

Parameters
$sql_statementSQL statement (a fragment of SQL query) with placeholders.
...Values of placeholders (when positional placeholders are used).
Note
This method is generated from FlupdoBuilder::$methods array. See compileQuery() method for buffer usage.
straightJoin (   $sql_statement,
  ... 
)

Appends $sql_statement prefixed with STRAIGHT_JOIN to buffer JOIN.

Parameters
$sql_statementSQL statement (a fragment of SQL query) with placeholders.
...Values of placeholders (when positional placeholders are used).
Note
This method is generated from FlupdoBuilder::$methods array. See compileQuery() method for buffer usage.
leftJoin (   $sql_statement,
  ... 
)

Appends $sql_statement prefixed with LEFT JOIN to buffer JOIN.

Parameters
$sql_statementSQL statement (a fragment of SQL query) with placeholders.
...Values of placeholders (when positional placeholders are used).
Note
This method is generated from FlupdoBuilder::$methods array. See compileQuery() method for buffer usage.
rightJoin (   $sql_statement,
  ... 
)

Appends $sql_statement prefixed with RIGHT JOIN to buffer JOIN.

Parameters
$sql_statementSQL statement (a fragment of SQL query) with placeholders.
...Values of placeholders (when positional placeholders are used).
Note
This method is generated from FlupdoBuilder::$methods array. See compileQuery() method for buffer usage.
leftOuterJoin (   $sql_statement,
  ... 
)

Appends $sql_statement prefixed with LEFT OUTER JOIN to buffer JOIN.

Parameters
$sql_statementSQL statement (a fragment of SQL query) with placeholders.
...Values of placeholders (when positional placeholders are used).
Note
This method is generated from FlupdoBuilder::$methods array. See compileQuery() method for buffer usage.
rightOuterJoin (   $sql_statement,
  ... 
)

Appends $sql_statement prefixed with RIGHT OUTER JOIN to buffer JOIN.

Parameters
$sql_statementSQL statement (a fragment of SQL query) with placeholders.
...Values of placeholders (when positional placeholders are used).
Note
This method is generated from FlupdoBuilder::$methods array. See compileQuery() method for buffer usage.
naturalLeftJoin (   $sql_statement,
  ... 
)

Appends $sql_statement prefixed with NATURAL LEFT JOIN to buffer JOIN.

Parameters
$sql_statementSQL statement (a fragment of SQL query) with placeholders.
...Values of placeholders (when positional placeholders are used).
Note
This method is generated from FlupdoBuilder::$methods array. See compileQuery() method for buffer usage.
naturalRightJoin (   $sql_statement,
  ... 
)

Appends $sql_statement prefixed with NATURAL RIGHT JOIN to buffer JOIN.

Parameters
$sql_statementSQL statement (a fragment of SQL query) with placeholders.
...Values of placeholders (when positional placeholders are used).
Note
This method is generated from FlupdoBuilder::$methods array. See compileQuery() method for buffer usage.
naturalLeftOuterJoin (   $sql_statement,
  ... 
)

Appends $sql_statement prefixed with NATURAL LEFT OUTER JOIN to buffer JOIN.

Parameters
$sql_statementSQL statement (a fragment of SQL query) with placeholders.
...Values of placeholders (when positional placeholders are used).
Note
This method is generated from FlupdoBuilder::$methods array. See compileQuery() method for buffer usage.
naturalRightOuterJoin (   $sql_statement,
  ... 
)

Appends $sql_statement prefixed with NATURAL RIGHT OUTER JOIN to buffer JOIN.

Parameters
$sql_statementSQL statement (a fragment of SQL query) with placeholders.
...Values of placeholders (when positional placeholders are used).
Note
This method is generated from FlupdoBuilder::$methods array. See compileQuery() method for buffer usage.
lowPriority ( )

Sets content of buffer PRIORITY to LOW_PRIORITY.

Note
This method is generated from FlupdoBuilder::$methods array. See compileQuery() method for buffer usage.
quick ( )

Sets content of buffer QUICK to QUICK.

Note
This method is generated from FlupdoBuilder::$methods array. See compileQuery() method for buffer usage.
ignore ( )

Sets content of buffer IGNORE to IGNORE.

Note
This method is generated from FlupdoBuilder::$methods array. See compileQuery() method for buffer usage.
where (   $sql_statement,
  ... 
)

Appends $sql_statement to buffer WHERE.

Parameters
$sql_statementSQL statement (a fragment of SQL query) with placeholders.
...Values of placeholders (when positional placeholders are used).
Note
This method is generated from FlupdoBuilder::$methods array. See compileQuery() method for buffer usage.
orderBy (   $sql_statement,
  ... 
)

Appends $sql_statement to buffer ORDER BY.

Parameters
$sql_statementSQL statement (a fragment of SQL query) with placeholders.
...Values of placeholders (when positional placeholders are used).
Note
This method is generated from FlupdoBuilder::$methods array. See compileQuery() method for buffer usage.
limit (   $sql_statement,
  ... 
)

Replaces content of buffer LIMIT with $sql_statement.

Parameters
$sql_statementSQL statement (a fragment of SQL query) with placeholders.
...Values of placeholders (when positional placeholders are used).
Note
This method is generated from FlupdoBuilder::$methods array. See compileQuery() method for buffer usage.
footerComment (   $sql_statement,
  ... 
)

Replaces content of buffer -- FOOTER with $sql_statement.

Parameters
$sql_statementSQL statement (a fragment of SQL query) with placeholders.
...Values of placeholders (when positional placeholders are used).
Note
This method is generated from FlupdoBuilder::$methods array. See compileQuery() method for buffer usage.