RE: [Zope] ZSQL-Methods: last inserted id

2000-05-18 Thread Ron Bickers

You can get a ZSQLMethod that's used for inserting to return the last
inserted ID by doing the following:

  INSERT ...whatever...

  

  SELECT LAST_INSERT_ID() AS newid

You get the results as you would with any ZSQLMethod:

  
  Inserted ID: 
  

___

Ron Bickers
Logic Etc, Inc.
[EMAIL PROTECTED]


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Andy
> Sent: Wednesday, May 17, 2000 7:45 PM
> To: [EMAIL PROTECTED]
> Subject: [Zope] ZSQL-Methods: last inserted id
>
>
>
> I wonder how I can find out about the last inserted id of a row in my
> mysql-database, which I inserted through a ZSQL-Method...
>
> I tried mysql's built-in function LAST_INSERT_ID(), but that did not solve
> my problem...
>
>
> ___
> Zope maillist  -  [EMAIL PROTECTED]
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>
>


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] ZSQL-Methods: last inserted id

2000-05-17 Thread Phil Harris

LAST_INSERT_ID is the MySQL way to find out the last inserted id, how
exactly didn't it solve your problem?

phil
- Original Message -
From: "Andy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 18 May 2000 00:44
Subject: [Zope] ZSQL-Methods: last inserted id


>
> I wonder how I can find out about the last inserted id of a row in my
> mysql-database, which I inserted through a ZSQL-Method...
>
> I tried mysql's built-in function LAST_INSERT_ID(), but that did not solve
> my problem...
>
>
> ___
> Zope maillist  -  [EMAIL PROTECTED]
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] ZSQL-Methods: last inserted id

2000-05-17 Thread Jonothan Farr

> I wonder how I can find out about the last inserted id of a row in my
> mysql-database, which I inserted through a ZSQL-Method...
> 
> I tried mysql's built-in function LAST_INSERT_ID(), but that did not solve
> my problem...


It should. Create a DTML method called, say 'select_last_id':

select LAST_INSERT_ID() AS id;

then from dtml:


This is the last inserted id: 


--jfarr

"Perl is worse than Python because people wanted it worse."
Larry Wall, 14 Oct 1998



___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )