﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
7171,wpdb::insert() & wpdb::update() need to allow typecasting of params.,DD32,westi,"As a follow up to: http://trac.wordpress.org/ticket/6836#comment:8

insert() and update() should prepare the values before inserting/updating

I see 2 options;

 1. 3rd param to insert() & update() which specifies the field types; Eg: http://trac.wordpress.org/ticket/6836#comment:9 [[BR]]The downside to that is it'll require the type to be specified on each insert/update statement

 2. defining the field-types in an array to check against eg:
{{{
$wpdb->fields = array( $wpdb->posts => array('ID' => '%d', 'post_content' => '%s') );

..
in insert():
foreach( (array)$data as $key => $value )
   if( isset($this->fields[ $table ][ $key ]) )
       $data[$key] = sprintf($this->fields[ $table ][ $key ], $value);
}}}
The downside of this approach, Is that it'll require the list to be kept updated, However, it has the advantage of being kept updated in a single location.

If theres a preference for either method, I'm happy to roll up a patch for it.",task (blessed),closed,normal,2.8,Administration,2.6,normal,fixed,dev-feedback has-patch early,
