Re: double record insertion
Re: double record insertion
It should be:
Code:
cola2->prepare( "INSERT INTO preguntas ( pregunta, dificultad, referencia, respuesta ) VALUES ( ?, ?, ?, ? )" );
cola2->bindValue( 0, c->texto );
cola2->bindValue( 1, c->dificultad );
...
BTW. Why do you allocate that query on the heap, if you delete it immediately? Won't it be simplier to create it on the stack?
Re: double record insertion
Quote:
Originally Posted by jacek
It should be:
Code:
cola2->prepare( "INSERT INTO preguntas ( pregunta, dificultad, referencia, respuesta ) VALUES ( ?, ?, ?, ? )" );
cola2->bindValue( 0, c->texto );
cola2->bindValue( 1, c->dificultad );
...
BTW. Why do you allocate that query on the heap, if you delete it immediately? Won't it be simplier to create it on the stack?
thanks, the prepare function works fine now. About the deletion it`s necesary because Sqlite block the while db with each query, cursor, o whatever that uses the database.:rolleyes:
Re: double record insertion
Quote:
Originally Posted by tranfuga25s
About the deletion it`s necesary because Sqlite block the while db with each query, cursor, o whatever that uses the database.
But if you create that query object on the stack, it will be deleted too and additionally it will be faster and less error-prone.