Example #1
0
 /**
  * Seems like PHP's SQLite does not support Limited
  * Deletes and Updates. 
  *
  * See http://www.sqlite.org/compile.html#enable_update_delete_limit.
  */
 function testThrowsSyntaxErrorOnLimitedDelete()
 {
     $users = new Table("users");
     try {
         $this->pdo->exec($users->delete()->take(2)->toSql());
         $this->fail();
     } catch (\PDOException $e) {
         // Expect a Syntax Error
         $this->assertEquals(1, $e->errorInfo[1]);
     }
 }
Example #2
0
 function testDeleteAll()
 {
     $users = new Table("users");
     $rowsDeleted = $this->pdo->exec($users->delete()->toSql());
     $this->assertEquals(3, $rowsDeleted);
     $row = $this->pdo->query($users->project(Sirel::sql('COUNT(\'id\') AS count')))->fetch();
     $this->assertEquals(0, $row['count']);
 }