[Qt-interest] Problem with QSqlQuery ?

Mhayk Whandson eu at mhayk.com.br
Tue Sep 15 23:42:56 CEST 2009


I tryed passing the query to function exec() and works again:
#define RESTART_SEQUENCE_DSM_TEMP_ITEMS_PRESELL_ID "alter sequence
QSqlQuery *restart = new QSqlQuery;
restart->exec(RESTART_SEQUENCE_DSM_TEMP_ITEMS_PRESELL_ID);

so, Should not I to use the method prepare() ?

best regards,

On Tue, Sep 15, 2009 at 5:34 PM, Mhayk Whandson <eu at mhayk.com.br> wrote:
> 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
>



-- 
Mhayk Whandson
Linux User #413723
E-mail: eu at mhayk.com.br



More information about the Qt-interest-old mailing list