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

sqliteÐÔÄÜÓÅ»¯

Ö÷Ҫͨ¹ýpragmaÖ¸ÁîÀ´ÊµÏÖ¡£
±ÈÈ磺 ¿Õ¼äÊÍ·Å¡¢´ÅÅÌͬ²½¡¢Cache´óСµÈ¡£
²»Òª´ò¿ª¡£Ç°ÎÄÌá¸ßÁË£¬VacuumµÄЧÂʷdz£µÍ£¡
PRAGMA auto_vacuum;
PRAGMA auto_vacuum = 0 | 1;
²éѯ»òÉèÖÃÊý¾Ý¿âµÄauto-vacuum±ê¼Ç¡£
Õý³£Çé¿öÏ£¬µ±Ìá½»Ò»¸ö´ÓÊý¾Ý¿âÖÐɾ³ýÊý¾ÝµÄÊÂÎñʱ£¬Êý¾Ý¿âÎļþ²»¸Ä±ä´óС¡£Î´Ê¹ÓõÄÎļþÒ³±»±ê¼Ç²¢ÔÚÒÔºóµÄÌí¼Ó²Ù×÷ÖÐ ÔÙ´ÎʹÓá£ÕâÖÖÇé¿öÏÂʹÓÃVACUUMÃüÁîÊÍ·Åɾ³ýµÃµ½µÄ¿Õ¼ä¡£
µ±¿ªÆôauto-vacuum£¬µ±Ìá½»Ò»¸ö´ÓÊý¾Ý¿âÖÐɾ³ýÊý¾ÝµÄÊÂÎñʱ£¬Êý¾Ý¿âÎļþ×Ô¶¯ÊÕËõ£¬ (VACUUMÃüÁîÔÚauto-vacuum¿ªÆôµÄÊý¾Ý¿âÖв»Æð×÷ÓÃ)¡£Êý¾Ý¿â»áÔÚÄÚ²¿´æ´¢Ò»Ð©ÐÅÏ¢ÒÔ±ãÖ§³ÖÕâÒ»¹¦ÄÜ£¬ÕâʹµÃ Êý¾Ý¿âÎļþ±È²»¿ªÆô¸ÃÑ¡ÏîʱÉÔ΢´óһЩ¡£
Ö»ÓÐÔÚÊý¾Ý¿âÖÐ佨Èκαíʱ²ÅÄܸıäauto-vacuum±ê¼Ç¡£ÊÔͼÔÚÒÑÓбíµÄÇé¿öÏÂÐ޸IJ»»áµ¼Ö±¨´í¡£
½¨Òé¸ÄΪ8000
PRAGMA cache_size;
PRAGMA cache_size = Number-of-pages;
²éѯ»òÐÞ¸ÄSQLiteÒ»´Î´æ´¢ÔÚÄÚ´æÖеÄÊý¾Ý¿âÎļþÒ³Êý¡£Ã¿Ò³Ê¹ÓÃÔ¼1.5KÄڴ棬ȱʡµÄ»º´æ´óСÊÇ2000. ÈôÐèҪʹÓøıä´óÁ¿¶àÐеÄUPDATE»òDELETEÃüÁ²¢ÇÒ²»½éÒâSQLiteʹÓøü¶àµÄÄÚ´æµÄ»°£¬¿ÉÒÔÔö´ó»º´æÒÔÌá¸ßÐÔÄÜ¡£
µ±Ê¹ÓÃcache_size pragma¸Ä±ä»º´æ´óСʱ£¬¸Ä±ä½ö¶Ôµ±Ç°¶Ô»°ÓÐЧ£¬µ±Êý¾Ý¿â¹Ø±ÕÖØдò¿ªÊ±»º´æ´óС»Ö¸´µ½È±Ê¡´óС¡£ ÒªÏëÓÀ¾Ã¸Ä±ä»º´æ´óС£¬Ê¹ÓÃdefault_cache_size pragma.
´ò¿ª¡£²»È»ËÑË÷ÖÐÎÄ×Ö´®»á³ö´í¡£
PRAGMA case_sensitive_like;
PRAGMA case_sensitive_like = 0 | 1;
LIKEÔËËã·ûµÄȱʡÐÐΪÊǺöÂÔlatin1×Ö·ûµÄ´óСд¡£Òò´ËÔÚȱʡÇé¿öÏÂ'a' LIKE 'A'µÄֵΪÕæ¡£¿ÉÒÔͨ¹ý´ò¿ª case_sensitive_like pragmaÀ´¸Ä±äÕâһȱʡÐÐΪ¡£µ±ÆôÓÃcase_sensitive_like£¬'a' LIKE 'A'Ϊ¼Ù¶ø 'a' LIKE 'a'ÒÀȻΪÕæ¡£
´ò¿ª¡£±ãÓÚµ÷ÊÔ
PRAGMA count_changes;
PRAGMA count_changes = 0 | 1;
²éѯ»ò¸ü¸Äcount-changes±ê¼Ç¡£Õý³£Çé¿öÏÂINSERT, UPDATEºÍDELETEÓï¾ä²»·µ»ØÊý¾Ý¡£ µ±¿ªÆôcount-changes£¬ÒÔÉÏÓï¾ä·µ»ØÒ»Ðк¬Ò»¸öÕûÊýÖµµÄÊý¾Ý——¸ÃÓï¾ä²åÈ룬Ð޸Ļòɾ³ýµÄÐÐÊý¡£ ·µ»ØµÄÐÐÊý²»°üÀ¨ÓÉ´¥·¢Æ÷²úÉúµÄ²åÈ룬Ð޸Ļòɾ³ýµÈ¸Ä±äµÄÐÐÊý¡£
PRAGMA page_size;
PRAGMA page_size = bytes;
²éѯ»òÉèÖÃpage-sizeÖµ¡£Ö»ÓÐÔÚδ´´½¨Êý¾Ý¿âʱ²ÅÄÜÉèÖÃpage-size¡£Ò³Ãæ´óС±ØÐëÊÇ2µÄÕûÊý±¶ÇÒ´óÓÚµÈÓÚ512СÓÚµÈÓÚ8192¡£ ÉÏÏÞ¿ÉÒÔͨ¹ýÔÚ±àÒëʱÐ޸ĺ궨ÒåSQLITE_MAX_PAGE_SIZEµÄÖµÀ´¸Ä±ä¡£ÉÏÏÞµÄÉÏÏÞÊÇ32768.
Èç¹ûÓж¨ÆÚ±¸·ÝµÄ»úÖÆ£¬


Ïà¹ØÎĵµ£º

web.py+sqliteдµÄ¼òµ¥ÁôÑÔ±¾

´úÂëºÜÂÒ£¬¶øÇÒûÓÐÓõ½Ä£°å£¬°Ñhtml´úÂë¸úPython´úÂë»ìÔÚÒ»ÆðÁË£¬¶øÇÒҲûÓÐÓõ½web.py±¾ÉíÌṩµÄÊý¾Ý¿â²Ù×÷Ä£¿é£¬¾ø¶Ô´Ö³¬µÄ´úÂ룡
ѧϰÁ˺ܶණÎ÷£¬Ê×Ïȵ±È»ÊÇweb.py£¬È»ºóÊÇsqlite£¬½ÓÏÂÀ´ÊÇtimeÄ£¿é——¿´À´Ò²Î¨Óв»¶ÏµÄʵ¼ù£¬²ÅÕæÕýÄܽø²½£¡
˵ʵÔڵģ¬Å¼Ñ§htmlµ½ÏÖÔÚÕâô¾Ã£¬»¹ÊÇ°ëÍ°Ë®£¬±¯¾çÁË£¡
01&n ......

SqLite ʱ¼ä¸ñʽ


sqliteʱ¼äº¯Êý£¨×ª£©
2007Äê12ÔÂ10ÈÕ ÐÇÆÚÒ» 13:33
תÌùÔ­Òò£º×î½üÉè¼ÆÁËÒ»¸ö¿çÊý¾Ý¿âµÄº¯Êý£¬À´²âÊÔ²âÊÔsqlite¡£
SQLite·ÖÒ³ÏÔʾ£ºSelect * from news order by id
desc Limit 10 Offset 10
ÕâƪÎÄÕÂÊǸù¾Ý SQLite ¹Ù·½ WIKI ÀïµÄÄÚÈÝ·­Ò룬Èç¹ûÓÐʲô·­Òë²»µ±µÄµØ·½Ï£Íû´ó¼ÒÖ¸³ö£¬±Ï¾¹ÎÒµÄÓ¢ÎÄˮƽʵÔںܲ SQ ......

SQLiteÊý¾Ý¿âÁ¬½Ó·½Ê½

SQLiteÊý¾Ý¿âÁ¬½Ó·½Ê½
 
SQLite.NET
Type:    .NET Framework Class Library
Usage:  System.Data.SQLite.SQLiteConnection
Basic
Data Source=filename;Version=3;
Version 2 is not supported by this class library.
 Using UTF16
Data Source=filename;Version=3;UseUTF16 ......

Android SQLITE ¼òµ¥Æð²½

1£º¶¨Òå±íµÄ½á¹¹ºÍÃû×Ö£¬ÎÒʹÓÃÒÔÏ·½·¨£º
public interface Constatnts extends BaseColumns {
   public static final String TABLE_NAME = "test";
  
   public static final String TIME = "time";
   public static final String TITLE = "title";
}
ÔÚÕâÀÎҼ̳Р......

Android (SQLite Êý¾Ý¿âÓëContentProvider)

ÔÚ AndroidÖУ¬¶ÔÓÚÊý¾ÝµÄ´æÖü£¬Óм¸ÖÖ·½Ê½£¬ÓÐÎļþ·½Ê½£¬ÓÐÎļþʽÊý¾Ý¿â·½Ê½,Android×Ô´øÁËÒ»¸öSQLiteÊý¾Ý¿â£¬×öǶÈ뿪·¢µÄÈ˶ÔÕâ¸ö¿çƽ̨µÄ±¾µØÎļþÊý¾Ý¿âÒ»¶¨²»»áÄ°Éú£¬ÔÚAndroid¶ÔÓÚÊý¾ÝµÄ·ÃÎÊ£¬Ìá³öÁËеķ½Ê½£¬ContentProvider·½Ê½£¬ÀàËÆÓÚMSµÄ ContentProvider·½Ê½µÄ£¬OLEDB£¬¼°ODBCͳһµÄÊý¾Ý·½Ê½¡£
ÎÒÃÇÊ×ÏÈÀ´¿´¿ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ