Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
863dd834
Commit
863dd834
authored
Apr 28, 2011
by
Dries Buytaert
Browse files
- Patch
#1139638
by DamZ: the SQLite driver cannot update a column to NULL.
parent
f5e8a63c
Changes
2
Hide whitespace changes
Inline
Side-by-side
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
Supports
Markdown
0%
Try again
or
attach a new 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