JSON object into SQLite database
-
Hi Folks,
I have an SQLite database, where the last column has TEXT type. I would like to insert into that an JSON object which will not appear in the database after the execution of the query. To do that, I'm using this SQL statement:
@
insert or replace into issue (title, description, state, severity, attachment) values(?, ?, ?, ?, ?)
@
which is filled up by the following way:
@
QSqlQuery query(_database);
query.prepare(_session->value("card/sql/query/write/save").toString());
query.addBindValue(card.title);
query.addBindValue(card.description);
query.addBindValue(card.state);
query.addBindValue(card.severity);
query.addBindValue(card.attachment);
query.exec();
@In my case the important is the last value adding: the card.attachment which is an QJsonObject instance.
After the executuion of the query, I tried to print out the errors too, everythings seem to be OK, but the cell in the databse is empty.Can anybody help me?
Regards,
Norbert -
Hi,
yes, maybe you misunderstood:
- Description column is a text type column in the database, but it doesn't have any matter.
- The important statement is the last two lines in my first post:
** I bind a JSon object into the prepared statement
** I execute the prepared statement query
The problem is that the result doesn't appear in the database.
Regards,
Norbert