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
Ïà¹ØÎĵµ£º
Ò»¡¢SQLite¼ò½é
SQLite ÊÇÓÃCÓïÑÔ±àдµÄ¿ªÔ´Êý¾Ý¿â£¬Ö÷ÒªÓÃÓÚǶÈëʽ£¬ÄãÒ²¿ÉÒÔ°ÑËü¼¯³ÉÔÚ×Ô¼ºµÄ×ÀÃæ³ÌÐòÖУ¬Ò²ÓÐÈ˽«ÆäÌæ´úAccess£¬ÓÃ×÷ºǫ́Êý¾Ý¿â¡£
SQLite Ö§³Ö¶àÊýSQL92±ê×¼£¬ÀýÈ磺Ë÷Òý¡¢ÏÞÖÆ¡¢´¥·¢ºÍ²é¿´Ö§³Ö¡£
Ö§³Ö NULL¡¢INTEGER¡¢REAL¡¢TEXT ºÍ BLOB Êý¾ÝÀàÐÍ£¬Ö§³ÖÊÂÎñ¡£
¶þ¡¢ÏÂÔØSQLite
SQLite¿ÉÒÔµ½¹Ù·½Õ¾µ ......
CnGuiDB.js
var db : dbAccess;
public var mskin : GUISkin;
private var mstring : String;
var inputStr;
function Start(){
inputStr = "1";
}
function search(mid)
{
db = new dbAccess();
db.OpenDB("db1.db");
var tableName = "myTable";
// table name, I want to return everyo ......
ʹÓù¤¾ß£º
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 ......
1:³£ÓýӿÚ
¸öÈ˱ȽÏϲ»¶
sqlite,
ʹÓÃ×î·½±ã£¬Î¨Ò»µÄ×¼±¸¹¤×÷ÊÇÏÂÔØ
250K
µÄÔ´£»¶øÇÒ×÷ÕߺÜÈÈÐÄ£¬ÓÐÎʱشð¡£
ÒÔÏÂÑÝʾһÏÂʹÓÃ
sqlite
µÄ²½Ö裬ÏÈ´´½¨Ò»¸öÊý¾Ý¿â£¬È»ºó²éѯÆäÖеÄÄÚÈÝ¡£
2
¸öÖØÒª½á¹¹ÌåºÍ
5
¸öÖ÷Òªº¯Êý£º
sqlite3 &nbs ......
from within a C/C++ program (or a script using Tcl/Ruby/Perl/Python
bindings) you can get access to table and index names by doing a SELECT
on a special table named "SQLITE_MASTER
". Every SQLite database has an SQLITE_MASTER table that defines the schema for the database.
SQL code
S ......