SQLiteÓï·¨ PRAGMA
SQLiteÖ§³ÖµÄ±àÒëÖ¸Áî(pragma)
PRAGMAÃüÁî
ÊÇÓÃÓÚÐÞ¸ÄSQlite¿â»ò²éѯSQLite¿âÄÚ²¿Êý¾Ý(non-table)µÄÌØÊâÃüÁî¡£PRAGMA ÃüÁîʹÓÃÓëÆäËüSQLiteÃüÁî(e.g. SELECT, INSERT)ÏàͬµÄ½Ó¿Ú£¬µ«ÔÚÈçÏÂÖØÒª·½ÃæÓëÆäËüÃüÁͬ:
ÔÚδÀ´µÄSQLite°æ±¾Öв¿·Öpragma¿ÉÄܱ»É¾³ý»òÌí¼Ó£¬Ð¡ÐÄʹÓá£
µ±Ê¹ÓÃδ֪µÄpragmaÓï¾äʱ²»²úÉú±¨´í¡£Î´ÖªµÄpragma½ö½ö»á±»ºöÂÔ£¬¼´ÊÇ˵ÈôÊÇ´ò´íÁËpragmaÓï¾äSQLite²»»áÌáʾÓû§¡£
һЩpragmaÔÚSQL±àÒë½×¶ÎÉúЧ¶ø·ÇÖ´Ðн׶Ρ£¼´ÊÇ˵ÈôʹÓÃCÓïÑÔµÄsqlite3_compile(),
sqlite3_step(), sqlite3_finalize() API
(»òÀàËƵķâ×°½Ó¿ÚÖÐ)£¬pragma¿ÉÄÜÔÚµ÷ÓÃsqlite3_compile()ÆÚ¼äÆð×÷Óá£
pragmaÃüÁî²»ÓëÆäËüSQLÒýÇæ¼æÈÝ¡£
¿ÉÓõÄpragmaÃüÁîÓÐÈçÏÂËĸö»ù±¾ÀàÐÍ£º
ÓÃÓڲ쿴µ±Ç°Êý¾Ý¿âµÄģʽ
¡£
ÓÃÓÚÐÞ¸ÄSQLite¿âµÄ²Ù×÷
»ò²éѯµ±Ç°µÄ²Ù×÷ģʽ¡£
ÓÃÓÚ²éѯ»òÐÞ¸ÄÁ½¸öÊý¾Ý¿âµÄ°æ±¾ºÅ
£¬schema-versionºÍuser-version.
ÓÃÓÚµ÷ÊÔ¿â
ºÍУÑéÊý¾Ý¿âÎļþ¡£
PRAGMAÃüÁîÓï·¨
sql-statement
::=
PRAGMA
name
[=
value
]
|
PRAGMA
function
(
arg
)
ʹÓÃÕûÊýÖµvalue
µÄpragmaÒ²¿ÉÒÔʹÓ÷ûºÅ±íʾ£¬×Ö·û´®"on
", "true
",ºÍ "yes
" µÈͬÓÚ1
£¬"off
", "false
",ºÍ "no
"µÈͬÓÚ0
. ÕâЩ×Ö·û´®´óСд²»Ãô¸ÐÇÒÎÞÐë½øÐÐÒýÓá£ÎÞ·¨Ê¶±ðµÄ×Ö·û´®±»µ±×÷1
ÇÒ²»»á±¨´í¡£value
·µ»ØʱÊÇÕûÊý¡£
ÓÃÓÚÐÞ¸ÄSQLite¿âµÄ²Ù×÷µÄPragma
PRAGMA auto_vacuum;
PRAGMA auto_vacuum =
0 | 1
;
²éѯ»òÉèÖÃÊý¾Ý¿âµÄauto-vacuum±ê¼Ç¡£
Õý³£Çé¿öÏ£¬µ±Ìá½»Ò»¸ö´ÓÊý¾Ý¿âÖÐɾ³ýÊý¾ÝµÄÊÂÎñʱ£¬Êý¾Ý¿âÎļþ²»¸Ä±ä´óС¡£Î´Ê¹ÓõÄÎļþÒ³±»±ê¼Ç²¢ÔÚÒÔºóµÄÌí¼Ó²Ù×÷ÖÐ ÔÙ´ÎʹÓá£ÕâÖÖÇé¿öÏÂʹÓÃVACUUM
ÃüÁîÊÍ·Åɾ³ýµÃµ½µÄ¿Õ¼ä¡£
µ±¿ªÆôauto-vacuum£¬µ±Ìá½»Ò»¸ö´ÓÊý¾Ý¿âÖÐɾ³ýÊý¾ÝµÄÊÂÎñʱ£¬Êý¾Ý¿âÎļþ×Ô¶¯ÊÕËõ£¬ (VACUUMÃüÁîÔÚauto-vacuum¿ªÆôµÄÊý¾Ý¿âÖв»Æð×÷ÓÃ)¡£Êý¾Ý¿â»áÔÚÄÚ²¿´æ´¢Ò»Ð©ÐÅÏ¢ÒÔ±ãÖ§³ÖÕâÒ»¹¦ÄÜ£¬ÕâʹµÃ Êý¾Ý¿âÎļþ±È²»¿ªÆô¸ÃÑ¡ÏîʱÉÔ΢´óһЩ¡£
Ö»ÓÐÔÚÊý¾Ý¿âÖÐ佨Èκαíʱ²ÅÄܸıäauto-vacuum±ê¼Ç¡£ÊÔͼÔÚÒÑÓбíµÄÇé¿öÏÂÐ޸IJ»»áµ¼Ö±¨´í¡£
PRAGMA cache_size;
PRAGMA cache_size =
Number-of-pages
;
²éѯ»òÐÞ¸ÄSQLiteÒ»´Î´æ´¢ÔÚÄÚ´æÖеÄÊý¾Ý¿âÎļþÒ³Êý¡£Ã¿Ò³Ê¹ÓÃÔ¼1.5KÄڴ棬ȱʡµÄ»º´æ´óСÊÇ2000. ÈôÐèҪʹÓøıä´óÁ¿¶àÐеÄU
Ïà¹ØÎĵµ£º
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 ÊÇÒ»¸öʵÏÖÁËÍ걸µÄ£¨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/
Òª¼ÇµÄÒ²²»ÊÇʲô´ó²»Á˵Ķ«Î÷£¬Ê¾ÀýÍøÕ¾É϶ ......
......