SQLite3 移植到 ARM
来源:互联网 发布:淘宝网游交易 编辑:程序博客网 时间:2024/05/21 15:39
<!-- /* Font Definitions */ @font-face{font-family:宋体;panose-1:2 1 6 0 3 1 1 1 1 1;mso-font-alt:SimSun;mso-font-charset:134;mso-generic-font-family:auto;mso-font-pitch:variable;mso-font-signature:3 135135232 16 0 262145 0;}@font-face{font-family:Verdana;panose-1:2 11 6 4 3 5 4 4 2 4;mso-font-charset:0;mso-generic-font-family:swiss;mso-font-pitch:variable;mso-font-signature:536871559 0 0 0 415 0;}@font-face{font-family:Fixedsys;panose-1:0 0 0 0 0 0 0 0 0 0;mso-font-alt:方正舒体;mso-font-charset:134;mso-generic-font-family:auto;mso-font-format:other;mso-font-pitch:fixed;mso-font-signature:1 135135232 16 0 262144 0;}@font-face{font-family:"/@宋体";panose-1:2 1 6 0 3 1 1 1 1 1;mso-font-charset:134;mso-generic-font-family:auto;mso-font-pitch:variable;mso-font-signature:3 135135232 16 0 262145 0;}@font-face{font-family:"DejaVu Sans";mso-font-alt:"MS Gothic";mso-font-charset:128;mso-generic-font-family:auto;mso-font-pitch:variable;mso-font-signature:0 0 0 0 0 0;}@font-face{font-family:OpenSymbol;mso-font-alt:"MS Gothic";mso-font-charset:128;mso-generic-font-family:auto;mso-font-pitch:auto;mso-font-signature:0 0 0 0 0 0;}@font-face{font-family:"/@DejaVu Sans";mso-font-charset:128;mso-generic-font-family:auto;mso-font-pitch:variable;mso-font-signature:0 0 0 0 0 0;}@font-face{font-family:"/@Fixedsys";panose-1:0 0 0 0 0 0 0 0 0 0;mso-font-charset:134;mso-generic-font-family:auto;mso-font-format:other;mso-font-pitch:fixed;mso-font-signature:1 135135232 16 0 262144 0;}@font-face{font-family:"/@OpenSymbol";mso-font-charset:128;mso-generic-font-family:auto;mso-font-pitch:auto;mso-font-signature:0 0 0 0 0 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal{mso-style-parent:"";margin:0cm;margin-bottom:.0001pt;mso-pagination:none;mso-hyphenate:none;font-size:12.0pt;font-family:"Times New Roman";mso-fareast-font-family:"DejaVu Sans";mso-font-kerning:.5pt;mso-fareast-language:#00FF;}h1{mso-style-next:正文文本;margin-top:12.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:21.6pt;text-indent:-21.6pt;mso-pagination:none;page-break-after:avoid;mso-outline-level:1;mso-list:l0 level1 lfo1;mso-hyphenate:none;tab-stops:list 0cm;font-size:24.0pt;font-family:"Times New Roman";mso-fareast-font-family:"DejaVu Sans";mso-bidi-font-family:"DejaVu Sans";mso-font-kerning:.5pt;mso-fareast-language:#00FF;}p.MsoHeader, li.MsoHeader, div.MsoHeader{margin:0cm;margin-bottom:.0001pt;mso-pagination:no-line-numbers;mso-hyphenate:none;tab-stops:center 249.3pt right 498.6pt;font-size:12.0pt;font-family:"Times New Roman";mso-fareast-font-family:"DejaVu Sans";mso-font-kerning:.5pt;mso-fareast-language:#00FF;}p.MsoBodyText, li.MsoBodyText, div.MsoBodyText{margin-top:0cm;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm;mso-pagination:none;mso-hyphenate:none;font-size:12.0pt;font-family:"Times New Roman";mso-fareast-font-family:"DejaVu Sans";mso-font-kerning:.5pt;mso-fareast-language:#00FF;}a:link, span.MsoHyperlink{mso-style-parent:"";color:navy;mso-ansi-language:#00FF;mso-fareast-language:#00FF;mso-bidi-language:#00FF;text-decoration:underline;text-underline:single;}a:visited, span.MsoHyperlinkFollowed{color:purple;text-decoration:underline;text-underline:single;} /* Page Definitions */ @page{mso-page-border-surround-header:no;mso-page-border-surround-footer:no;}@page Section1{size:612.0pt 792.0pt;margin:2.0cm 2.0cm 2.0cm 2.0cm;mso-header-margin:36.0pt;mso-footer-margin:36.0pt;mso-page-numbers:num-in-dash;mso-paper-source:0;}div.Section1{page:Section1;} /* List Definitions */ @list l0{mso-list-id:1;mso-list-template-ids:1;}@list l0:level1{mso-level-number-format:none;mso-level-suffix:none;mso-level-text:"";mso-level-tab-stop:0cm;mso-level-number-position:left;margin-left:21.6pt;text-indent:-21.6pt;}@list l0:level2{mso-level-number-format:none;mso-level-suffix:none;mso-level-text:"";mso-level-tab-stop:0cm;mso-level-number-position:left;margin-left:28.8pt;text-indent:-28.8pt;}@list l0:level3{mso-level-number-format:none;mso-level-suffix:none;mso-level-text:"";mso-level-tab-stop:0cm;mso-level-number-position:left;margin-left:36.0pt;text-indent:-36.0pt;}@list l0:level4{mso-level-number-format:none;mso-level-suffix:none;mso-level-text:"";mso-level-tab-stop:0cm;mso-level-number-position:left;margin-left:43.2pt;text-indent:-43.2pt;}@list l0:level5{mso-level-number-format:none;mso-level-suffix:none;mso-level-text:"";mso-level-tab-stop:0cm;mso-level-number-position:left;margin-left:50.4pt;text-indent:-50.4pt;}@list l0:level6{mso-level-number-format:none;mso-level-suffix:none;mso-level-text:"";mso-level-tab-stop:0cm;mso-level-number-position:left;margin-left:57.6pt;text-indent:-57.6pt;}@list l0:level7{mso-level-number-format:none;mso-level-suffix:none;mso-level-text:"";mso-level-tab-stop:0cm;mso-level-number-position:left;margin-left:64.8pt;text-indent:-64.8pt;}@list l0:level8{mso-level-number-format:none;mso-level-suffix:none;mso-level-text:"";mso-level-tab-stop:0cm;mso-level-number-position:left;margin-left:72.0pt;text-indent:-72.0pt;}@list l0:level9{mso-level-number-format:none;mso-level-suffix:none;mso-level-text:"";mso-level-tab-stop:0cm;mso-level-number-position:left;margin-left:79.2pt;text-indent:-79.2pt;}@list l1{mso-list-id:2;mso-list-template-ids:2;mso-list-name:WW8Num2;}@list l1:level1{mso-level-number-format:bullet;mso-level-text:;mso-level-tab-stop:35.35pt;mso-level-number-position:left;margin-left:35.35pt;text-indent:-14.15pt;mso-ascii-font-family:Symbol;mso-hansi-font-family:Symbol;mso-bidi-font-family:OpenSymbol;}@list l1:level2{mso-level-number-format:bullet;mso-level-text:;mso-level-tab-stop:70.7pt;mso-level-number-position:left;margin-left:70.7pt;text-indent:-14.15pt;mso-ascii-font-family:Symbol;mso-hansi-font-family:Symbol;mso-bidi-font-family:OpenSymbol;}@list l1:level3{mso-level-number-format:bullet;mso-level-text:;mso-level-tab-stop:106.05pt;mso-level-number-position:left;margin-left:106.05pt;text-indent:-14.15pt;mso-ascii-font-family:Symbol;mso-hansi-font-family:Symbol;mso-bidi-font-family:OpenSymbol;}@list l1:level4{mso-level-number-format:bullet;mso-level-text:;mso-level-tab-stop:141.4pt;mso-level-number-position:left;margin-left:141.4pt;text-indent:-14.15pt;mso-ascii-font-family:Symbol;mso-hansi-font-family:Symbol;mso-bidi-font-family:OpenSymbol;}@list l1:level5{mso-level-number-format:bullet;mso-level-text:;mso-level-tab-stop:176.75pt;mso-level-number-position:left;margin-left:176.75pt;text-indent:-14.15pt;mso-ascii-font-family:Symbol;mso-hansi-font-family:Symbol;mso-bidi-font-family:OpenSymbol;}@list l1:level6{mso-level-number-format:bullet;mso-level-text:;mso-level-tab-stop:212.1pt;mso-level-number-position:left;margin-left:212.1pt;text-indent:-14.15pt;mso-ascii-font-family:Symbol;mso-hansi-font-family:Symbol;mso-bidi-font-family:OpenSymbol;}@list l1:level7{mso-level-number-format:bullet;mso-level-text:;mso-level-tab-stop:247.45pt;mso-level-number-position:left;margin-left:247.45pt;text-indent:-14.15pt;mso-ascii-font-family:Symbol;mso-hansi-font-family:Symbol;mso-bidi-font-family:OpenSymbol;}@list l1:level8{mso-level-number-format:bullet;mso-level-text:;mso-level-tab-stop:282.8pt;mso-level-number-position:left;margin-left:282.8pt;text-indent:-14.15pt;mso-ascii-font-family:Symbol;mso-hansi-font-family:Symbol;mso-bidi-font-family:OpenSymbol;}@list l1:level9{mso-level-number-format:bullet;mso-level-text:;mso-level-tab-stop:318.15pt;mso-level-number-position:left;margin-left:318.15pt;text-indent:-14.15pt;mso-ascii-font-family:Symbol;mso-hansi-font-family:Symbol;mso-bidi-font-family:OpenSymbol;}ol{margin-bottom:0cm;}ul{margin-bottom:0cm;}-->
Tableof Contents
1. SqLite Porting – porting to arm step by step
2. AppendixA – Features Of SQLite
3. AppendixB – SQLite command
1. SqLite Porting
1. Download sqlitesource
URL: http://www.sqlite.org/download.html
Package src: sqlite3-3.6.23.1.bin.gz
Package doc: sqlite_docs_3_6_23.zip
2. Decompressionpackage
$ tar -zxvf sqlite-amalgamation-3.6.23.1.tar.gz
3. Confirm your Crosscompiler is arm-linux-gcc, in my notebook, version is 3.4.5
$ echo $PATH
/crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin:
$ arm-linux-gcc--version
arm-linux-gcc (GCC) 3.4.5
4. Configure
I installed sqlite3 under sqlite_build:
$ mkdirsqlite_build
See more information: ./configure --help
/sqlite-3.6.23.1$ ./configure --host=arm-linux --prefix /
=/home/furtherchan/work/sqlite_porting/sqlite_build
5. make and makeinstall, then you’ll find some files in the sqlite_build dir
(1).view file
furtherchan@further:~/work/sqlite_porting/sqlite_build$ ls
bin include lib share
(2). In embedded system, file size, the smaller the better, using arm-linux-strip to remove symbolsand sections from files.
furtherchan@further:~/work/sqlite_porting/sqlite_build/lib$ arm-linux-strip libsqlite3.so.0.8.6
furtherchan@further:~/work/sqlite_porting/sqlite_build/lib$file libsqlite3.so.0.8.6
libsqlite3.so.0.8.6: ELF 32-bit LSBshared object, ARM, version 1, dynamically linked, stripped
(3).if you don’t have follow symbol link, use “ln -s” command to create it.
furtherchan@further:~/work/sqlite_porting/sqlite_build/lib$ll libsqlite3.so.0
lrwxrwxrwx 1 furtherchan furtherchan 192010-06-22 20:59 libsqlite3.so.0 -> libsqlite3.so.0.8.6
(4). copy /bin/sqlite3 into target board /usr/bin/ directory, /lib/ibsqlite3.so.0.8.6 and libsqlite3.so.0 into /lib directory,
6. Start testing, the follow codes are comefrom: sqlite-3_6_23-docs/quickstart.html
//test.c
#include <stdio.h>
#include <sqlite3.h>
static int callback(void *NotUsed, intargc, char **argv, char**azColName){
int i;
for(i=0; i<argc; i++){
printf("%s = %s/n",azColName[i], argv[i] ? argv[i] : "NULL");
}
printf("/n");
return 0;
}
int main(int argc, char **argv){
sqlite3 *db;
char *zErrMsg = 0;
int rc;
if( argc!=3 ){
fprintf(stderr, "Usage: %s DATABASESQL-STATEMENT/n", argv[0]);
exit(1);
}
rc = sqlite3_open(argv[1], &db);
if( rc ){
fprintf(stderr, "Can't open database:%s/n", sqlite3_errmsg(db));
sqlite3_close(db);
exit(1);
}
rc = sqlite3_exec(db, argv[2], callback, 0, &zErrMsg);
if( rc!=SQLITE_OK ){
fprintf(stderr, "SQL error: %s/n",zErrMsg);
sqlite3_free(zErrMsg);
}
sqlite3_close(db);
return 0;
}
7. Compiling test.c
$arm-linux-gcc -I/home/furtherchan/work/sqlite_porting/sqlite_build//
include-L/home/furtherchan/work/sqlite_porting/sqlite_build/lib -o test test.c-lsqlite3
$file test
test: ELF 32-bit LSB executable, ARM,version 1, dynamically linked (uses shared libs), for GNU/Linux 2.4.3, not stripped
8. Testsqlite3 in target board:
# echo$PATH
/sbin:/usr/sbin:/bin:/usr/bin
# echo$LD_LIBRARY_PATH
/Qtopia/lib:/lib:
# whichsqlite3
/usr/bin/sqlite3
# sqlite3
SQLiteversion 3.6.23.1
Enter".help" for instructions
Enter SQLstatements terminated with a ";"
sqlite>create table gps(pos_x varchar(20), pos_y varchar(20));
sqlite>insert into gps values('123.4', '567.8');
sqlite>select * from gps;
123.4|567.8
sqlite>./test
Usage:./test DATABASE SQL-STATEMENT
2. Appendix A
FeaturesOf SQLite
· Transactions are atomic, consistent, isolated, anddurable (ACID) even after system crashes and power failures.
· Zero-configuration - no setup or administration needed.
· Implements most of SQL92. (Features notsupported)
· A complete database is stored in a singlecross-platform disk file.
· Supports terabyte-sized databases and gigabyte-sized strings andblobs. (See limits.html.)
· Small code footprint: less than 300KiB fully configured or less than 180KiBwith optional features omitted.
· Faster than popular client/server databaseengines for most common operations.
· Simple, easy to use API.
· Written in ANSI-C. TCL bindings included. Bindings for dozens of otherlanguages available separately.
· Well-commented source code with 100% branch test coverage.
· Available as a singleANSI-C source-code file that you can easily drop into another project.
· Self-contained: no external dependencies.
· Cross-platform: Unix (Linux and Mac OS X), OS/2, and Windows(Win32 and WinCE) are supported out of the box. Easy to port to other systems.
· Sources are in the public domain. Use for any purpose.
· Comes with a standalone command-lineinterface (CLI)client that can be used to administer SQLite databases.
3. Appendix B
SQLitecommand: from help
sqlite> .help
.backup ?DB? FILE Backup DB (default "main") toFILE
.bail ON|OFF Stop after hitting an error. Default OFF
.databases List names and files of attacheddatabases
.dump ?TABLE? ... Dump the database in an SQL text format
If TABLE specified,only dump tables matching
LIKE pattern TABLE.
.echo ON|OFF Turn command echo on or off
.exit Exit this program
.explain ?ON|OFF? Turn output mode suitable for EXPLAIN on oroff.
With no args, it turnsEXPLAIN on.
.header(s) ON|OFF Turn display of headers on or off
.help Show this message
.import FILE TABLE Import data from FILE into TABLE
.indices ?TABLE? Show names of all indices
If TABLE specified,only show indices for tables
matching LIKE patternTABLE.
.load FILE ?ENTRY? Load an extension library
.log FILE|off Turn logging on or off. FILE can be stderr/stdout
.mode MODE ?TABLE? Set output mode where MODE is one of:
csv Comma-separated values
column Left-aligned columns. (See .width)
html HTML <table> code
insert SQL insert statements for TABLE
line One value per line
list Values delimited by .separator string
tabs Tab-separated values
tcl TCL list elements
.nullvalue STRING Print STRING in place of NULL values
.output FILENAME Send output to FILENAME
.output stdout Send output to the screen
.prompt MAIN CONTINUE Replace the standard prompts
.quit Exit this program
.read FILENAME Execute SQL in FILENAME
.restore ?DB? FILE Restore content of DB (default"main") from FILE
.schema ?TABLE? Show the CREATE statements
If TABLE specified,only show tables matching
LIKE pattern TABLE.
.separator STRING Change separator used by output mode and.import
.show Show the current values forvarious settings
.tables ?TABLE? List names of tables
If TABLE specified,only list tables matching
LIKE pattern TABLE.
.timeout MS Try opening locked tables for MSmilliseconds
.width NUM1 NUM2 ... Set column widths for "column"mode
.timer ON|OFF Turn the CPU timer measurement on oroff
- SQLite3 移植到 ARM
- sqlite3移植到arm linux
- sqlite3移植到arm-linux
- sqlite3移植到ARM SQLITE3.7.14
- sqlite3.7.3移植到arm问题
- 移植SQLite3到ARM开发板
- SQLite3移植到ARM Linux教程
- sqlite3移植到ARM开发板
- 移植SQLite3到ARM Linux开发板
- sqlite3移植到ARM开发板
- APPWEB + PHP5 + SQLITE3 + MATRIXSSL移植到ARM LINUX
- 移植sqlite3.8到arm开发板过程
- 移植数据库SQLite3到ARM Linux目标板
- linux sqlite3 arm平台移植
- sqlite3小型数据库移植到arm,让arm跑起聊天室的服务器
- Linux应用程序开发(一)---移植thttpd+Sqlite3+PHP5到arm linux(1)
- Linux应用程序开发(一)---移植thttpd+Sqlite3+PHP5到arm linux(2)
- Linux应用程序开发(一)---移植thttpd+Sqlite3+PHP5到arm linux(3)
- 【数码概念验证码识别系统教程】(二)验证码图像下载链接的设置
- 通过对web日志的挖掘来实现内容推荐系统
- 对一主表进行更新从表的值
- Max/Maya输出插件(3DVIA Virtools 5.0)
- HTTP请求流程
- SQLite3 移植到 ARM
- 迷茫
- 相对路径,绝对路径
- Visual C++线程同步技术剖析:临界区,时间,信号量,互斥量
- 【数码概念验证码识别系统教程】(三)使用滤镜处理图片
- 《灵魂的黑夜》笔记
- 你应该了解的13个免费且实用的脚本
- 【数码概念验证码识别系统教程】(四)如何制作字模库?
- SQL Server 2005支持的两条新语法