mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
Merge commit '2890e6659ecb6f315c82253e6985ece0e6dc489d' into 2.0
This commit is contained in:
commit
d8194a5818
2 changed files with 27 additions and 1 deletions
|
@ -440,7 +440,9 @@ class DboSource extends DataSource {
|
||||||
}
|
}
|
||||||
if (!$query->columnCount()) {
|
if (!$query->columnCount()) {
|
||||||
$query->closeCursor();
|
$query->closeCursor();
|
||||||
return true;
|
if (!$query->rowCount()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $query;
|
return $query;
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
|
|
|
@ -223,6 +223,30 @@ class MysqlTest extends CakeTestCase {
|
||||||
$this->assertIdentical($result['Tinyint']['small_int'], '0');
|
$this->assertIdentical($result['Tinyint']['small_int'], '0');
|
||||||
$this->model->deleteAll(true);
|
$this->model->deleteAll(true);
|
||||||
|
|
||||||
|
$this->Dbo->rawQuery('DROP TABLE ' . $this->Dbo->fullTableName($tableName));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 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->assertEqual(1, $this->model->find('count'));
|
||||||
|
$this->model->deleteAll(true);
|
||||||
|
$result = $this->Dbo->lastAffected();
|
||||||
|
$this->assertEqual(1, $result);
|
||||||
|
$this->assertEqual(0, $this->model->find('count'));
|
||||||
|
|
||||||
$this->Dbo->rawQuery('DROP TABLE ' . $this->Dbo->fullTableName($tableName));
|
$this->Dbo->rawQuery('DROP TABLE ' . $this->Dbo->fullTableName($tableName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue