-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Currently the Query Builder user wpdb::insert() under the hood to run the insert. This is lame for a couple reasons:
- You can't really do anything particularly complex as we're limited to what that function supports
- For example, you can only insert a single row at a time... Have 20 rows to insert? Too bad. Do it 20 times. 😭
Let's just ditch wpdb and build the SQL ourselves. We don't need them! I think as a good first step the following should be possible:
DB::table('post_meta')
->insert([
['post_id' => 1, 'meta_key' => 'foo', 'meta_value' => 'bar'],
['post_id' => 1, 'meta_key' => 'foo2', 'meta_value' => 'bar2'],
['post_id' => 1, 'meta_key' => 'foo3', 'meta_value' => 'bar3'],
]);
Currently the insert signature contains a $format
parameter. I'm inclined to just drop that and infer from the value type what it should be: strings should be strings, numbers should be numbers, and so forth. Crazy stuff! Dropping the last parameter shouldn't break anything since passing additional parameters in PHP doesn't throw an error.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request