Query builder delete tests

This commit is contained in:
Timothy Warren 2012-03-13 13:38:47 -04:00
parent 57fa7a5177
commit f83e93541c
4 changed files with 21 additions and 4 deletions

View File

@ -508,7 +508,10 @@ class Query_Builder {
public function delete($table, $where='')
{
// Set the where clause
$this->where($where);
if ( ! empty($where))
{
$this->where($where);
}
// Create the SQL and parameters
$sql = $this->_compile("delete", $table);
@ -618,7 +621,7 @@ class Query_Builder {
break;
}
//echo $sql.'<br />';
echo $sql.'<br />';
return $sql;
}

View File

@ -32,7 +32,7 @@ class FirebirdQBTest extends UnitTestCase {
$params->pass = 'masterkey';
$this->qb = new Query_Builder($params);
//echo '<hr /> Firebird Queries <br />';
echo '<hr /> Firebird Queries <hr />';
}
function TestQBGet()
@ -126,4 +126,11 @@ class FirebirdQBTest extends UnitTestCase {
$this->assertTrue($query);
}
function TestDelete()
{
$query = $this->qb->where('id', 4)->delete('create_test');
$this->assertTrue($query);
}
}

View File

@ -28,7 +28,7 @@
$params->host = 'localhost';
$this->qb = new Query_Builder($params);
//echo '<hr /> SQLite Queries <br />';
echo '<hr /> SQLite Queries <hr />';
}
function TestGet()
@ -120,4 +120,11 @@
$this->assertIsA($query, 'PDOStatement');
}
function TestDelete()
{
$query = $this->qb->where('id', 4)->delete('create_test');
$this->assertIsA($query, 'PDOStatement');
}
}

Binary file not shown.