[HyperDB] is_write_query too strict
Andy Skelton
skeltoac at gmail.com
Mon Aug 16 21:53:45 UTC 2010
This is now in trunk. Thanks!
http://plugins.trac.wordpress.org/changeset/276948/
Andy
On Fri, Jul 30, 2010 at 12:14 PM, Gabriel Koen <gkoen at corp.mail.com> wrote:
> Came across an issue where only the first query (autoload options) was being
> sent to the read slave(s). Turns out a couple plugins had the syntax 'SHOW
> TABLES LIKE...' which HyperDB thought was a read query, since it didn't
> match 'SELECT' as the first word. Made a quick fix for what I think are some
> common read statements to db.php:
>
> function is_write_query( $q ) {
> $pattern = '/^\s*(SELECT|SHOW|DESCRIBE|EXPLAIN)\s+/i';
> return (preg_match($pattern, $q)) ? false : true;
> }
>
> As you can see my regex-fu is weak, I spent a good 40 minutes trying to
> negatively match those words. Gave up, instead positively match them and
> then return true if there's *not* a match.
>
>
> Gabriel
> _______________________________________________
> HyperDB mailing list
> HyperDB at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/hyperdb
>
More information about the HyperDB
mailing list