本文整理匯總了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;
}