@@ -23,6 +23,11 @@ function test_1_create_table() {
23
23
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
24
24
`signature` VARCHAR( 255 ) NULL DEFAULT 'donewriting'
25
25
) ENGINE = InnoDB " );
26
+
27
+ DB ::query ("CREATE TABLE `fake%s_table` (
28
+ `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
29
+ `name` VARCHAR( 255 ) NULL DEFAULT 'blah'
30
+ ) ENGINE = InnoDB " );
26
31
27
32
$ mysqli = DB ::get ();
28
33
DB ::disconnect ();
@@ -162,12 +167,12 @@ function test_4_query() {
162
167
$ this ->assert ($ columnlist [5 ] === 'height ' );
163
168
164
169
$ tablelist = DB ::tableList ();
165
- $ this ->assert (count ($ tablelist ) === 2 );
170
+ $ this ->assert (count ($ tablelist ) === 3 );
166
171
$ this ->assert ($ tablelist [0 ] === 'accounts ' );
167
172
168
173
$ tablelist = null ;
169
174
$ tablelist = DB ::tableList (DB ::$ dbName );
170
- $ this ->assert (count ($ tablelist ) === 2 );
175
+ $ this ->assert (count ($ tablelist ) === 3 );
171
176
$ this ->assert ($ tablelist [0 ] === 'accounts ' );
172
177
}
173
178
@@ -186,7 +191,7 @@ function test_4_1_query() {
186
191
$ true = DB ::update ('accounts ' , array (
187
192
'password ' => DB ::sqleval ("REPEAT('blah', %i) " , 4 ),
188
193
'favorite_word ' => null ,
189
- ), 'username=%s ' , ' newguy ' );
194
+ ), 'username=%s_name ' , array ( ' name ' => ' newguy ') );
190
195
191
196
$ row = null ;
192
197
$ row = DB ::queryOneRow ("SELECT * FROM accounts WHERE username=%s " , 'newguy ' );
@@ -414,7 +419,16 @@ function test_901_updatewithspecialchar() {
414
419
DB ::update ('profile ' ,array ('signature ' => "%li " ),"id = %d " ,1 );
415
420
$ signature = DB ::queryFirstField ("SELECT signature FROM profile WHERE id=%i " , 1 );
416
421
$ this ->assert ($ signature === "%li " );
422
+ }
417
423
424
+ function test_902_faketable () {
425
+ DB ::insert ('fake%s_table ' , array ('name ' => 'karen ' ));
426
+ $ count = DB ::queryFirstField ("SELECT COUNT(*) FROM %b " , 'fake%s_table ' );
427
+ $ this ->assert ($ count === '1 ' );
428
+ DB ::update ('fake%s_table ' , array ('name ' => 'haren%s ' ), 'name=%s_name ' , array ('name ' => 'karen ' ));
429
+ DB ::delete ('fake%s_table ' , 'name=%s0 ' , 'haren%s ' );
430
+ $ count = DB ::queryFirstField ("SELECT COUNT(*) FROM %b " , 'fake%s_table ' );
431
+ $ this ->assert ($ count === '0 ' );
418
432
}
419
433
420
434
0 commit comments