[Interest] Postgresql RETURNING clause.... possible to get it?

Guido Seifert wargand at gmx.de
Mon Feb 16 15:01:15 CET 2015


Arrghh.... it is that simple. Never occurred to me to try this with an INSERT. Thanks. :-)

Guido

On Mon, 16 Feb 2015 08:39:22 -0500 (EST)
Jason Dolan <jason at pcc.com> wrote:

> It should be as simple as:
> 
> QSqlQuery query;
> query.prepare("INSERT INTO rooms (coordinate) VALUES (ST_SetSRID(ST_MakePoint(:lon, :lat), 4326)) returning id”);
> query.bindValue(“:lon”, x);
> query.bindValue(“:lat”, y);
> uint roomsId = 0;
> if(query.exec() && query.first())
> 	roomsId = query.value(0).toUInt();




More information about the Interest mailing list