A thought of qt+sqlite data encryption (in-memory database)

Source: Internet
Author: User
Tags sqlite database

It's early to know about QT, but I haven't had the patience to do an exercise. Recently spent almost two weeks to do a QT development exercise, basically complete the introduction of QT, escaped the Microsoft platform and took a few small steps. Although QT is a C + +, but the development of the application is more convenient, I think it in the interface design, message delivery, more than Delphi, and even in some aspects better than. NET WinForm. The threshold for getting started is the relatively small number of Chinese data on Qt, the cost of finding a solution to a problem is high and requires great patience.

When you study QT, consider a question-how does the data do a certain degree of secrecy and make it easy to query the data? The first thought is to use a database, and the database needs to have a dedicated database server support, such as Oracle, MySQL, SQL Server, there is no need to support database server database? Nature will also think of access, SQLite and so on. Access encryption is not the same, SQLite to support encryption needs to modify and recompile its source code or purchase advanced version of SQLite.

When I open the QT-brought demo about database operations, I accidentally see two lines of code:

[Code:c#]

Qsqldatabase db = Qsqldatabase::adddatabase ("Qsqlite");
Db.setdatabasename (": Memory:");

[/code]

Using the SQLite database mentioned above, and the path of this database is not like the path of the local file. After checking, this setting can create a SQLite database directly in memory. In this way, the data can be achieved without landing. A data storage scheme with a certain secrecy and a database query performance, without the need for database server support. Probably the idea is this:

1. Attach the data file in the text format to the resource file, and if you are concerned about security, you can encrypt the data file.
2. Create the SQLite database in memory at the first start of the program and insert the data into the library.

After this, when the data need to query, sorting operations can be easily implemented through the database function, while ensuring that the database does not fall, the data is relatively safe. The only cost to pay is to insert data into an instant-created database every time the program starts, and for cases where the number of data and the single-pen data are small, and the query performance requirements are high.

Http://wangxianyuan.com/post/qt-memory-sqlite-solution

A thought of qt+sqlite data encryption (in-memory database)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.