[ic] sql query with UNION broken
Mike Heins
mike at perusion.com
Fri Aug 22 12:18:58 EDT 2003
Quoting Kevin Walsh (kevin at cursor.biz):
> Jon Jensen [jon at endpoint.com] wrote:
> >
> > Perhaps we should switch the logic of the test, since UPDATE statements
> > will be more homogeneous than SELECTs and also much rarer:
> >
> > $update = 1 if $query =~ /^\s*update\s+/i;
> >
> > But that would mess up DELETE, DROP INDEX/TABLE, CREATE INDEX/TABLE, etc.
> > So maybe just a minor correction would be better:
> >
> > $update = 1 if $query !~ /^\s*\W*\s*select\s+/i;
> >
> The second correction is better, in my opinion. There is only one
> SELECT statement, while there are loads of statements that would need
> $update to be set.
>
> I suggest a minor correction to your second proposal, as follows:
>
> $update = 1 if $query !~ /^[\s\W]*select\s+/i;
>
> That would allow multiple opening parentheses (with or without
> whitespace between) before the SELECT.
Since whitespace is \W, we can simplify to \W*.
--
Mike Heins
Perusion -- Expert Interchange Consulting http://www.perusion.com/
phone +1.513.523.7621 <mike at perusion.com>
Fast, reliable, cheap. Pick two and we'll talk. -- unknown
More information about the interchange-users
mailing list