分类: 嵌入式
2014-04-03 10:13:04
先打开数据库test.db
E:/sqlite/tool/sqlite-3_6_22>sqlite3 D:/Test/debug/test.db
sqlite> .backup D://Test//debug//test.bak
注意:一定要用//双斜杠
先打开数据库test.db
E:/sqlite/tool/sqlite-3_6_22>sqlite3 D:/Test/debug/test.db
sqlite> .restore D://Test//debug//test.bak
注意:一定要用//双斜杠
SQL可以如下写,供参考:
create table if not exists student(id integer primary key autoincrement,/
age smallint ,anchor smallint);
执行 select sqlite_version();命令即可
3.6.22
1.CppSQLite3
2.wxSQLite3
1.先从官网获取sqlite-amalgamation-3_6_22.zip;
2.接着从官网获取sqlitedll-3_6_22.zip
下载编译好的DLL,这里有我们需要的sqlite3.def该文件
3.打开VC新建一个“Win32 Dynamic-Link Library”工程,命名为:sqlite3;
4.在接下来的对话框中选择"An empty DLL project",点 FINISH->OK;
5.将sqlite-amalgamation-3_6_22文件夹下的sqlite3.h以及sqlite3.c两个文件复制到工程文件夹下;
将sqlitedll-3_6_22文件夹下的sqlite3.def该文件复制到工程文件夹下;
6.在工程的Source Files中添加sqlite3.c文件;
7.在工程的Include Files中添加sqlite3.h文件;
8.在工程的Resource Files中添加sqlite3.def文件;
9.针对如下问题:
sqlite3.def : error LNK2001: unresolved external symbol sqlite3_column_database_name
sqlite3.def : error LNK2001: unresolved external symbol sqlite3_column_database_name16
sqlite3.def : error LNK2001: unresolved external symbol sqlite3_column_origin_name
sqlite3.def : error LNK2001: unresolved external symbol sqlite3_column_origin_name16
sqlite3.def : error LNK2001: unresolved external symbol sqlite3_column_table_name
sqlite3.def : error LNK2001: unresolved external symbol sqlite3_column_table_name16
sqlite3.def : error LNK2001: unresolved external symbol sqlite3_table_column_metadata
Debug/sqlite3.lib : fatal error LNK1120: 7 unresolved externals
在菜单【Project】-【Settings…】-【C/C++】标签下的Category【General】下
Preprocessor definitions下:
新增2个编译选项,分别是:
THREADSAFE
SQLITE_ENABLE_COLUMN_METADATA
10.往工程中添加sqlite3.def文件就是为生成sqlite3.lib文件;
sqlite3.lib是与sqlite3.dll动态链接库文件一起提供给软件开发者的;
e:/sqlite/code/sqlite3/sqlite3.c(15385) : warning C4047: 'function' : 'void ** ' differs in levels of indirection from 'long *'
e:/sqlite/code/sqlite3/sqlite3.c(15385) : warning C4022: 'InterlockedCompareExchange' : pointer mismatch for actual parameter 1
e:/sqlite/code/sqlite3/sqlite3.c(15385) : warning C4022: 'InterlockedCompareExchange' : pointer mismatch for actual parameter 2
e:/sqlite/code/sqlite3/sqlite3.c(15403) : warning C4047: 'function' : 'void ** ' differs in levels of indirection from 'long *'
e:/sqlite/code/sqlite3/sqlite3.c(15403) : warning C4022: 'InterlockedCompareExchange' : pointer mismatch for actual parameter 1
e:/sqlite/code/sqlite3/sqlite3.c(15403) : warning C4022: 'InterlockedCompareExchange' : pointer mismatch for actual parameter 3
e:/sqlite/code/sqlite3/sqlite3.c(15403) : warning C4047: '==' : 'void *' differs in levels of indirection from 'const int '
e:/sqlite/code/sqlite3/sqlite3.c(65536) : warning C4049: compiler limit : terminating line number emission
warning C4761: integral size mismatch in argument; conversion supplied
warning C4761: integral size mismatch in argument; conversion supplied
warning C4761: integral size mismatch in argument; conversion supplied