SQLite Êý¾Ý¿â¼ÓÃܵÄÒ»ÖÖ½â¾ö·½°¸
sqlite3 *db;
sqlite3_stmt *stat;
char
*zErrMsg = 0;
char
temp[256], FileRoot[256];
char
buffer2[1024]="0";
sprintf(temp, _T("%s"), _T("utf.db"));
CCodingConv::GB2312_2_UTF8(FileRoot, 256, temp, 0);
sqlite3_open(FileRoot, &db);
if
(db == NULL)
{
return
-1;
}
sqlite3_key(db,"1q2w3e4r",8);
sqlite3_exec(db, "CREATE TABLE list (fliename varchar(128) UNIQUE, fzip text);", 0, 0, &zErrMsg);
sqlite3_prepare(db, "insert into list values ('
ÖÐÎÄGB2312
±àÂë',?);", -1, &stat, 0);
strcpy(temp, "
²âÊÔÊý¾ÝUTF-8
µÄÖ§³ÖÇé¿ö");
int
len = (int
)strlen(temp);
sqlite3_bind_text(stat, 1, temp, len, NULL);
sqlite3_step(stat);
sqlite3_prepare(db, "select * from list;", -1, &stat, 0);
sqlite3_step(stat);
const
unsigned
char
* test = sqlite3_column_text(stat, 1);
int
size = sqlite3_column_bytes(stat, 1);
printf("%s", test);
sqlite3_finalize(stat);
//sqlite3_rekey(db,"",0);
sqlite3_close(db);
(vc2003)http://www.sqlite.com.cn/Upfiles/source/sqlite3crypt.rar
(vs2005)http://www.sqlite.com.cn/Upfiles/source/sqlite3_3_7_key.rar
Ïà¹ØÎĵµ£º
¸ã¶¨ÁËÒ»¸öÀ§ÈÅÐí¾ÃµÄÎÊÌ⣬ÔÀ´sqliteÖеÄÖ÷¼üÒ²ÊÇ¿ÉÒÔÉèÖÃΪ×ÔÔöµÄ£º£©·½·¨¾ÍÊÇÉùÃ÷Ϊ INTEGER PRIMARY KEY µÄ×ֶοÉÒÔ×Ô¶¯Ôö¼Ó¡£
ÍøÉϲ鵽×ÊÁÏ˵£¬´Ó SQLite µÄ 2.3.4 °æ±¾¿ªÊ¼£¬Èç¹û½«Ò»¸ö±íÖеÄÒ»¸ö×Ö¶ÎÉùÃ÷Ϊ INTEGER PRIMARY KEY£¬ÄÇôֻÐèÏò¸Ã±íµÄ¸Ã×ֶβåÈëÒ»¸ö NULL Öµ£¬ ......
ÔÚSQLÖÐÓÐÈçÏÂÁ½ÖÖ·½·¨¿ÉÒÔʵÏÖ½«Ò»¸ö±íÖÐÊý¾Ýµ½ÁíÒ»¸ö±íÖÐ
1> select ... into new_tablename from ... where ...
2> insert (into) old_tablename select ... from ... where ...
Çø±ðÊÇÇ°Õß°ÑÊý¾Ý²åÈëÒ»¸öÐÂ±í£¨ÏȽ¨Á¢±í£¬ÔÙ²åÈëÊý¾Ý£©£¬
ºóÕßÊÇ°ÑÊý¾Ý²åÈëÒѾ´æÔÚµÄÒ»¸ö±íÖУ¬ÎÒ¸öÈËϲ»¶ºóÕߣ¬Òò ......
Ò»¡¢SQLite¼ò½é
SQLite ÊÇÓÃCÓïÑÔ±àдµÄ¿ªÔ´Êý¾Ý¿â£¬Ö÷ÒªÓÃÓÚǶÈëʽ£¬ÄãÒ²¿ÉÒÔ°ÑËü¼¯³ÉÔÚ×Ô¼ºµÄ×ÀÃæ³ÌÐòÖУ¬Ò²ÓÐÈ˽«ÆäÌæ´úAccess£¬ÓÃ×÷ºǫ́Êý¾Ý¿â¡£
SQLite Ö§³Ö¶àÊýSQL92±ê×¼£¬ÀýÈ磺Ë÷Òý¡¢ÏÞÖÆ¡¢´¥·¢ºÍ²é¿´Ö§³Ö¡£
Ö§³Ö NULL¡¢INTEGER¡¢REAL¡¢TEXT ºÍ BLOB Êý¾ÝÀàÐÍ£¬Ö§³ÖÊÂÎñ¡£
¶þ¡¢ÏÂÔØSQLite
SQLite¿ÉÒÔµ½¹Ù·½Õ¾µ ......
½üÀ´ÒòΪ¹¤×÷ÐèÒª¼ÓÈësqlite ´¦ÀíÊý¾Ý£¬ÏÂÔØÁËsqlite3.6.22(amalgamation °æ±¾£©£¬ÓÖÏë×Ô¼º¶¯ÊÖ±àÒë³öÀ´Ï붯̬Á´½Ó¾Í¶¯Ì¬£¬Ï뾲̬Á´½ÓÒ²¿ÉÒÔ£¬ÓÚÊÇÓÐÁËÕâƪÎÄÕ£¬ÓÐÒâ˼µÄÊÇ֮ǰҲÊÔ¹ý±àÒëSqlite£¬µ«Ã»³É¹¦£¬²»ÁËÁËÖ®£¬¿ÉÄܽüÀ´Òª¹ýÄêÁË
¸ú
RPÓйذÉ:)¡£
1 Ê×ÏÈ´´½¨vs2008µÄÒ»¸ö¿ÕDLL¹¤³Ì;
2 ......
»¹Êdzõ̽£¬×öµÄÏîÄ¿ÒªÓõ½ÇáÇɵı¾µØÊý¾Ý¿â£¬ÓÚÊÇÕÒÁË sqlite 3 ÊÔÓÃÖ®£¬»¹²»´í£¬¹»ÇáÇÉ¡£
ÉÏÕâ¶ùÈ¥ÏÂÔسÌÐòºÍ²é¿´Îĵµ£º http://www.sqlite.org/download.html
Õâ»Ø¿ª·¢ÓõÄÊÇ C#£¬ÓÚÊÇÕÒÁ˸ö.NETµÄ¿â Finisar.SQLite £¬µ½Õâ¶ùÈ¥ÔØ http://adodotnetsqlite.sourceforge.net/
Òª¼ÇµÄÒ²²»ÊÇʲô´ó²»Á˵Ķ«Î÷£¬Ê¾ÀýÍøÕ¾É϶ ......