[wp-trac] [WordPress Trac] #31679: dbDelta generates wrong SQL on ALTER TABLE with columns containing hyphens in name
WordPress Trac
noreply at wordpress.org
Wed Mar 18 13:16:24 UTC 2015
#31679: dbDelta generates wrong SQL on ALTER TABLE with columns containing hyphens
in name
--------------------------+------------------------------
Reporter: fulippo | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Plugins | Version: 4.1.1
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by fulippo):
As regards the problem reported above, I think that just changing the code
around line 1694 from
{{{
$tablefields = $wpdb->get_results("DESCRIBE {$table};")
}}}
to
{{{
$tablefields = array_map(function($row){
if( strpos( $row->Field, '`' ) === false ) {
$row->Field = '`'.$row->Field.'`';
}
return $row;
}, (array)$wpdb->get_results("DESCRIBE {$table};"));
}}}
Could solve the problem.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31679#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list