PDA

View Full Version : How to get the return value of a 'returning clause' using PostgreSQL?



gboelter
9th January 2014, 10:40
Good afternoon!

Using PostgreSQL my query looks like this:


UPDATE nummernkreise SET wert = wert+1 WHERE name = 'Angebot' RETURNING wert;

The query returns the updated value of 'wert'.

In Qt (4.8.4) I have tried


query.prepare( "UPDATE nummernkreise SET wert = wert+1 WHERE name = :Name RETURNING wert" );
query.bindValue( ":Name", m_form );
query.exec();

Any idea how to get the updated content of 'wert' returned by this query?

Guenther

Lesiok
9th January 2014, 19:56
Read carefully about QSqlQuery::bindValue. It have 3 parameters.

gboelter
11th January 2014, 05:04
Read carefully about QSqlQuery::bindValue. It have 3 parameters.

Thanks Lesiok,

I have never recogniced the third parameter of QSqlQuery::bindValue, but now it's working.

Regards

Guenther