diff --git a/VERSION.txt b/VERSION.txt index ab16477a4..9e11c84c9 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -6,4 +6,4 @@ // +---------------------------------------------------------------------------------------------------+ // /////////////////////////////////////////////////////////////////////////////////////////////////////////// -0.10.8.2169 \ No newline at end of file +0.10.8.2171 \ No newline at end of file diff --git a/cake/libs/model/datasources/dbo_source.php b/cake/libs/model/datasources/dbo_source.php index e02e54a91..8618524c3 100644 --- a/cake/libs/model/datasources/dbo_source.php +++ b/cake/libs/model/datasources/dbo_source.php @@ -353,9 +353,11 @@ class DboSource extends DataSource $fieldInsert[] = $this->name($field); } + $count = 0; foreach ($values as $value) { - $valueInsert[] = $this->value($value); + $valueInsert[] = $this->value($value, $model->getColumnType($fields[$count])); + $count++; } if($this->execute('INSERT INTO '.$model->table.' ('.join(',', $fieldInsert).') VALUES ('.join(',', $valueInsert).')')) @@ -847,14 +849,15 @@ class DboSource extends DataSource function update (&$model, $fields = null, $values = null) { $updates = array(); - foreach (array_combine($fields, $values) as $field => $value) + $combined = array_combine($fields, $values); + foreach ($combined as $field => $value) { - $updates[] = $this->name($field).'='.$this->value($value); + $updates[] = $this->name($field).'='.$this->value($value, $model->getColumnType($field)); } $sql = 'UPDATE '.$this->name($model->table); $sql .= ' SET '.join(',', $updates); - $sql .= ' WHERE '.$this->name($model->primaryKey).'='.$this->value($model->getID()); + $sql .= ' WHERE '.$this->name($model->primaryKey).'='.$this->value($model->getID(), $model->getColumnType($model->primaryKey)); return $this->execute($sql); }