I am looking for some example code using Qt and it's SQL module with Sqlite driver. Main reason I need examples for is that I've prior experience with Qt's database interface and Sqlite has some weird behavior with field types (types are stored per-field, not per-column).
SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine. Used in Qt SQL Lite plugin.
db" QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); db. setDatabaseName(path); db. open(); QSqlQuery query; // And he should insert some data, as the answer above mentioned query. exec("create table person " "(id integer primary key, " "firstname varchar(20), " "lastname varchar(30), " "age integer)");
The Qt 5 SQL examples use SQLite as this does not require a database server. You should be able to go from the supplied examples to your own sample code pretty quickly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With