[Zope-DB] DTML-sqlvar string error

ilker imamoglu ilkeri at hotmail.com
Mon Nov 15 19:44:47 EST 2004


Hi all...

I tried to find something to solve problem....

Here is the point that I came...


1. I modified PoPy_DA.py file by adding line

import string

just before the line

from PoPy_db import DB

2. After restarting the ZOPE, some of the failed programs starts to run. BUT

When I write Z SQL method like :

   SELECT * FROM Library
   where
   bk_id='<dtml-sqlvar xbk_id type=int>'

and test it, transformed like this:

   SELECT * FROM Library
   where
   bk_id='xbk_id = 1'

instead of this when I write like this (with sqltest). My aim is return some 
optional variables to the sql. All of the variables can be entered or one of 
the selected variable can be entered.

   SELECT * FROM Library
   where
   <dtml-sqltest xbk_id column=bk_id type=int optional>
   OR
   <dtml-sqltest xisbn column=isbn type=int optional>
   OR
   <dtml-sqltest xbk_nm column=bk_nm type=string optional>
   OR
   <dtml-sqltest xbk_author column=bk_author type=string optional>

it tranformed when some values are returned

   SELECT * FROM Library
   where
   bk_id = 1
   OR
   isbn = 1111
   OR
   bk_nm = 'ZOPE'
   OR
   bk_author = ''

So It seems to be run... But except one point....


If I dont return a int value for example for ISBN

transformation done like this:

SELECT * FROM Library
where
bk_id = 1
OR

OR
bk_nm = ''
OR
bk_author = ''

Yes, blank area between two ORs
So I got

Error, PoPy.ProgrammingError: ERROR: parser: parse error at or near "OR" at 
character 47

error message

Do you have any idea...

sincerely...

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.com/



More information about the Zope-DB mailing list