[wp-trac] [WordPress Trac] #26106: Passing empty array to wpdb::update() generates invalid SQL
WordPress Trac
noreply at wordpress.org
Tue Nov 19 02:19:07 UTC 2013
#26106: Passing empty array to wpdb::update() generates invalid SQL
--------------------------+-----------------------------
Reporter: Viper007Bond | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Database | Version:
Severity: normal | Keywords:
--------------------------+-----------------------------
I wanted to update all rows in a database table, so I did this:
{{{
$wpdb->update(
'custom_table',
array(
'column' => 'value',
),
array()
);
}}}
However this generates a query like this:
{{{
UPDATE `custom_table` SET `column` = 'value' WHERE
}}}
So we either need some validation and bail if it's empty or better, we
should drop the `WHERE`, allowing queries like mine.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/26106>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list