Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the method of porting and using Sqlite3 in QT system

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "what is the method of transplanting and using Sqlite3 of QT system". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "what is the method of transplanting and using QT system Sqlite3?"

We download the latest version (version 3.32.3) directly, and we put the downloaded package under the document directory:

1 decompress the downloaded package sqlite-autoconf-3320300.tar.gz and create an installation directory mkdir install, as shown below:

2 enter the decompressed catalogue and configure the compilation option:. / configure-- host=arm-none-linux-gnueabi

-- prefix=/home/topeet/iMX6Q/sqlite3/install/.

-- host: specifies the cross-compilation tool, which is the same as the compiler that compiled Linux.

-- prefix: specify the installation directory, where the compiled files are placed, and must be an absolute path.

3 execute make, as shown in the following figure:

3 execute make, as shown in the following figure:

5 check to see if the required files are generated in the install directory.

6 copy the library files under the lib directory to the / lib/ directory of the development board, and copy the sqlite3 under the bin directory to the / bin/ directory of the development board.

7 enter sqlite3 on the terminal command line of the development board, and you will enter the following figure:

8 Test:

1 create a new table and enter create table user (id int,name char,age int); then query the table and enter .table to find the newly created user table, as shown in figure 83.9:

2 create a .db file

Enter sqlite3 / path / filename. Be sure to enter .resume after the db operation.

(3) write C code test:

Now the database creates the table and inserts the data:

Create table demo (id int,name char,age int)

Insert into demo values (100th century WangWuqiang 23)

Insert into demo values (101 and tommm. 25)

Select * from demo

The C code is as follows. For more information, please see the demo source code in the directory.

Enter the following command to cross-compile: arm-none-linux-gnueabi-gcc-I/home/topeet/iMX6Q/sqlite3/install/include/-L / home/topeet/iMX6Q/sqlite3/install/lib/-o sql

TestSql.c-lsqlite3-ldl

-I specifies the path where the sqlite3.h is located

-L specifies the lib library path for sqlite3.

Copy the generated executable file sql to the root directory of the development board

After execution, you can see the query results:

At this point, I believe that everyone on the "QT system Sqlite3 migration and use of what is" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report