Hi,
I am trying to get the record id after an insert (using mysql 4.1.14-nt). Does OPS support this? Thanks, Assaf -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
Assaf,
The SQL processor currently doesn't have support for obtaining the inserted record id using JDBC's getGeneratedKeys() (I assume that's what you are looking for). -Erik [hidden email] wrote: > Hi, > > I am trying to get the record id after an insert (using mysql 4.1.14-nt). Does OPS support this? > > Thanks, > > Assaf -- Orbeon - XForms Everywhere: http://www.orbeon.com/blog/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Hi Erik,
Thanks for the answer. Is there another way you usually solve this with (quite a generic issue)? If not, can you give me direction on how to implement myself? I will be glad to contribute it back once it works. I thinks this is a basic requirement for any DB platform. Thanks, Assaf --- Erik Bruchez <[hidden email]> wrote: > Assaf, > > The SQL processor currently doesn't have support for > obtaining the > inserted record id using JDBC's getGeneratedKeys() > (I assume that's what > you are looking for). > > -Erik > > [hidden email] wrote: > > Hi, > > > > I am trying to get the record id after an insert > (using mysql 4.1.14-nt). Does OPS support this? > > > > Thanks, > > > > Assaf > > -- > Orbeon - XForms Everywhere: > http://www.orbeon.com/blog/ > > > > -- > You receive this message as a subscriber of the > [hidden email] mailing list. > To unsubscribe: > mailto:[hidden email] > For general help: > mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: > http://www.objectweb.org/wws > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
I had a look at the SqlProcessor but it looks too complicated for an outsider to play with. Does anyone have a suggestion on how to get the id after an insert?
-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
In reply to this post by assafn
For MySQL 4.1, you can use the LAST_INSERT_ID() SQL function to get the
ID inserted -- so you could write a second SQL query, running in the same connection, to get the value you want. See http://dev.mysql.com/doc/refman/4.1/en/example-auto-increment.html Steve -----Original Message----- From: [hidden email] [mailto:[hidden email]] Sent: 24 July 2006 18:29 To: [hidden email] Subject: Re: Re: [ops-users] Getting the record id after an insert I had a look at the SqlProcessor but it looks too complicated for an outsider to play with. Does anyone have a suggestion on how to get the id after an insert? -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
thanks! works great. I submitted a feature request for
this. for others, my code after the insert is as follows: <request> <sql:execute> <sql:query> select LAST_INSERT_ID() last_id</sql:query> <sql:result-set> <sql:row-iterator> <request_id> <sql:get-column-value column="last_id"/> </request_id> </sql:row-iterator> </sql:result-set> </sql:execute> </request> --- Stephen Bayliss <[hidden email]> wrote: > For MySQL 4.1, you can use the LAST_INSERT_ID() SQL > function to get the > ID inserted -- so you could write a second SQL > query, running in the > same connection, to get the value you want. > > See > http://dev.mysql.com/doc/refman/4.1/en/example-auto-increment.html > > Steve > > -----Original Message----- > From: [hidden email] [mailto:[hidden email]] > Sent: 24 July 2006 18:29 > To: [hidden email] > Subject: Re: Re: [ops-users] Getting the record id > after an insert > > I had a look at the SqlProcessor but it looks too > complicated for an > outsider to play with. Does anyone have a suggestion > on how to get the > id after an insert? > > > > > > -- > You receive this message as a subscriber of the > [hidden email] mailing list. > To unsubscribe: > mailto:[hidden email] > For general help: > mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: > http://www.objectweb.org/wws > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
In reply to this post by assafn
Assaf,
I see somebody provided a workaround. Re the complexity of the SQL processor, yes, it is fairly complex. There was a plan to refactor it using the new ElementHandler mechanism to make it easier to deal with, but I don't think that will happen before we release the next stable release of OPS. -Erik [hidden email] wrote: > I had a look at the SqlProcessor but it looks too complicated for an outsider to play with. Does anyone have a suggestion on how to get the id after an insert? -- Orbeon - XForms Everywhere: http://www.orbeon.com/blog/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |