db
db copied to clipboard
A WPDB wrapper and query builder library.
- doc(README.md) add missing doc entries - doc(CHANGELOG.md) set release date
I have column named `key` which is a reserved word in MySQL. If you don't use a backtick ``` in you SQL query then will error. My SQL that was...
Often times it's useful to update existing rows if present and insert if missing. An example of this in WordPress is the `update_post_meta` function. It would be useful to be...
Currently the Query Builder user [wpdb::insert()](https://developer.wordpress.org/reference/classes/wpdb/insert/) under the hood to run the insert. This is lame for a couple reasons: 1. You can't really do anything particularly complex as we're...
Right now the `QueryBuilder::update()` method uses [wpdb::update()](https://developer.wordpress.org/reference/classes/wpdb/update/) under the hood. This limits us to what that method is capable of. For example, want a `WHERE X IN (SELECT...)` clause in...
Right now the `QueryBuilder::delete()` method uses [wpdb::delete()](https://developer.wordpress.org/reference/classes/wpdb/delete/) under the hood. This limits us to what that method is capable of. For example, want a `WHERE X IN (SELECT...)` clause in...
SQL provides the ability to [Insert Into](https://dev.mysql.com/doc/refman/8.0/en/insert-select.html) a table using the results of another query. This is incredibly useful, especially as a means of migration or conditionally inserting rows. Take...
It is nice to have function and commonly used in WordPress before creating a new database table. I suggest adding it to the library. The `tableExists` function will check whether...