Showing 1 changed files with 12 additions and 13 deletions
+12 -13
t/sqlite.t
... ...
@@ -65,8 +65,6 @@ my $binary;
65 65
 # Prepare table
66 66
 $dbi = DBIx::Custom->connect;
67 67
 
68
-=pod
69
-
70 68
 test 'insert';
71 69
 eval { $dbi->execute('drop table table1') };
72 70
 $dbi->execute($create_table1);
... ...
@@ -101,10 +99,11 @@ eval{$dbi->insert(table => 'table', param => {';' => 1})};
101 99
 like($@, qr/safety/);
102 100
 
103 101
 $dbi->quote('"');
104
-$dbi->execute('create table "table" ("select")');
102
+eval { $dbi->execute("drop table ${q}table$p") };
103
+$dbi->execute("create table ${q}table$p (${q}select$p)");
105 104
 $dbi->apply_filter('table', select => {out => sub { $_[0] * 2}});
106 105
 $dbi->insert(table => 'table', param => {select => 1});
107
-$result = $dbi->execute('select * from "table"');
106
+$result = $dbi->execute("select * from ${q}table$p");
108 107
 $rows   = $result->all;
109 108
 is_deeply($rows, [{select => 2}], "reserved word");
110 109
 
... ...
@@ -132,8 +131,6 @@ $result = $dbi->execute('select * from table1;');
132 131
 $rows   = $result->all;
133 132
 is_deeply($rows, [{key1 => 1, key2 => 2}, {key1 => 3, key2 => 4}], "basic");
134 133
 
135
-=cut
136
-
137 134
 test 'update';
138 135
 eval { $dbi->execute('drop table table1') };
139 136
 $dbi->execute($create_table1_2);
... ...
@@ -225,12 +222,13 @@ like($@, qr/safety/);
225 222
 
226 223
 eval { $dbi->execute('drop table table1') };
227 224
 $dbi->quote('"');
228
-$dbi->execute('create table "table" ("select", "update")');
225
+eval { $dbi->execute("drop table ${q}table$p") };
226
+$dbi->execute("create table ${q}table$p (${q}select$p, ${q}update$p)");
229 227
 $dbi->apply_filter('table', select => {out => sub { $_[0] * 2}});
230 228
 $dbi->apply_filter('table', update => {out => sub { $_[0] * 3}});
231 229
 $dbi->insert(table => 'table', param => {select => 1});
232 230
 $dbi->update(table => 'table', where => {select => 1}, param => {update => 2});
233
-$result = $dbi->execute('select * from "table"');
231
+$result = $dbi->execute("select * from ${q}table$p");
234 232
 $rows   = $result->all;
235 233
 is_deeply($rows, [{select => 2, update => 6}], "reserved word");
236 234
 
... ...
@@ -239,12 +237,12 @@ like($@, qr/safety/);
239 237
 
240 238
 eval { $dbi->execute("drop table ${q}table$p") };
241 239
 $dbi->reserved_word_quote('"');
242
-$dbi->execute('create table "table" ("select", "update")');
240
+$dbi->execute("create table ${q}table$p (${q}select$p, ${q}update$p)");
243 241
 $dbi->apply_filter('table', select => {out => sub { $_[0] * 2}});
244 242
 $dbi->apply_filter('table', update => {out => sub { $_[0] * 3}});
245 243
 $dbi->insert(table => 'table', param => {select => 1});
246 244
 $dbi->update(table => 'table', where => {'table.select' => 1}, param => {update => 2});
247
-$result = $dbi->execute('select * from "table"');
245
+$result = $dbi->execute("select * from ${q}table$p");
248 246
 $rows   = $result->all;
249 247
 is_deeply($rows, [{select => 2, update => 6}], "reserved word");
250 248
 
... ...
@@ -369,11 +367,12 @@ like($@, qr/safety/);
369 367
 
370 368
 $dbi = DBIx::Custom->connect;
371 369
 $dbi->quote('"');
372
-$dbi->execute('create table "table" ("select", "update")');
370
+eval { $dbi->execute("drop table ${q}table$p") };
371
+$dbi->execute("create table ${q}table$p (${q}select$p, ${q}update$p)");
373 372
 $dbi->apply_filter('table', select => {out => sub { $_[0] * 2}});
374 373
 $dbi->insert(table => 'table', param => {select => 1});
375 374
 $dbi->delete(table => 'table', where => {select => 1});
376
-$result = $dbi->execute('select * from "table"');
375
+$result = $dbi->execute("select * from ${q}table$p");
377 376
 $rows   = $result->all;
378 377
 is_deeply($rows, [], "reserved word");
379 378
 
... ...
@@ -436,7 +435,7 @@ like($@, qr/noexist/, "invalid");
436 435
 
437 436
 $dbi = DBIx::Custom->connect;
438 437
 $dbi->quote('"');
439
-$dbi->execute('create table "table" ("select", "update")');
438
+$dbi->execute("create table ${q}table$p (${q}select$p, ${q}update$p)");
440 439
 $dbi->apply_filter('table', select => {out => sub { $_[0] * 2}});
441 440
 $dbi->insert(table => 'table', param => {select => 1, update => 2});
442 441
 $result = $dbi->select(table => 'table', where => {select => 1});