2015-01-12 05:33:41 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
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,
|
|
|
|
'brand' => NULL,
|
2015-10-06 01:39:01 +02:00
|
|
|
];
|
2015-01-12 05:33:41 +01:00
|
|
|
|
|
|
|
$fluent = $conn->insert('table', $arr)
|
|
|
|
->setFlag('IGNORE')->setFlag('DELAYED');
|
|
|
|
|
|
|
|
Assert::same(
|
|
|
|
reformat('INSERT IGNORE DELAYED INTO [table] ([title], [price], [brand]) VALUES (\'Super Product\', 12, NULL)'),
|
|
|
|
(string) $fluent
|
|
|
|
);
|
|
|
|
|
|
|
|
$fluent->setFlag('IGNORE', FALSE);
|
|
|
|
|
|
|
|
Assert::same(
|
|
|
|
reformat('INSERT DELAYED INTO [table] ([title], [price], [brand]) VALUES (\'Super Product\', 12, NULL)'),
|
|
|
|
(string) $fluent
|
|
|
|
);
|
|
|
|
|
|
|
|
$fluent->setFlag('HIGH_priority');
|
|
|
|
|
|
|
|
Assert::same(
|
|
|
|
reformat('INSERT DELAYED HIGH_PRIORITY INTO [table] ([title], [price], [brand]) VALUES (\'Super Product\', 12, NULL)'),
|
|
|
|
(string) $fluent
|
|
|
|
);
|
|
|
|
|
|
|
|
$fluent->into('anotherTable');
|
|
|
|
|
|
|
|
Assert::same(
|
|
|
|
reformat('INSERT DELAYED HIGH_PRIORITY INTO [anotherTable] VALUES (\'Super Product\', 12, NULL)'),
|
|
|
|
(string) $fluent
|
|
|
|
);
|
|
|
|
|
|
|
|
$fluent->values('%l', $arr);
|
|
|
|
|
|
|
|
Assert::same(
|
|
|
|
reformat('INSERT DELAYED HIGH_PRIORITY INTO [anotherTable] VALUES (\'Super Product\', 12, NULL) , (\'Super Product\', 12, NULL)'),
|
|
|
|
(string) $fluent
|
|
|
|
);
|
|
|
|
|
|
|
|
$fluent->values($arr);
|
|
|
|
|
|
|
|
Assert::same(
|
|
|
|
reformat('INSERT DELAYED HIGH_PRIORITY INTO [anotherTable] VALUES (\'Super Product\', 12, NULL) , (\'Super Product\', 12, NULL) , (\'Super Product\', 12, NULL)'),
|
|
|
|
(string) $fluent
|
|
|
|
);
|