嵌入式数据库实验.pdfVIP

  • 25
  • 0
  • 约7.34千字
  • 约 6页
  • 2017-05-16 发布于天津
  • 举报
嵌入式数据库实验.pdf

实验十六 嵌入式数据库移植实验 【实验目的】 1、了解嵌入式数据在嵌入式设备中应用 2 、了解SQLite 的移植和编译过程 3、掌握嵌入式数据库的编程方法 【实验原理】 1、SQLite 介绍 SQLite 是 D. Richard Hipp 用 C 语言编写的开源嵌入式数据库引擎。它是完全独立 的,不具有外部依赖性。占用资源非常低,在嵌入式设备中,只需要几百K 的内存就够了。 它能够支持Windows/Linux 等主流操作系统,可与TCL、PHP 、Java 等程序语言相结合,提 供ODBC 接口,其处理速度甚至令开源世界著名的数据库管理系统Mysql 、PostgreSQL 望 尘莫及。 SQLite 对 SQL92 标准的支持包括索引、限制、触发和查看,支持原子的、一致的、 独立和持久(ACID)的事务。在内部,SQLite 由 SQL 编译器、内核、后端以及附件几个组 件组成,如图 16-1所示。SQLite 通过利用虚拟机和虚拟数据库引擎(VDBE),使调试、修 改和扩展 SQLite 的内核变得更加方便。所有SQL语句都被编译成易读的、可以在SQLite 虚 拟机中执行的程序集。 图 16-1 SQLite 的内部结构 2、sqlite的移植 (1)、源代码的下载 从/download.html下载sqlite的源码sqlite-3.3.5.tar.gz,将下载的 代码包解开,将生成sqlite-3.3.5 目录。 (2 )、对配置文件configure的修改 在交叉编译sqlite时,编译工具文件的编译器采用的是gcc,而不是arm-linux-gcc,如果 直接采用./configure --host=arm-linux命令对系统进行编译配置,configure配置文件在检查编 译器时会错,所以应将configure配置文件中的交叉编译的检查语句注释掉,然后再手动增加 编译工具文件的编译器gcc 。 将configure文件中的如下交叉编译器的检查语句注释掉 (前面加#字符): # if test $cross_compiling = yes; then # { { echo $as_me:$LINENO: error: unable to find a compiler for building build tools 5 #echo $as_me: error: unable to find a compiler for building build tools 2;} # { (exit 1); exit 1; }; } # fi #else # test $cross_compiling = yes # { { echo $as_me:$LINENO: error: cannot check for file existence when cross compiling 5 #echo $as_me: error: cannot check for file existence when cross compiling 2;} # { (exit 1); exit 1; }; } #else # test $cross_compiling = yes # { { echo $as_me:$LINENO: error: cannot check for file existence when cross compiling 5 #echo $as_me: error: cannot check for file existence when cross compiling 2;} # { (exit 1); exit 1; }; } 修改完毕后,在源代码目录下执行编译配置命令 [root@localhost sqlite-3.3.5]$./configure --host=arm-linux --disable-tcl (3 )、修改Makefile 文件 将 Makefile 文件中编译工具的编译器修改为 gcc ,即将 Makefile 中的 BCC = arm-linux-gcc -g -O2 修改为BCC = gcc -g -O2 。 (4 )、编译和安装

文档评论(0)

1亿VIP精品文档

相关文档