コード例 #1
0
 /**
  * Test if affected rows returns the correct value.
  */
 public function testAffectedRows()
 {
     $this->assertEquals(1, $this->connection->executeFirstCell('SELECT COUNT(`id`) AS "row_count" FROM `writers` WHERE `name` = ?', 'Leo Tolstoy'));
     $this->connection->execute('UPDATE `writers` SET `name` = ? WHERE `name` = ?', 'Lev Nikolayevich Tolstoy', 'Leo Tolstoy');
     $this->assertEquals(1, $this->connection->affectedRows());
     $this->connection->execute('UPDATE `writers` SET `name` = ? WHERE `name` = ?', 'Nothing to Update', 'Leo Tolstoy');
     $this->assertEquals(0, $this->connection->affectedRows());
 }