Query_Builder_Delete クラス
(extends Query_Builder_Where)
The Query_Builder_Delete class handles all the delete operations for the query building process. It extends the
Query_Builder_Where class, so all the methods are inherited.
table($table)
The table method sets/changes the table to delete from.
Static |
No |
パラメータ |
パラメータ |
型 |
規定値 |
説明 |
$table |
string |
必須 |
the table name |
|
返り値 |
Returns the current instance. |
例 |
// prepare an update statement
$query = DB::delete('users');
// Set the table to delete from
$query->table('admins');
// DELETE `admins` ...
|
compile(\Database_Connection$db)
The compile method returns the delete SQL query as a string.
Static |
No |
パラメータ |
パラメータ |
型 |
規定値 |
説明 |
$db |
object |
必須 |
A database connection |
|
返り値 |
Returns the SQL query as a string. |
例 |
// prepare an update statement
$query = DB::delete('users');
// Set a where statement
$query->where('looks', 'like', '%spammer%');
// Get the database connection
$connection = Database_Connection::instance();
// Get the sql query
$sql = $query->compile($connection);
// DELETE FROM `users` WHERE `looks` LIKE "%spammer%"
|
reset()
The reset method resets all values of the current instance.
Static |
No |
パラメータ |
None
|
返り値 |
Returns the current instance. |
例 |
// prepare an update statement
$query = DB:delete('users');
// Set a where statement
$query->where('it_look', 'ok to me');
// Reset it
$query->reset();
// Just an other where statement
$query->where('looks', 'like', '%bad mister%');
// Get the database connection
$connection = Database_Connection::instance();
// Get the sql query
$sql = $query->compile($connection);
// DELETE FROM `users` WHERE `looks` LIKE "%bad mister%"
|