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);"
"COMMIT;");
/* " VALUES (:id,:admin,:active);");*/
q.bindValue(":id", id);
q.bindValue(":admin", Admin);
q.bindValue(":active", Active);
q.bindValue(":atid", AT_ID);
q.bindValue(":uiid",UI_ID);
q.bindValue(":uadata",UA_Data);
if(q.exec())
{
q.exec("COMMIT;");//finished the transaction
return true;
}
else
{
q.exec("ROLLBACK;");//bad finished. should rool back
msg=q.lastError().text();
}
return false;
}
Aucun commentaire:
Enregistrer un commentaire