版本:sqlite-3.6.17.tar.gz
1.解压进入目录,先编译X86平台的
2.创建一个数据库目录,生产Makefile文件
root@wxq:sqlite-3.6.17# mkdir /home/wxq/sqlite_x86
root@wxq:sqlite-3.6.17# ./configure --prefix=/home/wxq/sqlite_x86
root@wxq:sqlite-3.6.17# make
root@wxq:sqlite-3.6.17# make install
root@wxq:sqlite-3.6.17# ls /home/wxq/sqlite_x86/
bin include lib
3.创建数据test.db和一些基本操作
root@wxq:sqlite_x86# cd bin
root@wxq:bin# ls
sqlite3
root@wxq:bin# ./sqlite3 test.db
SQLite version 3.6.17
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table student(id, name, sex, age);
sqlite> insert into student values(1, 'Jack', 'M', 20);
sqlite> insert into student values(2, 'Tom', 'M', 21);
sqlite> insert into student values(3, 'Marry', 'F', 20);
sqlite> select * from student;
1|Jack|M|20
2|Tom|M|21
3|Marry|F|20
sqlite> update student set age = 24 where age = 20;
sqlite> select * from student;
1|Jack|M|24
2|Tom|M|21
3|Marry|F|24
sqlite> .quit
4.移植到Tiny6410开发板,检查步骤和X86平台一样
root@wxq:sqlite-3.6.17# ./configure --prefix=/home/wxq/sqlite_arm --disable-tcl --host=arm-linux
root@wxq:sqlite-3.6.17# make
root@wxq:sqlite-3.6.17# make install
5.用C语言接口操作数据库,程序编译如下
root@wxq:sqlite-3.6.17# arm-linux-gcc -o test -l/home/wxq/sqlite_arm/include -L/home/wxq/sqlite_arm/lib test.c -lsqlite3 -static -lpthread