Fixing bug in DboMysql::value()

This commit is contained in:
José Lorenzo Rodríguez 2010-10-16 14:01:01 -04:30
parent 88a2fb5058
commit d83c95cf46
2 changed files with 3 additions and 4 deletions

View file

@ -231,7 +231,7 @@ class DboMysql extends DboSource {
return $parent;
}
if ($data === null || (is_array($data) && empty($data))) {
return $this->_connection->quote($data, PDO::PARAM_NULL);
return 'NULL';
}
if ($data === '' && $column !== 'integer' && $column !== 'float' && $column !== 'boolean') {
return $this->_connection->quote($data, PDO::PARAM_STR);

View file

@ -277,10 +277,9 @@ class DboMysqlTest extends CakeTestCase {
* @return void
*/
function testTinyintCasting() {
$this->skipIf(true, 'Is this a test over the DBO?');
$this->Dbo->cacheSources = false;
$tableName = 'tinyint_' . uniqid();
$this->Dbo->execute('CREATE TABLE ' . $this->Dbo->fullTableName($tableName) . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id));');
$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'
@ -308,7 +307,7 @@ class DboMysqlTest extends CakeTestCase {
$this->assertIdentical($result['Tinyint']['small_int'], '0');
$this->model->deleteAll(true);
$this->Dbo->query('DROP TABLE ' . $this->Dbo->fullTableName($tableName));
$this->Dbo->rawQuery('DROP TABLE ' . $this->Dbo->fullTableName($tableName));
}
/**