2015-01-12 05:33:41 +01:00
|
|
|
<?php
|
2017-06-09 22:20:47 +02:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2015-01-12 05:33:41 +01:00
|
|
|
use Tester\Assert;
|
|
|
|
|
|
|
|
require __DIR__ . '/bootstrap.php';
|
|
|
|
|
|
|
|
|
2015-10-08 02:13:22 +02:00
|
|
|
$conn = new Dibi\Connection($config);
|
2015-01-12 05:33:41 +01:00
|
|
|
|
|
|
|
|
2015-10-06 01:39:01 +02:00
|
|
|
$arr = [
|
2015-06-19 03:11:36 +02:00
|
|
|
'title' => 'Super Product',
|
|
|
|
'price' => 12,
|
2017-07-11 12:28:13 +02:00
|
|
|
'brand' => null,
|
2015-10-06 01:39:01 +02:00
|
|
|
];
|
2015-01-12 05:33:41 +01:00
|
|
|
|
|
|
|
$fluent = $conn->update('table', $arr)
|
|
|
|
->setFlag('IGNORE')->setFlag('DELAYED');
|
|
|
|
|
|
|
|
Assert::same(
|
|
|
|
reformat('UPDATE IGNORE DELAYED [table] SET [title]=\'Super Product\', [price]=12, [brand]=NULL'),
|
|
|
|
(string) $fluent
|
|
|
|
);
|
|
|
|
|
2015-10-06 01:39:01 +02:00
|
|
|
$fluent->set(['another' => 123]);
|
2015-01-12 05:33:41 +01:00
|
|
|
|
|
|
|
Assert::same(
|
|
|
|
reformat('UPDATE IGNORE DELAYED [table] SET [title]=\'Super Product\', [price]=12, [brand]=NULL , [another]=123'),
|
|
|
|
(string) $fluent
|
|
|
|
);
|
2018-09-17 10:39:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
$arr = [
|
|
|
|
'table1.title' => 'Super Product',
|
|
|
|
'table2.price' => 12,
|
|
|
|
'table2.brand' => null,
|
|
|
|
];
|
|
|
|
$fluent = $conn->update(['table1', 'table2'], $arr);
|
|
|
|
Assert::same(
|
|
|
|
reformat('UPDATE [table1], [table2] SET [table1].[title]=\'Super Product\', [table2].[price]=12, [table2].[brand]=NULL'),
|
|
|
|
(string) $fluent
|
|
|
|
);
|