2016-02-29 15:54:52 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider? ../databases.ini sqlsrv
|
|
|
|
*/
|
|
|
|
|
2017-06-09 22:20:47 +02:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2016-02-29 15:54:52 +01:00
|
|
|
use Tester\Assert;
|
|
|
|
|
|
|
|
require __DIR__ . '/bootstrap.php';
|
|
|
|
|
|
|
|
$conn = new Dibi\Connection($config);
|
2017-07-11 12:29:13 +02:00
|
|
|
$conn->loadFile(__DIR__ . '/data/sqlsrv.insert.sql');
|
2016-02-29 15:54:52 +01:00
|
|
|
|
|
|
|
for ($i = 1; $i <= 5; $i++) {
|
|
|
|
$conn->query('INSERT INTO %n DEFAULT VALUES', 'aaa');
|
|
|
|
Assert::equal($i, $conn->getInsertId());
|
|
|
|
}
|
|
|
|
|
|
|
|
$conn->query('INSERT INTO %n DEFAULT VALUES', 'aab');
|
|
|
|
Assert::equal(1, $conn->getInsertId());
|
|
|
|
|
|
|
|
$conn->query(
|
|
|
|
'CREATE TRIGGER %n ON %n AFTER INSERT AS INSERT INTO %n DEFAULT VALUES',
|
|
|
|
'UpdAAB', 'aab', 'aaa'
|
|
|
|
);
|
|
|
|
|
|
|
|
$conn->query('INSERT INTO %n DEFAULT VALUES', 'aab');
|
|
|
|
Assert::equal(2, $conn->getInsertId());
|