Online / Offline managing Mysql database - c++

I'm creating a software in c++ with Qt library where the database is loaded when you log in to the software.
When it's done you can use it without connection and edit your database, then when you have internet access you can update your online database.
How can I do that ?
Write it into a file with my own format and then parse and do the mysql request when I have internet connection ?
Use a database with localhost and then copy it to the real one ?
An other solution ?
When two users update their database offline, how can I check they don't use the sameId ? By the way I need the ID as father/son elements.
Thanks.

I found a good solution which is to use a sqlite database in my C++ program.
So I have the same requests in both directions ("Upload", "Download") and access to all my data in the whole program (use of singleton for database access)

Related

is there a way of hosting a mysql database using only Qt?

I am trying to make a program that connect many computers into a local MySQL database hosted by a central computer, but the way I found to host a MySQL database is using an External program as Xampp or WampServer. I am Wodering if I can host a MySQL database using only Qt's classes like QTcpServer without the needing of external programs.
No. MySQL needs a MySQL Server process to manage connections, permissions, SQL parsing, storage engines, caching, etc. You can't use a MySQL database without a MySQL Server.
You might like to explore using SQLite, which is a free embedded database that can be used without requiring a separate daemon process. SQLite is a different product than MySQL, so there will be differences in its implementation of some SQL language features. Be sure to study the SQLite documentation: https://sqlite.org/docs.html
I did a quick Google search (my search phrase was "qt with sqlite") and I found numerous blogs and tutorials about how to use SQLite in an application with Qt. Here's just the first result, but there are others: https://katecpp.github.io/sqlite-with-qt/

How can I make a SQL application work offline?

I'm making a c++/Qt application. It connects to a small online database to find different information. I need to make sure that the application works offline. So I would like to do the following
On start up of application:
- Check if internet connection is available
- if available connect to online database, download database to local (for next time no internet is available)
- if not available connect to the kocally stored version of the database
My problem is I can't find a simple solution how to "download" the database. The user will not update the database, so there is no need for syncing when online again, just the ability to download the newest version of the database, whenever online. It is a MS SQL server that the application uses.
My only idea for a solution is to have an SQLite db in the application, and then write a script that clears the SQLite database and then puts everything from the online server into it, but this requires that I write a script that goes through all of the databse. There must be a better solution. I'm also not sure how this solution should work if the database structure changes. A solution for this could just be to send out a update for the application if the structure changes with a new SQLite db with the new structure.
I tried searching for a solution, but I could not find anything that are simple. Since I don't neew syncing back and forth, I thought there must be a simple solution. Any help pointing me in the right direction is appreciated.

C++: How to reuse Encrypted Sqlite database in MFC application which is already in iOS

I am in the middle of one project where I want to reuse SQLite database of iOS application in my MFC\C++ application.
The iOS database is encrypted using 'sqlite3_key()' and it is using SQLCipher for database handling.
And
I am using SQLiteEncrypt for databse handling with the help of CppSQLite3 Wrapper.
But when I am trying to execute any statement on database it throws and exception File is encrypted or not a database .
I not getting any lead on this.
Can any one help me out on this?
I know its duplicate of the following question but that questions are Inactive and I am not able to get any answer from that question.
1.How to use SQLite database from one platform(iOS) to another(Windows)
2.How to open and read SQLite database from another platform like (iOS to Windows)
Please Help me out on this.
SQLite provides common interface for encryption, but the implementation of the encryption engine is delivered by individual vendors.
Encryption engines on the market are not compatible, you have to use the one that was used to encrypt the database.

How to profile embed firebird database

Did I make wrong to use firebird database I don't know. It has lot's of good futures but I can't figure out why my query (stored procedure) didn't work.
Is there any profiler/monitoring tool for firebird?
Firebird database is working stand alone so it is embeded db. And It doesn't allow to connect with 2 users. If there is a profiler I wonder how it will connect while I'm executing my queries.
IBExpert and Database Worbench have stored procedure debugger
There is also many monitoring tools http://www.firebirdfaq.org/faq95/
I advice you to install server version if you want to have more than 2 users

MS Access backend for django

I've been working on a modification of the django-pyodbc package so that it could be used with MS Access.
I need this for a legacy database we are tied to at my organization, and have been doing a rather hacky job specific to my situation, but have also been making useful, generalizable progress in terms of adapting SQL syntax for MS Access.
My question is, is this a project that anyone else in the world is interested in? should I clean up my code and try to fully generalize it, or is everyone else in the world able to solve their MS Access problems by moving to SQL server?
I would move the data to SQL Server if that is an option.
If moving the data is not an option and if my Django app is already connecting to SQL Server, I might just create a linked server on SQL Server and go through SQL Server instead.