Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
drupal
Commits
863dd834
Commit
863dd834
authored
Apr 28, 2011
by
Dries
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Patch
#1139638
by DamZ: the SQLite driver cannot update a column to NULL.
parent
f5e8a63c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
includes/database/sqlite/query.inc
includes/database/sqlite/query.inc
+1
-1
modules/simpletest/tests/database_test.test
modules/simpletest/tests/database_test.test
+15
-0
No files found.
includes/database/sqlite/query.inc
View file @
863dd834
...
...
@@ -101,7 +101,7 @@ public function execute() {
}
elseif
(
!
isset
(
$data
))
{
// The field will be set to NULL.
$condition
->
isNull
(
$field
);
$condition
->
isN
otN
ull
(
$field
);
}
else
{
$condition
->
condition
(
$field
,
$data
,
'<>'
);
...
...
modules/simpletest/tests/database_test.test
View file @
863dd834
...
...
@@ -718,6 +718,21 @@ class DatabaseUpdateTestCase extends DatabaseTestCase {
$this->assertIdentical($saved_name, 'Tiffany', t('Updated name successfully.'));
}
/**
* Confirm updating to NULL.
*/
function testSimpleNullUpdate() {
$this->ensureSampleDataNull();
$num_updated = db_update('test_null')
->fields(array('age' => NULL))
->condition('name', 'Kermit')
->execute();
$this->assertIdentical($num_updated, 1, t('Updated 1 record.'));
$saved_age = db_query('SELECT age FROM {test_null} WHERE name = :name', array(':name' => 'Kermit'))->fetchField();
$this->assertNull($saved_age, t('Updated name successfully.'));
}
/**
* Confirm that we can update a multiple records successfully.
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment