[prev in list] [next in list] [prev in thread] [next in thread] 

List:       zope
Subject:    Re: [Zope] Calling a SQL method from python and storing the results
From:       Tino Wildenhain <tino () wildenhain ! de>
Date:       2005-11-24 18:20:19
Message-ID: 1132856419.25685.17.camel () Andrea ! peacock ! de
[Download RAW message or body]

Am Donnerstag, den 24.11.2005, 13:04 -0500 schrieb Mike Jakowlew:
> Here is what I need to accomplish:
> 
> I need to call a Z-SQL method from within python and store the result
> in a variable in python. I know this could probably be done easier
> with ZPT's or DTML, however the program that I've written does many
> things and depends on this particular variable for the majority of the
> program. 

ou contraire, its much more easy in python.

> My overall program:
> 
> Uploads a File (Working)
> Write an entry to a MS SQL DB (Working)
> Send an Email to alert user of upload (Working)
> 
> in this particular case all I need is the id of the last row in the db
> before the e-mail is sent out. The e-mail itself sends a link that
> calls another SQL method with ID as the parameter passed. 

This is a bit problematic with MS SQL since it does not have
sequences for easy access to automatically generated ids.

You might work around that by doing the insert with a stored
procedure, returning the id of your insert.

> I've tried to use the container.id method, but that just returns the
> name of the Z-SQL method.

ZSQL methods are high level above the database and simply dont know
about such internals. If your SQL statement however returns
rows, you can happily retrieve it with your method.

_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic