[Zope] Re: execute parameters sql in script

Wolfram Kraus kraus at hagen-partner.de
Fri Sep 19 04:16:12 EDT 2003


Heyho!

Michael Bleijerveld wrote:
> Hi,
> 
> When executing the following script with parameters user1 and password1 I
> receive a error message.
> 
> import kinterbasdb,sys
> 
> con = kinterbasdb.connect(
>     dsn='test.gdb',
>     user='sysdba', password='masterkey'
>   )
> 
> # Get a Cursor object that operates in the context of Connection con:
> cur = con.cursor()
> 
> # Execute the SELECT statement:
> str_sql = "insert into users values (" + sys.argv[0] + ", "+ sys.argv[1] +
> ",)"
You don't need the last comma:
str_sql = "insert into users values (" + sys.argv[0] + ", "+ sys.argv[1] 
+ ")"

> cur.execute(str_sql)
> 
> # Retrieve all rows as a sequence and print that sequence:
> print cur.fetchall()
> 
> It seems to be to SQL string but I am not sure. Any suggestions.
> 
> 
> Regards.
> 
> Michael
> 
HTH,
Wolfram





More information about the Zope mailing list