[Haskell-cafe] Fwd: Re: How to select last inserted record from Table Using Database.HSQL.MySQL
Steffen Schuldenzucker
sschuldenzucker at uni-bonn.de
Tue Jul 26 14:27:51 CEST 2011
Forwarding to list
-------- Original Message --------
Subject: Re: [Haskell-cafe] How to select last inserted record from
Table Using Database.HSQL.MySQL
Date: Tue, 26 Jul 2011 14:27:56 +0300
From: Sergiy Nazarenko <nazarenko.sergiy at gmail.com>
To: Steffen Schuldenzucker <sschuldenzucker at uni-bonn.de>
Thanx a lot!
I could solve that problem in this way:
cmd = " INSERT INTO mytable (bar,foo) VALUES ("val1","val2"); SELECT
LAST_INSERT_ID() as id;"
lst <- query connection cmd >>= collectRows (\st -> getFieldValue st "id")
lst has required value
Cheers!
More information about the Haskell-Cafe
mailing list