[Zope] Something funny about SQL like?

Jens Vagelpohl tommymi@concentric.net
Mon, 2 Aug 1999 18:09:27 -0400


hi dnald,

here is a SQL "LIKE"-type query i use in my study project:


< 8< gorgeous code 8< >

<!--#if "colchoice1=='Customer Number'"-->
      Kunden.Kundennummer LIKE '%<!--#var input1-->%'
<!--#/if-->

< 8< gorgeous code 8< >



as you can see, the whole %<!--#myvar-->% string is enclosed by single
quotes. maybe that will help you.

Jens Vagelpohl



> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
> Donald Holten
> Sent: Monday, August 02, 1999 17:51
> To: snair@utstar.com
> Cc: zope@zope.org
> Subject: Re: [Zope] Something funny about SQL like?
>
>
> 	Well, I've tried escaping the '%', single quotes instead of
> double quotes, sqlvar instead of var, and
> none of those have worked.  Here's the code again:
>
> select *
>   from Users
>   where <!--#var searchkey--> like "%<!--#var valuekey-->%"
> order by <!--#var searchkey-->
>
> 	And here's the error again:
>
> Error, exceptions.SyntaxError: unexpected token sequence.near :: 'where
> firstname'*' like "%Donald%'
> ******************************* current state = 45 expects: ',', 'UNION',
> 'FLOAT', 'GROUP',
> 'VARCHAR', 'DESC', 'SELECT', 'ORDER', 'WHERE', 'AS', 'IN',
> 'INTERSECT', 'ASC',
> '*', '+', '(', ')', '.',
> '/', 'EXCEPT', '-', 'AND', 'FROM', '*', ';', 'INTEGER', 'NOT',
> '>', 'OR', '=',
> 'BETWEEN', 'HAVING', '<',
> 'VALUES', ('nomatch1',) current token = ((-8,
> 'user_defined_name'), 'LIKE')
>
> SQL used:
>
> select *
>   from Users
>   where firstname like "%Donald%"
> order by firstname
>
> 	Like I said, it looks to me like the SQL it's trying to use
> is fine.
> Does GadflySQL not support the "like" keyword?
> 	Donner
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
>
> (To receive general Zope announcements, see:
> http://www.zope.org/mailman/listinfo/zope-announce
>
> For developer-specific issues, zope-dev@zope.org -
> http://www.zope.org/mailman/listinfo/zope-dev )
>