Skip to content

Commit 142e421

Browse files
committed
confirms bug report #153, there is an issue with prepare statement usage, turning off no issues
In reference to #153
1 parent eec9134 commit 142e421

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

tests/mysqli/mysqliTest.php

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,53 @@ public function testSelecting()
410410
foreach ($result as $row) {
411411
$this->assertEquals('testing 1', $row->test_key);
412412
}
413-
}
413+
}
414+
415+
/**
416+
* @covers ezsql\ezQuery::create
417+
* @covers ezsql\ezQuery::insert
418+
* @covers ezsql\ezQuery::selecting
419+
* @covers ezsql\ezQuery::drop
420+
*/
421+
public function testSelectingAndCreateTable()
422+
{
423+
$this->object->prepareOff();
424+
$this->object->create('users',
425+
column('id', INTR, 11, PRIMARY),
426+
column('tel_num', INTR, 32, notNULL),
427+
column('user_name ', VARCHAR, 128),
428+
column('email', CHAR, 50)
429+
);
430+
431+
$this->object->insert('users', ['id'=> 1,
432+
'tel_num' => 123456,
433+
'email' => '[email protected]',
434+
'user_name ' => 'walker']
435+
);
436+
437+
$this->object->insert('users', ['id'=> 2,
438+
'tel_num' => 654321,
439+
'email' => '[email protected]',
440+
'user_name ' => 'email']
441+
);
442+
443+
$this->object->insert('users', ['id'=> 3,
444+
'tel_num' => 456123,
445+
'email' => '[email protected]',
446+
'user_name ' => 'host']
447+
);
448+
449+
$result = $this->object->selecting('users', 'id, tel_num, email', eq('user_name ', 'walker'));
450+
451+
foreach ($result as $row) {
452+
$this->assertEquals(1, $row->id);
453+
$this->assertEquals(123456, $row->tel_num);
454+
$this->assertEquals('[email protected]', $row->email);
455+
}
456+
457+
$this->object->drop('users');
458+
$this->object->prepareOn();
459+
}
414460

415461
/**
416462
* @covers ezsql\ezQuery::create_select

0 commit comments

Comments
 (0)