Showing 1 changed files with 24 additions and 26 deletions
+24 -26
t/basic.t
... ...
@@ -2048,32 +2048,30 @@ is_deeply($rows, [{key1 => 1, key2 => 11, key3 => 3, key4 => 4, key5 => 5},
2048 2048
 
2049 2049
 
2050 2050
 test 'insert_param';
2051
-$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2052
-$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
2053
-$param = {key1 => 1, key2 => 2};
2054
-$insert_param = $dbi->insert_param($param);
2055
-$sql = <<"EOS";
2056
-insert into table1 $insert_param
2057
-EOS
2058
-$dbi->execute($sql, param => $param, table => 'table1');
2059
-is($dbi->select(table => 'table1')->one->{key1}, 1);
2060
-is($dbi->select(table => 'table1')->one->{key2}, 2);
2061
-
2062
-$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2063
-$dbi->quote('"');
2064
-$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
2065
-$param = {key1 => 1, key2 => 2};
2066
-$insert_param = $dbi->insert_param($param);
2067
-$sql = <<"EOS";
2068
-insert into table1 $insert_param
2069
-EOS
2070
-$dbi->execute($sql, param => $param, table => 'table1');
2071
-is($dbi->select(table => 'table1')->one->{key1}, 1);
2072
-is($dbi->select(table => 'table1')->one->{key2}, 2);
2073
-
2074
-eval { $dbi->insert_param({";" => 1}) };
2075
-like($@, qr/not safety/);
2076
-
2051
+{
2052
+    $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2053
+    $dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
2054
+    $param = {key1 => 1, key2 => 2};
2055
+    my $insert_param = $dbi->insert_param($param);
2056
+    $sql = "insert into table1 $insert_param";
2057
+    $dbi->execute($sql, param => $param, table => 'table1');
2058
+    is($dbi->select(table => 'table1')->one->{key1}, 1);
2059
+    is($dbi->select(table => 'table1')->one->{key2}, 2);
2060
+}
2061
+{
2062
+    $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2063
+    $dbi->quote('"');
2064
+    $dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
2065
+    $param = {key1 => 1, key2 => 2};
2066
+    my $insert_param = $dbi->insert_param($param);
2067
+    $sql = "insert into table1 $insert_param";
2068
+    $dbi->execute($sql, param => $param, table => 'table1');
2069
+    is($dbi->select(table => 'table1')->one->{key1}, 1);
2070
+    is($dbi->select(table => 'table1')->one->{key2}, 2);
2071
+
2072
+    eval { $dbi->insert_param({";" => 1}) };
2073
+    like($@, qr/not safety/);
2074
+}
2077 2075
 
2078 2076
 test 'join';
2079 2077
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');