Sqlite DB
Ç°Ò»Õó×Ö×öÏîÄ¿(ǶÈëʽlinux)£¬ÓÉÓÚÒª±£´æ´óÁ¿µÄÊý¾Ý£¬¶øÇÒ×Ҫ±£´æ30ÌìµÄʱ¼ä¡£±¾À´´òËã±£´æµ½ÎļþÖУ¬Ã¿´ÎÆô¶¯Ó¦ÓóÌÐòµÄʱºòÖØнâÎöÒ»±é£¬¿ÉÊǵ±Êý¾ÝÁ¿ºÜ´óµÄʱºò£¬¾Í³öÏÖЧÂʵÄÎÊÌâÁË¡£ËùÒÔ×îºó»¹ÊÇ·ÅÆúÁËʹÓÃÎļþµÄ´òË㣬¾ö¶¨Ê¹ÓÃÊý¾Ý¿â´æÈ¡Êý¾Ý¡£
linuxϵÄÊý¾Ý¿âÒ²ºÜ¶à£¬ÓпªÔ´µÄ£¬Ò²ÓÐÊշѵġ£¶ÔÓÚÎÒÃÇÀ´Ëµ£¬¿Ï¶¨ÒªÊ¹ÓÿªÔ´µÄÊý¾Ý¿â¡£ÒÔÇ°ÓùýBerkely DB£¬µ«ÊÇÐèÒªlicience¡£ËùÒÔ½áºÏЧÂÊÐÔÄÜÒÔ¼°´óСÏÞÖÆ£¬×îÖÕÑ¡¶¨ÁËSqlite DB¡£ÎÒÃǶÔËüµÄÆÀ¼ÛÊÇ“sqliteÊÇÒ»¸öÓÅÐãµÄÍêÈ«freeµÄ¿ªÔ´Êý¾ÝÏîÄ¿”¡£
ÏÂÃæÊÇÒ»¸ö¼òµ¥µÄʹÓÃʵÀý£º
int main( int argc, char **argv )
{
sqlite3 *db;
sqlite3_stmt * stmt;
const char *zTail;
//´ò¿ªÊý¾Ý¿â
int r = sqlite3_open("mysqlite.db",&db)
if(r){
printf("%s",sqlite3_errmsg(db));
}
//´´½¨Table
sqlite3_prepare(db,
"CREATE TABLE players ( ID INTEGER PRIMARY KEY, name TEXT, age INTERER );",
-1,&stmt,&zTail);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
//²åÈëÊý¾Ý
sqlite3_prepare(db,
"INSERT INTO players (name,num) VALUES(?,?);",
&nbs
Ïà¹ØÎĵµ£º
SQLite
µÄ×îа汾¿ÉÒÔ´ÓÕâÀïÏÂÔØ
¡£ÏÂÃæÎÒÃÇÒÔWindows°æ±¾sqlite-3_5_1.zip
ΪÀý½éÉÜÆä°²×°·½·¨¡£
£¨´ó¼Ò¿ÉÒÔÑ¡ÔñÏÂÔØ°²×°ÊʺÏ×Ô¼ºµÄ°æ±¾£©
ÏÂÔغ󣬽«sqlite-3_5_1.zip½âѹËõÖÁC:\sqliteĿ¼¼´Íê³É°²×°¡£
C:\sqliteĿ¼¹¹ÔìΪ£º
C:\sqlite
|
+--sqlite3.exe
´ò¿ªÒ»¸öCMDÃüÁî´°¿Ú
C:\ ......
@ǶÈëʽ¹ØϵÐÍÊý¾Ý¿âSQLite
Ìصã
1.Ö§³ÖÎåÖÖÊý¾ÝÀàÐÍ null,INTEGER,REAL(¸¡µãÊý),TEXT(×Ö·û´®Îı¾)ºÍBLOB£¨¶þ½øÖÆÎı¾£©Êý¾ÝÀàÐÍ£¬ËäÈ»
ËüÖ»ÓÐÎåÖÖ£¬µ«Êµ¼ÊÉÏsqlite3Ò²½ÓÊÖvarcher(n),char(n),decimal(p,s)µÈÊý¾ÝÀàÐÍ£ ......
½ñÌìºÜ×ÔÈ»µÄÔÚдSqlÓï¾äµÄʱºòÓÃÁËTop£¬Ò»¿ªÊ¼Ã»·¢ÏÖÎÊÌ⣬ÒòΪÎÒ´ÓÊý¾Ý¿â¶Á³öµÄÖµÕýºÃÊÇ0£¬¶øÎÒÏ°¹ß±äÁ¿¶¨ÒåµÄʱºòÒ²¶¼¸³Öµ0£¬¿ÉÊǵ½ÎÒ²»Òª0µÄʱºòÎҾͷ¢ÏÖÎÊÌâÁË¡£ºóÀ´²ÅÖªµÀ£¬¿É°®µÄСsqlite¾¹È»Óв»Ö§³ÖµÄsqlÓï·¨¡£
¡¡¡¡¿´µ½Ä³¸öÂÛ̳ÓиöÐÂÊÖÒ²·¢ÏÖÁËÕâ¸öÎÊÌâ²¢·¢ÌûÁË£¬ÏÂÃæһţÈ˵Ļظ´ÊÇ“topÊÇÄļҵĹؼü´Ê?s ......
ÎÒÏÖÔÚҪʹÓÃSQLite3.0´´½¨Ò»¸öÊý¾Ý¿â£¬È»ºóÔÚÊý¾Ý¿âÖд´½¨Ò»¸ö±í¸ñ¡£
Ê×ÏÈÒªÒýÈëSQLite3.0µÄlib¿â¡£È»ºó°üº¬Í·Îļþ#import <sqlite3.h>
¡¾1¡¿´ò¿ªÊý¾Ý¿â£¬Èç¹ûûÓУ¬ÄÇô´´½¨Ò»¸ö
sqlite3* database_;
-(BOOL) open{
NSArray *paths = NSSearchPathForDirectoriesInDomai ......