[Interest] Copy QSqlRecord to different database

Mark Gaiser markg85 at gmail.com
Fri Aug 19 17:47:46 CEST 2016


Hi,

Imagine this case:

You fetch data from one database (say MariaDB), you get a QSqlQuery filled
with QSqlRecords.
Now i want to copy all those records to another QSqlDatabase instance this
is an SQLite database.

The SQLite database has some fields with different names compared to the
MariaDB one, but that is easily fixable by changing the field name (using
setName on an individual QSqlField).

What i don't know is how to proceed from there on.
Would it be enough to call setDatabase on the original query by setting it
to the destination database? Then i'd probably have to change the query to
be an update or insert query?

Would that work?
Does anyone have any experience in copying data from one database to
another using Qt?

Cheers,
Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160819/8b471d21/attachment.html>


More information about the Interest mailing list