[wp-trac] [WordPress Trac] #31042: WPDB field_types Variable Too Broad?
WordPress Trac
noreply at wordpress.org
Sat Jan 17 04:30:14 UTC 2015
#31042: WPDB field_types Variable Too Broad?
-------------------------+------------------------------
Reporter: njkrut | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Database | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
-------------------------+------------------------------
Comment (by nacin):
In general, `$field_types only` benefits WordPress core, as you'd
generally want to specify formats for values (for INSERT, UPDATE) and
where values (for UPDATE, DELETE). So, while core may do:
{{{
$wpdb->update( $wpdb->users, array( 'user_activation_key' => $key, 'ID' =>
$id ) )
}}}
A plugin should always do:
{{{
$wpdb->update( 'custom_table', array( 'user_activation_key' => $key, 'ID'
=> $id ), array( '%s', '%d' ) )
}}}
I do see the benefit of allowing it so a plugin can register their field
types with WordPress, but as it stands right now, that's not how it's
designed... It's mostly just an internal thing, designed only for core
columns.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31042#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list