ǶÈëʽÊý¾Ý¿âSQLiteÓëJava
ǶÈëʽÊý¾Ý¿âSQLiteÓëJava
SQLite×÷Ϊһ¸ö¿ªÔ´µÄǶÈëʽÊý¾Ý¿â²úÆ·£¬¾ßÓÐϵͳ¿ªÏúС£¬¼ìË÷ЧÂʸߵÄÌØÐÔ£¬ÊÊÓÃÓÚÊÖ»ú¡¢PDA¡¢»ú¶¥ºÐÉ豸µÈµçÆ÷£¬²¢ÇÒ×÷ΪǶÈëʽÊý¾Ý¿âÔÚ¿ÉÏÂÔصÄÏû·ÑÀàÓ¦ÓóÌÐòÖÐÔËÐеĺܺá£ÕâƪÎÄÕ½éÉÜǶÈëʽÊý¾Ý¿â²úÆ·SQLiteµÄ¼¼ÊõÌص㣬²¢×ÅÖØÌÖÂÛÑо¿ÓëJavaÓïÑÔÖ®¼äµÄ½Ó¿Ú£¬²¢ÒÔʵÀý˵Ã÷ÈçºÎʹÓÃJAVA¿ª·¢»ùÓÚSQLiteµÄÓ¦ÓóÌÐò¡£
ͨ³£ÎÒÃDzÉÓø÷ÖÖÊý¾Ý¿â²úÆ·À´ÊµÏÖ¶ÔÊý¾ÝµÄ´æ´¢¡¢¼ìË÷µÈ¹¦ÄÜ£¬ÀýÈ磬Oracle£¬SQL Server£¬MySQLµÈµÈ¡£ÕâЩ²úÆ·³ýÌṩ»ù±¾µÄ²éѯ£¬É¾³ý£¬Ìí¼ÓµÈ¹¦ÄÜÍ⣬ҲÌṩÁ˺ܶà¸ß¼¶ÌØÐÔ£¬Èç´¥·¢Æ÷£¬´æ´¢¹ý³Ì£¬Êý¾Ý±¸·Ý»Ö¸´£¬È«ÎļìË÷¹¦Äܵȡ£µ«Êµ¼ÊÉÏ£¬ºÜ¶àµÄÓ¦Ó㬽ö½öÀûÓõ½ÁËÕâЩÊý¾Ý¿â²úÆ·µÄ»ù±¾ÌØÐÔ¶øÒÑ¡£¶øÇÒÔÚһЩСÐÍÓ¦ÓÃÉÏ£¬»òÕßijЩÌØÊⳡºÏµÄÓ¦Ó㬱ÈÈç×ÀÃæ³ÌÐò£¬ÕâЩÊý¾Ý¿â²úÆ·¾ÍÃ÷ÏÔÓÐһЩӷÖס£ÔÚÕâЩÇé¿öÏ£¬Ç¶ÈëʽÊý¾Ý¿âµÄÓÅÊƾÍÌرðÃ÷ÏÔÁË¡£
ǶÈëʽÊý¾Ý¿âÎÞÐë¶ÀÁ¢ÔËÐеÄÊý¾Ý¿âÒýÇ棬ËüÊÇÓɳÌÐòÖ±½Óµ÷ÓÃÏàÓ¦µÄAPIȥʵÏÖ¶ÔÊý¾ÝµÄ´æÈ¡²Ù×÷¡£¸üÖ±°×µÄ½²£¬Ç¶ÈëʽÊý¾Ý¿âÊÇÒ»Ö־߱¸ÁË»ù±¾Êý¾Ý¿âÌØÐÔµÄÊý¾ÝÎļþ¡£Ç¶ÈëʽÊý¾Ý¿âÓëÆäËüÊý¾Ý¿â²úÆ·µÄÇø±ðÊÇ£¬Ç°ÕßÊdzÌÐòÇý¶¯Ê½, ¶øºóÕßÊÇÒýÇæÏìӦʽ¡£Ç¶ÈëʽÊý¾Ý¿âµÄÒ»¸öºÜÖØÒªµÄÌصãÊÇËüÃǵÄÌå»ý·Ç³£Ð¡£¬±àÒëºóµÄ²úÆ·Ò²²»¹ý¼¸Ê®K¡£Õâ²»µ«¶Ô×ÀÃæ³ÌÐòµÄÊý¾Ý´æ´¢·½°¸ÊÇÒ»¸öºÜºÃµÄÑ¡Ôñ£¬Ò²Ê¹µÃËüÃÇ¿ÉÒÔÓ¦Óõ½Ò»Ð©Òƶ¯É豸ÉÏ¡£Í¬Ê±£¬ºÜ¶àǶÈëʽÊý¾Ý¿âÔÚÐÔÄÜÉÏÒ²ÓÅÓÚÆäËüÊý¾Ý¿â£¬ËùÒÔÔÚ¸ßÐÔÄܵÄÓ¦ÓÃÉÏÒ²³£¼ûǶÈëʽÊý¾Ý¿âµÄÉíÓ°¡£
ÏÂÃæ½éÉܵÄÊÇ¿ª·ÅÔ´´úÂëµÄǶÈëʽÊý¾Ý¿â£¬SQLite¡£Í¬Ê±²àÖØÑо¿ÈçºÎÓ¦ÓÃJavaÁ¬½ÓSQLiteÊý¾Ý¿â£¬²¢¿ª·¢»ùÓÚSQLiteµÄÓ¦ÓóÌÐò¡£
SQLite ÊÇD ·Àí²éµÂ·Ï£ÆÕ¿ª·¢³öÀ´µÄÓÃÒ»¸öСÐÍC ¿âʵÏÖµÄÒ»ÖÖÇ¿ÓÐÁ¦µÄǶÈëʽ¹ØϵÊý¾Ý¿â¹ÜÀíÌåÖÆ¡£ËüÌṩÁ˶ÔSQL92 µÄ´ó¶àÊýÖ§³Ö: Ö§³Ö¶à±íºÍË÷Òý¡¢ÊÂÎñ¡¢ÊÓͼ¡¢´¥·¢ºÍһϵÁеÄÓû§½Ó¿Ú¼°Çý¶¯
SQLite ʵÏÖÁËÍ걸µÄ¡¢¿ÉǶÈëµÄ¡¢ÁãÅäÖõÄSQLÊý¾Ý¿âÒýÇæ¡£ËüµÄÌصã°üÀ¨£º
1¡¢ÊÂÎñ´¦ÀíÊÇÔ×ӵġ¢Ò»Öµġ¢¶ÀÁ¢µÄºÍ³Ö¾ÃµÄ£¨ACID£©,¼´Ê¹ÔÚϵͳ±ÀÀ£ºÍµôµçÒÔºó¡£
2¡¢ÁãÅäÖ㬼´²»ÐèÒªÉèÖú͹ÜÀí¡£
3¡¢ÊµÏÖÁ˾ø´ó²¿·ÖµÄSQL92±ê×¼¡£
4¡¢Ò»¸öµ¥¶ÀµÄ´ÅÅÌÎļþ´æ´¢Ò»¸öÍêÕûµÄÊý¾Ý¿â¡£
5¡¢Êý¾Ý¿âÎļþÔÚ»úÆ÷Ö®¼ä¿É×ÔÓɹ²Ïí¡£
6¡¢Ö§³ÖÊý¾Ý¿âÎļþ´óСÖÁ2TB¡£
7¡¢×Ö·û´®ºÍBLOGµÄ´óСֻÊÜÏÞÓÚ¿ÉÓô洢Æ÷ÈÝÁ¿¡£
8¡¢´úÂëÁ¿Ð¡£¬¼´Ð¡ÓÚ30KµÄC´úÂëÐкÍСÓÚ250KµÄ´úÂë¿Õ¼ä£¨gcc ÔÚi486ÉÏ£©
9¡¢¶ÔÓÚ¾ø´ó¶àÊýÆÕͨ²Ù×
Ïà¹ØÎĵµ£º
C#ʹÓÃSQLiteÊý¾Ý¿â(asp.net/winform)
2009Äê1ÔÂ7ÈÕ
ÆÀÂÛ
·¢±íÆÀÂÛ
SQLite
ÊÇÄ¿Ç°±È½ÏÁ÷ÐеÄÒ»¸ö¿ªÔ´¡¢Ãâ·ÑµÄСÐ͵ÄEmbeddable RDBMS(¹ØϵÐÍÊý¾Ý¿â)£¬ÓÃCʵÏÖ£¬ÄÚ´æÕ¼ÓýÏС£¬Ö§³Ö¾ø´óÊýµÄSQL92±ê×¼£¬¸ö±ð²»Ö§³ÖµÄÇé¿ö£¬ÔÚÕâÀï
˵Ã÷
¶Ô¸÷ÖÖÓïÑÔµÄÖ§³ÖÒ²±È½Ï²»´í£¬wrapperºÜ¶à¡ ......
ÎÄÖеÄSQL¶¼ÊÇ´ÓÎÒµÄÏîÄ¿ÖÐÖ±½Ócopy¹ýÀ´£¬Òò´ËºÜ¶à±íÃûʲô¶¼ÓÐÁË
//´´½¨±í
"CREATE TABLE FEED_TABLE(FeedID TEXT, Title TEXT, Summary TEXT, Author TEXT, ImageName VARCHAR(21), ImageType TEXT, MaxIndex INT, ImageData BLOB)"
//²éѯ¼Ç¼
"select * form 'table_name'"
"select * form 'table name' where val ......
Where is SQLite?
SQLite is available on the Android device itself. The executable is in the /system/bin directory of the device. You can see that this directory contains the shell commands like ls, ps, etc., as well as sqlite3, dalvikvm, and dexdump utilities.
Code Listing 1. Contents of system/ ......
£¨2£© SQLÓï¾ä²Ù×÷
±¾½Ú½éÉÜÈçºÎÓÃsqlite Ö´Ðбê×¼ sql Óï·¨¡£
i.1 Ö´ÐÐsqlÓï¾ä
int sqlite3_exec(sqlite3*, const char *sql, sqlite3_callback, void ......
SQLite²»½ö¿ÉÒÔ°ÑÊý¾Ý¿â ·ÅÔÚÓ²ÅÌÉÏ£¬»¹¿ÉÒÔ·ÅÔÚÄÚ´æÖУ¨sqlite3_open(":memory:", &db)£©£¬¾²âÊÔ£¬Í¬ÑùÌõ¼þÏÂÊý¾Ý¿â·ÅÔÚÄÚ´æÖбȷÅÔÚÓ²ÅÌÉϲåÈë¼Ç¼Ëٶȿì²î²»¶à3±¶¡£µ«Êý¾Ý¿â·ÅÔÚÄÚ´æÖÐʱÓÐÈçÏÂȱÏÝ£º
1¡¢¶Ïµç»ò³ÌÐò±ÀÀ£ºóÊý¾Ý¿â¾Í»áÏûʧ£¬ÄãÐèÒª¶¨ÆÚAttachµ½Ó²ÅÌÉϱ¸·Ý£»
2¡¢ÔÚÄÚ´æÖеÄÊý¾Ý¿â²»Äܱ»±ðµÄ½ø³Ì ......