Copperspice 1.7.0 SQLite QString Blob
Posted: Tue Nov 17 2020 3:13 pm
I have been developing a small (personal) talking diary application for Linux called EventTalker (https://github.com/crispinalan/) with Debian 10 CopperSpice 1.6.3.
I have now started to look at using CopperSpice 1.7.0. I noticed an issue with my dbManager code written to insert, update etc. events into an SQLite database. Basically in my AddEvent method with 1.6.3 I was able to use code like.
where query is an
and title is inserted into the database as a TEXT type. After migrating to 1.7.0 I observed that with the same code the title is inserted into the database as a BLOB. I checked the SQLite documentation and a TEXT value is a text string, stored using the encoding (UTF-8, UTF-16BE or UTF-16LE). So my immediate thought was to use an UTF-8 encoding with the query bindValue line as shown below.
This worked. However it raises some questions about QString and changes from 1.6.3 to 1.7.0. This is my first CopperSpice project (and forum post) and I am still learning about the core design and functionality. I have noticed that there is a CsString library which supports encoding. When and how would you use CsString as opposed to QString in a query.bindValue()?
Thank you for all the great work that has been done with CopperSpice.
I have now started to look at using CopperSpice 1.7.0. I noticed an issue with my dbManager code written to insert, update etc. events into an SQLite database. Basically in my AddEvent method with 1.6.3 I was able to use code like.
Code: Select all
QString title = event.m_title;
query.bindValue(":titlein",title);
Code: Select all
QSqlQuery query;
Code: Select all
query.bindValue(":titlein",title.toUtf8());
Thank you for all the great work that has been done with CopperSpice.