vendredi 6 mai 2016

The SQLITE insert command show SIGSEGV error in Qt

This is my code that show me SIGSEGV error. But I can not find where is my mistake. When I copy exactly code to SQLite and run it, it works. but it shows me the SIGSEGV error in Qt IDE.
This is my code :

bool DB::InsertUserAuthenticate(int id,int Admin,int Active,int AT_ID,int UI_ID,QString UA_Data)
    QSqlQuery q;
    //begin transaction
    /*insert data if the exact data not repeated in table*/
    q.prepare("BEGIN; INSERT INTO UserInfo(UI_ID,UI_Admin,UI_Active)"
              " SELECT :id,:admin,:active"
              " WHERE NOT EXISTS(SELECT 1 FROM UserInfo "
              " WHERE UI_ID=:id AND UI_Admin=:admin AND UI_Active=:active);"
              " INSERT INTO UserAuthenticate"
              " (AT_ID,UI_ID,UA_Data,UA_Active)"
              " VALUES (:atid,:uiid,:uadata,:active);"
             /* " VALUES (:id,:admin,:active);");*/
    q.bindValue(":id", id);
    q.bindValue(":admin", Admin);
    q.bindValue(":active", Active);
    q.bindValue(":atid", AT_ID);

        q.exec("COMMIT;");//finished the transaction
        return true;
        q.exec("ROLLBACK;");//bad finished. should rool back
    return false;

Aucun commentaire:

Enregistrer un commentaire