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

List:       zope
Subject:    [Zope] Re: Calling a SQL method from python and storing the results
From:       Mike Jakowlew <mjakowlew () gmail ! com>
Date:       2005-11-24 20:28:16
Message-ID: 5a66a8400511241228x6a2c757djbb996c3abb799bf5 () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Thanks all, I figured it out:

## GET last entry in db and obtain ID
## Find_Last_ID is my ZSQL method
## the [0][0] part is record_number/record_item repectively
## I only have one record in this method's return so I use [0] [0]

get_last_id = container.Find_Last_ID().tuples()[0][0]


On 11/24/05, Mike Jakowlew <mjakowlew@gmail.com> wrote:
>
> 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.
>
> 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.
>
> I've tried to use the container.id method, but that just returns the name
> of the Z-SQL method.
>
> Thanks in advance,
> mjakowlew
>

[Attachment #5 (text/html)]

Thanks all, I figured it out:<br><br>## GET last entry in db and obtain ID<br>## \
Find_Last_ID is my ZSQL method<br>## the [0][0] part is record_number/record_item \
repectively<br>## I only have one record in this method's return so I use [0] [0] \
<br><br>get_last_id = container.Find_Last_ID().tuples()[0][0]<br><br><br><div><span \
class="gmail_quote">On 11/24/05, <b class="gmail_sendername">Mike Jakowlew</b> &lt;<a \
href="mailto:mjakowlew@gmail.com">mjakowlew@gmail.com </a>&gt; \
wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, \
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Here is what I need to \
accomplish:<br><br>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. <br><br>My overall \
program:<br><br>Uploads a File (Working)<br>Write an entry to a MS SQL DB \
(Working)<br>Send an Email to alert user of upload (Working)<br><br>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. <br><br>I've tried to use the <a href="http://container.id" \
target="_blank" onclick="return \
top.js.OpenExtLink(window,event,this)">container.id</a> method, but that just returns \
the name of the Z-SQL method.<br><br>Thanks in advance, <br>mjakowlew<br>

</blockquote></div><br>



_______________________________________________
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