windowsÏÂsqlite°²×°Ê¹ÓúÍÐÔÄÜÓÅ»¯¼°ÉèÖÃ
ÔÎÄÁ´½Ó£ºhttp://edu.codepub.com/2008/1231/805.php
windowsÏÂsqlite°²×°Ê¹ÓúÍÐÔÄÜÓÅ»¯¼°ÉèÖÃ
sqliteÊÇǶÈëʽSQLÊý¾Ý¿âÒýÇæSQLite£¨SQLite Embeddable SQL Database Engine£©µÄÒ»¸öÀ©Õ¹¡£SQLiteÊÇÒ»¸öʵÏÖǶÈëʽSQLÊý¾Ý¿âÒýÇæСÐÍCÓïÑԿ⣨C library£©£¬ÊµÏÖÁ˶ÀÁ¢µÄ£¬¿ÉǶÈëµÄ£¬ÁãÅäÖõÄSQLÊý¾Ý¿âÒýÇæ¡£ÌØÐÔ°üÀ¨£ºÊÂÎñ²Ù×÷ÊÇÔ×Ó£¬Ò»Ö£¬¹ÂÁ¢£¬²¢Çҳ־õģ¬¼´Ê¹ÔÚϵͳ±ÀÀ£ºÍµçÔ´¹ÊÕÏÖ®ºó¡£ ÁãÅäÖ×—²»ÐèÒª°²×°ºÍ¹ÜÀí¡£ÊµÏÖÁ˾ø´ó¶àÊýSQL92±ê×¼¡£Õû¸öÊý¾Ý¿â´æ´¢ÔÚÒ»¸öµ¥Ò»µÄÎļþÖС£Êý¾Ý¿âÎļþ¿ÉÒÔÔÚ²»Í¬×Ö½ÚÐòµÄ»úÆ÷Ö®¼ä×ÔÓɵع²Ïí¡£Ö§³Ö×î´ó¿É´ï2TµÄÊý¾Ý¿â¡£×Ö·û´®ºÍBLOBÀàÐ͵ĴóСֻÊÜÏÞÓÚ¿ÉÓÃÄÚ´æ¡£ÍêÕûÅäÖõÄÉÙÓÚ250KB£¬ºöÂÔһЩ¿ÉÑ¡ÌØÐÔµÄÉÙÓÚ150KB¡£ÔÚ´ó¶àÊý³£¼û²Ù×÷ÉϱÈÁ÷ÐеĿͻ§/·þÎñÆ÷Êý¾Ý¿âÒýÇæ¸ü¿ì¡£ ¼òµ¥Ò×ÓÚʹÓõÄAPI¡£ ÄÚ½¨TCL°ó¶¨¡£ ÁíÍâÌṩ¿ÉÓÃÓÚÐí¶àÆäËûÓïÑԵİ󶨡£¾ßÓÐÁ¼ºÃ×¢Ê͵ÄÔ´´úÂ룬´úÂë95%ÓнϺõÄ×¢ÊÍ¡£¶ÀÁ¢£ºÃ»ÓÐÍⲿÒÀÀµ¡£Ô´´úÂëλÓÚ¹«¹²Óò£¬¿ÉÓÃÓÚÈκÎÓÃ;¡£ÓÃSQLiteÁ¬½ÓµÄ³ÌÐò¿ÉÒÔʹÓÃSQLÊý¾Ý¿â£¬µ«²»ÐèÒªÔËÐÐÒ»¸öµ¥¶ÀµÄ¹ØϵÐÍÊý¾Ý¿â¹ÜÀíϵͳ½ø³Ì£¨separate RDBMS process£©¡£SQLite²»ÊÇÒ»¸öÓÃÓÚÁ¬½Óµ½´óÐÍÊý¾Ý¿â·þÎñÆ÷£¨big database server£©µÄ¿Í»§¶Ë¿â£¨client library£©£¬¶øÊǷdz£ÊʺÏ×ÀÃæ³ÌÐòºÍСÐÍÍøÕ¾µÄÊý¾Ý¿â·þÎñÆ÷¡£SQLiteÖ±½Ó¶Áд£¨reads and writes directly£©ÔÚÓ²ÅÌÉϵÄÊý¾Ý¿âÎļþ¡£
ÏÂÃæÊÇÎÒ×Ô¼ºµÄʹÓùý³Ì:
SQLite°²×°·½°¸
SQLiteµÄ×îа汾¿ÉÒÔ´ÓÕâÀïÏÂÔØ¡£ÏÂÃæÎÒÃÇÒÔWindows°æ±¾sqlite-3_5_1.zip ΪÀý½éÉÜÆä°²×°·½·¨¡£
£¨´ó¼Ò¿ÉÒÔÑ¡ÔñÏÂÔØ°²×°ÊʺÏ×Ô¼ºµÄ°æ±¾£©
ÏÂÔغ󣬽«sqlite-3_5_1.zip½âѹËõÖÁC:\sqliteĿ¼¼´Íê³É°²×°¡£
C:\sqliteĿ¼¹¹ÔìΪ£º
C:\sqlite
|
+--sqlite3.exe
´ò¿ªÒ»¸öCMDÃüÁî´°¿Ú
C:\>cd sqlite
C:\sqlite>sqlite3.exe mydb.db
SQLite version 3.5.1
Enter ".help" for instructions
sqlite> create table user ( id integer primary key, name varchar(32) );
sqlite> .schema
CREATE TABLE user ( id integer primary key, name varchar(32) );
sqlite>.quit
Í˳öºó£¬²é¿´C:\sqliteĿ¼£¬»á·¢ÏÖ¶à³öÒ»¸ömydb.dbÎļþ£º
C:\sqlite
|
+--sqlite3.exe
+--mydb.db
SQLiteÐÔÄÜÓÅ»¯
ºÜ¶àÈËÖ±½Ó¾ÍʹÓÃÁË£¬²¢Î´×¢Òâµ½SQLiteÒ²ÓÐÅäÖòÎÊý£¬¿ÉÒÔ¶ÔÐÔÄܽøÐÐ
Ïà¹ØÎĵµ£º
SQLite ÊÇÒ»¸öʵÏÖÁËÍ걸µÄ£¨self-contained)£¬¿ÉǶÈëµÄ(embeddable)£¬ÁãÅäÖÃ(zero-configuration)µÄSQLÊý¾Ý¿âÒýÇæµÄСÐ͵ÄCº¯Êý¿â¡£Ëü°üº¬ÒÔϵÄÌص㣺
.
ÊÂÎñ´¦ÀíÔ×Ó»¯(atomic)£¬Ò»Ö»¯(consistent)£¬³Ö¾Ã»¯(isolated)£¬¾øÔµ»¯(durable)£¬¼´Ê¹ÊÇÔÚϵͳ±ÀÀ£ºÍµôµçʱ
ÁãÅäÖ㬲» ......
½üÀ´ÒòΪ¹¤×÷ÐèÒª¼ÓÈë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/
Òª¼ÇµÄÒ²²»ÊÇʲô´ó²»Á˵Ķ«Î÷£¬Ê¾ÀýÍøÕ¾É϶ ......
1) ÈçºÎ´´½¨×ÔÔö×ֶΣ¿
¼òµ¥µÄ»Ø´ð£ºÒ»¸öÉùÃ÷Ϊ INTEGER PRIMARY KEY µÄ×ֶν«×Ô¶¯Ôö¼Ó¡£
ÕâÀïÊÇÏêϸµÄ´ð°¸£º ´Ó SQLite µÄ 2.3.4 °æ±¾¿ªÊ¼£¬Èç¹ûÄ㽫һ¸ö±íÖеÄÒ»¸ö×Ö¶ÎÉùÃ÷Ϊ INTEGER PRIMARY
KEY£¬ÄÇôÎÞÂÛÄãºÎʱÏò¸Ã±íµÄ¸Ã×ֶβåÈëÒ»¸ö NULL Öµ£¬Õâ¸ö NULL Öµ½«×Ô¶¯±»¸ü»»Îª±È±íÖиÃ×Ö¶ÎËùÓÐÐеÄ×î´óÖµ´ó
......
/*=================================
.* The Standard include file.
.*
.*===============================*/
#include <stdio.h>
#include <stdlib.h>
/*=================================
.*
.* The extend include file.
.*
.*===============================*/
#include "sqlit ......