Exec statement problem
maxsbox
maxsbox at scds.co.za
Sat Oct 9 02:18:39 EDT 1999
I have been trying to pass a variable to a query statement.
The statement exec: appears to be the answer, however I cannot get it to
work
wrote the following:
def art2(db, z):
y = 'db.query("SELECT * FROM artisan WHERE name = \''
y = y+z
y = y+ '\'")'
print y # prints correct string
exec y # gives fault message
db is the connected data base
z is the required variable, in this case 'Nico"
Also tried a few variations of the exec statement with the same result
If someone can help with the correct syntax I will be most appreciative,
the docs are a bit terse on the subject. The ability to create such a
search on the fly is fundamental to my wish to use pygresql.
Regards
Max Wood
More information about the Python-list
mailing list