Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

SQLite ¼ò½é

SQLite ÊÇÒ»¸öʵÏÖÁËÍ걸µÄ£¨self-contained)£¬¿ÉǶÈëµÄ(embeddable)£¬ÁãÅäÖÃ(zero-configuration)µÄSQLÊý¾Ý¿âÒýÇæµÄСÐ͵ÄCº¯Êý¿â¡£Ëü°üº¬ÒÔϵÄÌص㣺
.
    ÊÂÎñ´¦ÀíÔ­×Ó»¯(atomic)£¬Ò»Ö»¯(consistent)£¬³Ö¾Ã»¯(isolated)£¬¾øÔµ»¯(durable)£¬¼´Ê¹ÊÇÔÚϵͳ±ÀÀ£ºÍµôµçʱ
    ÁãÅäÖ㬲»ÐèÒªÉèÖûòÕß¹ÜÀí
    ʵÏÖÁËSQL92µÄ´ó²¿·Ý±ê×¼ £¨²»Ö§³ÖÌØÐÔ£©
    Õû¸öµÄÊý¾Ý¿â±»´¢´æÔÚµ¥¸öµÄ´ÅÅÌÎļþÉÏ
    Êý¾Ý¿âÎļþÄܹ»±»²»Í¬×Ö½ÚÐòµÄ»úÆ÷Ëù¹²ÓÃ
    Ö§³ÖT×Ö½ÚºÍG×Ö½Ú´óСµÄ×Ö·û´®ºÍ¿é(blob)
    СÐ͵ĴúÂëºÛ¼£(small code footprint)£¬ÍêÈ«ÅäÖúõÄСÓÚ250kiB£¬Ê¡ÂÔµôһЩ¿ÉÑ¡ÓõÄÌØÐԵĽ«Ð¡ÓÚ150KiB
    ´ó²¿·ÖµÄÒ»°ã²Ù×÷±ÈÁ÷ÐеÄC/SÊý¾Ý¿âÒª¿ì
    ¼òµ¥ÈÝÒ×ʹÓõÄAPI¡£
    °üº¬ÁËTCLµÄ°ó¶¨£¬ÒÔ¼°ÆäËû¸÷ÖÖ²»Í¬µÄ¿ÉÓÃÓïÑԵİ󶨡£
    ´úÂëÓÐÁ¼ºÃµÄ×¢ÊÍ£¬²âÊÔ¸²¸ÇÂʳ¬¹ý98£¥
    Äܹ»ÒÔµ¥¸ö¼òµ¥ANSI£­CµÄÔ´ÎļþµÄÐÎʽÇáÒ׵IJåÈëµ½ÁíÒ»¸ö¹¤³ÌÖÐ
    Í걸ÐÔ£¬Ã»ÓжîÍâµÄÒÀÀµ¹Øϵ¡£
    Ô´´úÂëÊǹ«¹²µÄ£¬ÓÃ;¹ã·º
SQLiteµÄ·¢ÐаæÖаüº¬ÁËÒ»¸ö¶ÀÁ¢µÄÃüÁîÐÐÈë¿Ú³ÌÐò£¨sqlite£©£¬Ëû¿ÉÒÔÓÃÀ´¹ÜÀíSQLiteÊý¾Ý¿â£¬²¢ÇÒÒ²¿ÉÒÔ×÷Ϊһ¸öʹÓÃSQLiteº¯Êý¿âµÄÒ»¸öÀý×Ó¡£
ÔÚ¹Ù·½ÍøÕ¾ÉÏÌṩÁË¿ìËÙÈëÃŽ̳̣¬Ò»°ãµÄÔÚlinuxÏÂÓÐC±à³ÌµÄÈË»ù±¾É϶¼ÄÜÁ˽⣬ֻÊǸоõÓеãǷȱ¡£
´´½¨database
$sqlite3 test.db
¾Í¿ÉÒÔ´´½¨ÄãËùÒªµÄdatabaseÁË£¬Äã¿ÉÒÔÔÚsqllite3ÖеÄÃüÁîÐеÄÌáʾ·ûºóÖÐÓÃsqlÓïÑÔ´´½¨Ìí¼Ó×Ô¼ºµÄ±íºÍÊý¾Ý£¬µ±È»ÄãÒ²¿ÉÒÔʹÓÃËûÌṩµÄCµÄapiÀ´×öÀàËƵÄÊ¡£
ÏÂÃæµÄ³ÌÐòÊǹÙÍøÉϵÄÒ»¸öʵÀý,Ö÷ÒªµÄ¹¦ÄÜÊÇ»ù±¾µÄʵÏÖÁËÒ»¸öÀàËÆÓësqlite3ÃüÁîµÄ³ÌÐò
test.c
#include <stdio.h>
#include <sqlite3.h>
static int callback(void *NotUsed, int argc, 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;
 
 


Ïà¹ØÎĵµ£º

Sqlite DateTime ÀàÐÍ ¶ÁÈ¡ºÍдÈë¸ñʽעÒâµÄÎÊÌâ

±¾ÎÄתÔØ×Ô http://www.tntserver.cn/article.asp?id=41
½ñÌìÓöµ½¸öÎÊÌâ.
Ê×ÏȲåÈëÒ»¸öDataTime¸ñʽµÄÊý¾Ý:
string sql="insert into [table] (date_time) values('" + date_time.ToString() + "'";
Ö´ÐÐÈçÉÏÃüÁî.²åÈëûÓб¨¸æ´íÎó.
µ«ÊÇ,ÎÒÓÖÓÃÒ»ÌõÃüÁî¶Áȡʱ:
string sql="select * from [table];
.....
IDataRea ......

SQLITEÓëACCESSÐÔÄܼòµ¥²âÊÔ¶Ô±È

Õâ¶Îʱ¼äÔÚ×öCMS£¨¿Í»§¹ÜÀíϵͳ£¬²»ÊÇÄÚÈݹÜÀí£©µÄ·ÃÎʹÜÀí¹¦ÄÜ£¬ÒªÇóʵÏÖ¶Ô·þÎñÌṩÉ豸£¬¿Í»§¶Ë£¬¼Æ·Ñ£¬È¨ÏÞÈÏÖ¤µÈÐÅÏ¢µÄ´æ´¢Í³¼Æ£¬Ô¶³Ì¹ÜÀí¡£ÒªÇóϵͳ·¢²¼Òª·½±ã£¬Ô¶³Ì¹ÜÀíÈí¼þÒªÅÜÔÚWINƽ̨¡£¿¼Âǵ½ÏµÍ³¹æÄ££¬¿Í»§ÒªÇó£¬×îºóÑ¡ÔñÁËWIN+ACCESSµÄ·½°¸£¬¶ø×î½üÓÖ·¢ÏÖÒ»¸öÃâ·ÑµÄSQLITE£¬¶øÇÒ¿ÉÄÜÔÚÒÔºóµÄÊÖ³ÖÉ豸ÉÏÓ㬻¨µã ......

SQLITEÈëÃÅ Öð²½½²½âSQLITEÃüÁîÐÐ(ËÄ)

.dump ?TABLE? ... ÒÔSQLÓï¾ä·½Ê½ÏÔʾ±íµÄ½á¹¹¡£È磺
sqlite> .dump websties
BEGIN TRANSACTION;
COMMIT;
sqlite> .dump websites
BEGIN TRANSACTION;
CREATE TABLE [websites] (
[WebID] INTEGER NOT NULL PRIMARY KEY,
[WebName] VARCHAR(20) NULL
);
INSERT INTO "websites" VALUES(1,'CTOChina.net'); ......

SQLiteÊý¾ÝÀàÐÍ

Ò»°ãÊý¾Ý²ÉÓõĹ̶¨µÄ¾²Ì¬Êý¾ÝÀàÐÍ£¬¶øSQLite²ÉÓõÄÊǶ¯Ì¬Êý¾ÝÀàÐÍ£¬»á¸ù¾Ý´æÈëÖµ×Ô¶¯Åжϡ£SQLite¾ßÓÐÒÔÏÂÎåÖÖÊý¾ÝÀàÐÍ£º
1.NULL£º¿ÕÖµ¡£
2.INTEGER£º´ø·ûºÅµÄÕûÐÍ£¬¾ßÌåÈ¡¾öÓдæÈëÊý×ֵķ¶Î§´óС¡£
3.REAL£º¸¡µãÊý×Ö£¬´æ´¢Îª8-byte IEEE¸¡µãÊý¡£
4.TEXT£º×Ö·û´®Îı¾¡£
5.BLOB£º¶þ½øÖƶÔÏó¡£
ת×Ô£ºhttp://www.cnblo ......

SQLiteÔÚVCϵÄʹÓÃ

Ò»¡¢SQLite¼ò½é
SQLite ÊÇÓÃCÓïÑÔ±àдµÄ¿ªÔ´Êý¾Ý¿â£¬Ö÷ÒªÓÃÓÚǶÈëʽ£¬ÄãÒ²¿ÉÒÔ°ÑËü¼¯³ÉÔÚ×Ô¼ºµÄ×ÀÃæ³ÌÐòÖУ¬Ò²ÓÐÈ˽«ÆäÌæ´úAccess£¬ÓÃ×÷ºǫ́Êý¾Ý¿â¡£
SQLite Ö§³Ö¶àÊýSQL92±ê×¼£¬ÀýÈ磺Ë÷Òý¡¢ÏÞÖÆ¡¢´¥·¢ºÍ²é¿´Ö§³Ö¡£
Ö§³Ö NULL¡¢INTEGER¡¢REAL¡¢TEXT ºÍ BLOB Êý¾ÝÀàÐÍ£¬Ö§³ÖÊÂÎñ¡£
¶þ¡¢ÏÂÔØSQLite
SQLite¿ÉÒÔµ½¹Ù·½Õ¾µ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ