SQLite FAQÖÐÎÄ°æ
1) ÈçºÎ´´½¨×ÔÔö×ֶΣ¿
¼òµ¥µÄ»Ø´ð£ºÒ»¸öÉùÃ÷Ϊ INTEGER PRIMARY KEY µÄ×ֶν«×Ô¶¯Ôö¼Ó¡£
ÕâÀïÊÇÏêϸµÄ´ð°¸£º ´Ó SQLite µÄ 2.3.4 °æ±¾¿ªÊ¼£¬Èç¹ûÄ㽫һ¸ö±íÖеÄÒ»¸ö×Ö¶ÎÉùÃ÷Ϊ INTEGER PRIMARY
KEY£¬ÄÇôÎÞÂÛÄãºÎʱÏò¸Ã±íµÄ¸Ã×ֶβåÈëÒ»¸ö NULL Öµ£¬Õâ¸ö NULL Öµ½«×Ô¶¯±»¸ü»»Îª±È±íÖиÃ×Ö¶ÎËùÓÐÐеÄ×î´óÖµ´ó
1 µÄÕûÊý£»Èç¹û±íΪ¿Õ£¬ÄÇô½«±»¸ü»»Îª 1¡£±ÈÈ磬¼ÙÉèÄãÓÐÕâÑùµÄÒ»ÕÅÊý¾Ý±í:
CREATE TABLE t1(
a INTEGER PRIMARY KEY,
b INTEGER
);
ÔÚÕâÕÅÊý¾Ý±íÀÉùÃ÷
INSERT INTO t1 VALUES(NULL,123);
ÔÚÂß¼ÒâÒåÉϵȼÛÓÚ£º
INSERT INTO t1 VALUES((SELECT max(a) from t1)+1,123);
Ò»¸öеÄAPIº¯Êý sqlite3_last_insert_rowid()
·µ»Ø×î½üµÄ²åÈë²Ù×÷µÄÕûÐμü
×¢ÒâÕâ¸öÕûÐͼüʼÖÕ±È֮ǰ²åÈë±íÖеÄ×îºóÒ»¸ö¼ü´ó1¡£Ð¼üÏà¶ÔÓÚ±íÖеÄÒÑÓмüÀ´ËµÊÇΨһµÄ£¬
µ«Ëü¿ÉÄÜÓë֮ǰ´Ó±íÖÐɾ³ýµÄ¼üÖµÖصþ¡£ÒªÊ¼Öյõ½ÔÚÕû¸ö±íÖÐΨһµÄ¼ü£¬ÔÚINTEGER PRIMARY
KEYµÄÉùÃ÷֮ǰ¼Ó¹Ø¼ü´ÊAUTOINCREMENT.ÕâÑù±»Ñ¡µÄ¼ü½«×ÜÊDZȱíÖÐÒÑ´æÔÚµÄ×î´ó¼ü´ó1¡£Èô¿ÉÄܵÄ
×î´ó¼üÒÑ´æÔÚÓÚ±íÖУ¬INSERT²Ù×÷½«Ê§°Ü²¢·µ»ØÒ»¸öSQLITE_FULL´íÎóÂë.
(2) SQLite Ö§³ÖÄÄЩÊý¾ÝÀàÐÍ£¿
²Î¼û http://www.sqlite.org/datatype3.html
.
(3) ΪʲôÄÜÏò SQLite Êý¾Ý¿âµÄÕûÐÍ×Ö¶ÎÖвåÈë×Ö·û´®£¿
ÕâÊÇÒ»¸ö¹¦ÄÜ£¬²»ÊÇÒ»¸ö bug¡£Äã¿ÉÒÔÔÚÈκÎ×Ö¶ÎÖзÅÈκÎÐÅÏ¢£¬¶ø²»ÓùÜ×Ö¶ÎÉùÃ÷ΪʲôÀàÐÍ¡£
Äã¿ÉÒÔÍùÕûÐÍ×Ö¶ÎÖвåÈëÈÎÒⳤ¶ÈµÄ×Ö·û´®£¬»òÕßÍù²¼¶û×Ö¶ÎÖвåÈ븡µãÊý£¬»òÕßÍù×Ö·û×Ö¶ÎÖÐ ²åÈëÈÕÆÚ¡£ÔÚ CREATE
TABLE ÃüÁîÖÐÄãÖ¸¶¨¸øÕâ¸ö×ֶεÄÊý¾ÝÀàÐͲ»»áÏÞÖƲåÈëÕâ¸ö×ֶεÄÊý¾Ý¡£
ËùÓеÄ×ֶοÉÒÔ²åÈëÈÎÒⳤ¶ÈµÄ×Ö·û´®¡£µ«¶ÔÓÚ INTEGER PRIMARY KEY ×Ö¶ÎÀýÍâ¡£ÕâÖÖ×Ö¶ÎÖ»ÄÜ
´æ·ÅÒ»¸ö64λµÄÕûÊý£¬·ñÔò»á³ö´í¡£
µ«SQLite»áĬÈÏÄãÏ£ÍûʹÓÃÉùÃ÷µÄ×Ö¶ÎÀàÐÍ¡£ËùÒÔ£¬±ÈÈçÄãÏ£ÍûÔÚÒ»¸öÉùÃ÷ΪINTEGERµÄ×Ö¶Î
ÖвåÈëÒ»¸ö×Ö·û´®£¬SQLite»áÊÔͼ½«Æäת»»ÎªÒ»¸öÕûÊý¡£Èç¹ûת»»³É¹¦£¬ÄÇôÕûÊý½«±»²åÈ룬·ñ
Ôò²åÈë×Ö·û´®£¬ÕâÖÖÌØÐÔÓÐʱ±»³Æ×÷type or column
affinity
.
(4) Ϊʲô SQLite ÈÏΪ±í´ïʽ '0'=='00' ΪÕ棿
ÔÚ 2.7.0 Ö®ºó£¬±í´ïʽ²»³ÉÁ¢¡£²Î¼ûÎĵµ datatypes in
SQLite version 3
(5) Ϊʲô SQLite ²»ÔÊÐíÔÚͬһÕűíÀïʹÓà '0' ºÍ '0.0' ×÷ΪÁ½¸ö²»Í¬µÄÐеÄÖ÷¼ü£¿
ÄãµÄÖ÷¼üÒ»¶¨ÊÇÊýÖµÀàÐ͵ģ¬°ÑÀàÐ͸ÄΪ TEXT
Ïà¹ØÎĵµ£º
OS X×Ô´Ó10.4ºó°ÑSQLiteÕâÌ×Ï൱³öÃûµÄÊý¾Ý¿âÈí¼þ£¬·Å½øÁË×÷ҵϵͳ¹¤¾ß¼¯Àï¡£OS X°ü×°µÄÊǵÚÈý°æµÄSQLite£¬ÓÖ³ÆSQLite3¡£ÕâÌ×Èí¼þÓм¸¸öÌØÉ«£º
Èí¼þÊôÓÚ¹«¹²²Æ£¨public domain£©£¬SQLite¿É˵ÊÇijÖÖ¡¸ÃÀµÂÈí¼þ¡¹£¨virtueware£©£¬×÷Õß±¾ÈË·ÅÆú×Å×÷Ȩ£¬¶ø¸øʹÓÃSQLiteµÄÈËÒÔϵġ¸×£¸£¡¹£¨blessing£©£º
May you do good an ......
SQLite ÊÇÒ»¸öʵÏÖÁËÍ걸µÄ£¨self-contained)£¬¿ÉǶÈëµÄ(embeddable)£¬ÁãÅäÖÃ(zero-configuration)µÄSQLÊý¾Ý¿âÒýÇæµÄСÐ͵ÄCº¯Êý¿â¡£Ëü°üº¬ÒÔϵÄÌص㣺
.
ÊÂÎñ´¦ÀíÔ×Ó»¯(atomic)£¬Ò»Ö»¯(consistent)£¬³Ö¾Ã»¯(isolated)£¬¾øÔµ»¯(durable)£¬¼´Ê¹ÊÇÔÚϵͳ±ÀÀ£ºÍµôµçʱ
ÁãÅäÖ㬲» ......
ʹÓù¤¾ß£º
SQLite Expert SQLiteÊý¾Ý¿â¹ÜÀí¹¤¾ß£¬·Ç³£ºÃÓã¬ÀàËÆÎÒ֮ǰ½éÉܵÄEMS SQL Manager 2007 for MySQL
System.Data.SQLite SQLite For ADO.NETÇý¶¯,ÀàËÆÎÒ֮ǰ½éÉܵÄMySql.Data.dll
Õâ2¸ö¹¤¾ß¶¼°üÀ¨ÁËSQLiteµÄÒýÇæ
1¡¢´Óhttp://www.s ......
2010ÄêSQLiteѧϰ±Ê¼ÇÖ®Ò»
Ò»£® ÈçºÎ»ñÈ¡SQLite×îа汾
¹Ù·½Õ¾µã£ºhttp://www.sqlite.org/
´Óhttp://www.sqlite.org/ÍøÕ¾µÄDownloadÒ³Ãæ»ñÈ¡
¼´ÈçÏÂÒ³ÃæÏÂÔØ
http://www.sqlite.org/download.html
¶þ£®WindowsϵÄSQLiteµÄÔ´´úÂëÊÇÄĸöÈí¼þÑ¹Ë ......