本文整理汇总了PHP中DboSource::lastAffected方法的典型用法代码示例。如果您正苦于以下问题:PHP DboSource::lastAffected方法的具体用法?PHP DboSource::lastAffected怎么用?PHP DboSource::lastAffected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DboSource
的用法示例。
在下文中一共展示了DboSource::lastAffected方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testLastAffected
/**
* testLastAffected method
*
*
* @return void
*/
public function testLastAffected()
{
$this->Dbo->cacheSources = false;
$tableName = 'tinyint_' . uniqid();
$this->Dbo->rawQuery('CREATE TABLE ' . $this->Dbo->fullTableName($tableName) . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id));');
$this->model = new CakeTestModel(array('name' => 'Tinyint', 'table' => $tableName, 'ds' => 'test'));
$this->assertTrue((bool) $this->model->save(array('bool' => 5, 'small_int' => 5)));
$this->assertEquals(1, $this->model->find('count'));
$this->model->deleteAll(true);
$result = $this->Dbo->lastAffected();
$this->assertEquals(1, $result);
$this->assertEquals(0, $this->model->find('count'));
$this->Dbo->rawQuery('DROP TABLE ' . $this->Dbo->fullTableName($tableName));
}
示例2: lastAffected
/**
* Returns number of affected rows in previous database operation. If no previous operation exists,
* this returns false.
*
* @param mixed $source
* @return integer Number of affected rows
*/
public function lastAffected($source = null)
{
$affected = parent::lastAffected();
if ($affected === null && $this->_lastAffected !== false) {
return $this->_lastAffected;
}
return $affected;
}
示例3: lastAffected
/**
* Returns number of affected rows in previous database operation. If no previous operation exists,
* this returns false.
*
* @param mixed $source Unused
*
* @return int Number of affected rows
*/
public function lastAffected($source = NULL)
{
$affected = parent::lastAffected();
if ($affected === NULL && $this->_lastAffected !== FALSE) {
return $this->_lastAffected;
}
return $affected;
}