sqleval() can now be used with %s, %i, and all that good stuff
there is probably no good reason to do this, as things like md5() can be done from PHP, but people keep asking for it, so here it is :)
This commit is contained in:
@@ -135,16 +135,17 @@ class BasicTest extends SimpleTest {
|
||||
function test_4_1_query() {
|
||||
DB::insert('accounts', array(
|
||||
'username' => 'newguy',
|
||||
'password' => DB::sqleval("REPEAT('blah', 3)"),
|
||||
'age' => 172,
|
||||
'password' => DB::sqleval("REPEAT('blah', %i)", '3'),
|
||||
'age' => DB::sqleval('171+1'),
|
||||
'height' => 111.15
|
||||
));
|
||||
|
||||
$row = DB::queryOneRow("SELECT * FROM accounts WHERE password=%s", 'blahblahblah');
|
||||
$this->assert($row['username'] === 'newguy');
|
||||
$this->assert($row['age'] === '172');
|
||||
|
||||
DB::update('accounts', array(
|
||||
'password' => DB::sqleval("REPEAT('blah', 4)"),
|
||||
'password' => DB::sqleval("REPEAT('blah', %i)", 4),
|
||||
), 'username=%s', 'newguy');
|
||||
|
||||
$row = null;
|
||||
|
||||
Reference in New Issue
Block a user