Skip to content

Latest commit

 

History

History
85 lines (67 loc) · 1.67 KB

update.md

File metadata and controls

85 lines (67 loc) · 1.67 KB

What the Framework?! SQL

Update

Use the static update method to create an UPDATE statement builder.

use WTFramework\SQL\SQL;

$stmt = SQL::update();

Table

Use the table method to set the table name.

$stmt->table('t1');
$stmt->table(['t1', 't2']);


As table names are not automatically escaped you may use an alias.

$stmt->table('t1 AS t2');


If an array of table names is passed then any string key will be used as the alias.

$stmt->table(['t2' => 't1']);


A Table service class can also be passed, providing a fluent interface for generating table names.

$stmt->table(SQL::table('t1'));

Join

See Select documentation.

Set

See Insert documentation.

From

See Select documentation.

Where

See Select documentation.

Order by

See Select documentation.

Limit

See Select documentation.

Offset

See Select documentation.

Top

See Select documentation.

Returning

See Insert documentation.

Miscellaneous methods

$stmt->lowPriority();
$stmt->ignore();
$stmt->forPortionOf($period, $from, $to);
$stmt->whereCurrentOf($cursor);
$stmt->orReplace();
$stmt->orFail();
$stmt->orIgnore();
$stmt->orRollBack();

CTEs

See Select documentation.

If ... else ...

See Select documentation.

Explain

See Select documentation.

Set statement

See Select documentation.

When

See Select documentation.