named parameters for queries

This commit is contained in:
Sergey Tsalkov
2012-07-22 17:29:59 -07:00
parent 2d49f4f350
commit 7582961ee1
2 changed files with 31 additions and 3 deletions

View File

@@ -150,6 +150,13 @@ class BasicTest extends SimpleTest {
$this->assert($row['password'] === 'blahblahblahblah');
$this->assert($row['favorite_word'] === null);
$row = DB::query("SELECT * FROM accounts WHERE password=%s_mypass AND username=%s_myuser",
array('myuser' => 'newguy', 'mypass' => 'blahblahblahblah')
);
$this->assert(count($row) === 1);
$this->assert($row[0]['username'] === 'newguy');
$this->assert($row[0]['age'] === '172');
DB::query("DELETE FROM accounts WHERE password=%s", 'blahblahblahblah');
$this->assert(DB::affectedRows() === 1);
}