[Qt-interest] Problem with QSqlQuery ?

Scott Aron Bloom Scott.Bloom at sabgroup.com
Tue Sep 15 23:44:58 CEST 2009


Well for one.. why are you putting it on the heap?

That said, I almost NEVER use the second form..
Typical usage for me..

QSqlQuery query
query.prepare( xxxx )
if ( !query.exec() )
{
//Error handler
qDebug() << query.lastError();
}


With the constructor you don't know it failed.

Scott



-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Mhayk Whandson
Sent: Tuesday, September 15, 2009 2:35 PM
To: Qt Interest (qt-interest at trolltech.com)
Subject: [Qt-interest] Problem with QSqlQuery ?

Hi all, I would like to know what is the difference between this 2
options below:

#define RESTART_SEQUENCE_DSM_TEMP_ITEMS_PRESELL_ID "alter sequence
dsm_temp_items_presell_id_seq restart with 1"

First:
QSqlQuery *restart = new QSqlQuery;
restart->prepare(RESTART_SEQUENCE_DSM_TEMP_ITEMS_PRESELL_ID);
restart->exec();
delete restart;

Second:
QSqlQuery *restart = new
QSqlQuery(RESTART_SEQUENCE_DSM_TEMP_ITEMS_PRESELL_ID);
delete restart;

The query just work with the second option :\ why ? I need to pass to
the QSqlQuery constructor ? Is it true ?

-- 
Mhayk Whandson
Linux User #413723
E-mail: eu at mhayk.com.br
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list