Hi Fabio, On Fri, Jan 15, 2010 at 5:43 PM, Fabio Mascarenhas <mascaren...@acm.org>wrote:
> On Fri, Jan 15, 2010 at 7:59 PM, Ryan Pusztai <rpusz...@gmail.com> wrote: > > Hi, > > I can not get the model find_all to work correctly when I want to use > MySQL > > operators of '!=' and 'NOT REGEXP'. I think it has to do with the pattern > in > > the string.gsub() in "build_query". > > > > To fix the '!=' just add '!' to the string.gsub() pattern. > > - string.gsub(condition, "([%w_]+)%s*([%a<>=]+)%s*%?", > > + string.gsub(condition, "([%w_]+)%s*([%a<>!=]+)%s*%?", > > > > Here is the code I use to call model:find_all() > >> > >> self:find_all("notes NOT REGEXP ?", { Autobahn }) > > Use > > string.gsub(condition, "([%w_]+)%s*([%a%s<>!=]+)%s*%?", > > In the line you quoted above. It is somewhat a dirty hack, but it will > do for now, Lua's pattern matching is very limited. :-) > This works. Thanks. -- Regards, Ryan
_______________________________________________ Kepler-Project mailing list Kepler-Project@lists.luaforge.net http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project http://www.keplerproject.org/