summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/it_dbi.t15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/it_dbi.t b/test/it_dbi.t
index 42fae74..7b1c9d7 100755
--- a/test/it_dbi.t
+++ b/test/it_dbi.t
@@ -33,6 +33,13 @@ $dbi->query("create temporary table it_dbi_test (
$opts['subclass']::createclass(['table' => "it_dbi_test", 'forcecreate' => true]);
$record = new it_dbi_test;
+$GLOBALS['it_defaultconfig']['fatal_throws_exception'] = true;
+
+try {
+ is(@$record->select("SYNTAX ERROR"), "Exception", "Syntax triggers exception for fatal_throws_exception mode");
+} catch (Exception $e) {
+ is(it::match('syntax', $e->getMessage()), 'syntax', "Syntax error triggers error");
+}
$record->insert(['x' => 42, 'foo' => null]);
$record->insert(['foo' => "bar"]);
@@ -44,6 +51,12 @@ is(
"auto_increment"
);
+try {
+ @$record->insert(['ID' => 3]);
+} catch (Exception $e) {
+ is($e->getMessage(), false, "Silently ignore duplicate inserts with default safety");
+}
+
$record->read(1);
is(
[$record->_key, $record->x, $record->foo],
@@ -58,7 +71,7 @@ is(
);
is(
- $record->select(['foo <>' => ""], "LIMIT 1"),
+ @$record->select(['foo <>' => ""], "LIMIT 1"),
1,
"select with multiple parameters (LIMIT part)"
);