[Qt-interest] Problem with QSqlQuery ?
Mhayk Whandson
eu at mhayk.com.br
Wed Sep 16 00:02:28 CEST 2009
Ops!! I'm sorry, now the correct source below:
#define RESTART_SEQUENCE_DSM_TEMP_ITEMS_PRESELL_ID "alter sequence
dsm_temp_items_presell_id_seq restart with 1"
QSqlQuery *restart = new QSqlQuery;
restart->prepare(RESTART_SEQUENCE_DSM_TEMP_ITEMS_PRESELL_ID);
if ( !restart->exec() )
{
//Error handler
qDebug() << restart->lastError();
}
delete restart;
but the same error again:
QSqlError(-1, "QPSQL: Unable to create query", "ERROR: syntax error
at end of input
LINE 1: EXECUTE
^
")
On Tue, Sep 15, 2009 at 5:58 PM, Mhayk Whandson <eu at mhayk.com.br> wrote:
> #define RESTART_SEQUENCE_DSM_TEMP_ITEMS_PRESELL_ID "alter sequence
> dsm_temp_items_presell_id_seq restart with 1"
>
> QSqlQuery *restart = new QSqlQuery;
> restart->exec(RESTART_SEQUENCE_DSM_TEMP_ITEMS_PRESELL_ID);
> if ( !restart->exec() )
> {
> //Error handler
> qDebug() << restart->lastError();
> }
> delete restart;
>
> Debug output:
>
> QSqlError(-1, "QPSQL: Unable to create query", "ERROR: syntax error
> at end of input
> LINE 1: EXECUTE
> ^
> ")
>
> best regards,
>
> On Tue, Sep 15, 2009 at 5:44 PM, Scott Aron Bloom
> <Scott.Bloom at sabgroup.com> wrote:
>> 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
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>
>
>
> --
> Mhayk Whandson
> Linux User #413723
> E-mail: eu at mhayk.com.br
>
--
Mhayk Whandson
Linux User #413723
E-mail: eu at mhayk.com.br
More information about the Qt-interest-old
mailing list