[Zope] MySql and Auto_increment

Ken Kinder kkinder@messagemedia.com
Mon, 17 Apr 2000 14:42:31 -0600


I don't know about MySQL, but if it's anything like every other DBMS, it returns
an object ID when you do an insert. The object id can be used to get the primary
key.

Luis Cortes wrote:

> Hello,
>
> Has anyone run into this problem:  I have created a table with an
> auto_increment  id.  I want to be able to get the new id without having to do
> another query.  Does someone know how to do this with Mysql?
>
> I.E.
>
>         create table test( id NOT NULL auto_increment, name char(20))
>
>         insert into table test (name) values ("first");
>
>         > at this point I would like to get the id assigned to first without
> doing a
>         select id from test where name ="first"
>         is there a way to do this????
>
> Thanks,
> Luis.
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> 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 )

--
Ken Kinder
303.381.7631