sqliteµÄѧϰ±Ê¼ÇתÔØ
Ç°Ðò£º
Sqlite3 µÄÈ·ºÜºÃÓá£Ð¡ÇÉ¡¢Ëٶȿ졣µ«ÊÇÒòΪ·Ç΢ÈíµÄ²úÆ·£¬°ïÖúÎĵµ×ܾõµÃ²»¹»¡£ÕâЩÌìÔÙ´ÎÑо¿Ëü£¬ÓÖÓÐһЩÊÕ»ñ£¬ÕâÀï°ÑÎÒ¶Ô sqlite3 µÄÑо¿ÁгöÀ´£¬ÒÔ±¸Íü¼Ç¡£
ÕâÀïҪעÃ÷£¬ÎÒÊÇÒ»¸ö¿çƽ̨רעÕߣ¬²¢²»Ï²»¶Ö»Óà windows ƽ̨¡£ÎÒÒÔÇ°µÄ¹¤×÷¾ÍÊÇΪ unix ƽ̨д´úÂë¡£ÏÂÃæÎÒËùдµÄ¶«Î÷£¬ËäȻûÓÐÑéÖ¤£¬µ«ÊÇÎÒÒѾ¡Á¿²»Ê¹ÓÃÈκΠwindows µÄ¶«Î÷£¬Ö»Ê¹Óñê×¼ C »ò±ê×¼C++¡£µ«ÊÇ£¬ÎÒûÓг¢ÊÔ¹ýÔÚ±ðµÄϵͳ¡¢±ðµÄ±àÒëÆ÷ϱàÒ룬Òò´ËÏÂÃæµÄÐðÊöÈç¹û²»ÕýÈ·£¬ÔòÁô´ýÒÔºóÐ޸ġ£
ÏÂÃæÎҵĴúÂëÈÔÈ»Óà VC ±àд£¬ÒòΪÎÒ¾õµÃVCÊÇÒ»¸öºÜ²»´íµÄIDE£¬¿ÉÒÔ¼Ó¿ì´úÂë±àдËٶȣ¨ÀýÈçÅäºÏ Vassist £©¡£ÏÂÃæÎÒËù˵µÄ±àÒë»·¾³£¬ÊÇVC2003¡£Èç¹û¶ÁÕß¾õµÃ×Ô¼ºÏ°¹ßÓÚ unix ÏÂÓà vi ±àд´úÂëËٶȽϿ죬¿ÉÒÔ²»ÓùÜÎÒµÄ˵Ã÷£¬Ö»ÐèÒª·ûºÏ×Ô¼ºÏ°¹ß¼´¿É£¬ÒòΪÎÒÓõÄÊDZê×¼ C »ò C++ ¡£²»»á¸øÈκÎÈË´øÀ´²»±ã¡£
Ò»¡¢ °æ±¾
´Ó www.sqlite.org ÍøÕ¾¿ÉÏÂÔص½×îÐ嵀 sqlite ´úÂëºÍ±àÒë°æ±¾¡£ÎÒд´ËÎÄÕÂʱ£¬×îдúÂëÊÇ 3.3.17 °æ±¾¡£
ºÜ¾ÃûÓÐÈ¥ÏÂÔØ sqlite дúÂ룬Òò´ËÒ²²»ÖªµÀ sqlite ±ä»¯Õâô´ó¡£ÒÔÇ°ºÜ¶àÎļþ£¬ÏÖÔÚÈ«²¿ºÏ²¢³ÉÒ»¸ö sqlite3.c Îļþ¡£Èç¹ûµ¥¶ÀÓôËÎļþ£¬ÊÇͦºÃµÄ£¬Ê¡È¥¿½±´Ò»¶ÑÎļþ»¹µ£ÐÄÓÐûÓÐÒÅ©¡£µ«ÊÇÒ²´øÀ´Ò»¸öÎÊÌ⣺´ËÎļþÌ«´ó£¬¿ì½Ó½ü7ÍòÐдúÂ룬VC¿ªËüÕû¸ö»úÆ÷¶¼ÂýÏÂÀ´ ÁË¡£Èç¹û²»ÐèÒª¸ÄËü´úÂ룬Ҳ¾Í²»ÐèÒª´ò¿ª sqlite3.c Îļþ£¬»úÆ÷²»»áÂý¡£µ«ÊÇ£¬ÏÂÃæÎÒҪдͨ¹ýÐÞ¸Ä sqlite ´úÂëÍê³É¼ÓÃܹ¦ÄÜ£¬ÄÇʱºò¾Í±È½ÏÍ´¿àÁË¡£Èç¹û¸öÈËˮƽ½Ï¸ß£¬½¨ÒéÓÃЩ¼òµ¥µÄ±à¼Æ÷À´±à¼£¬ÀýÈç UltraEdit »ò Notepad ¡£ËٶȻá¿ìºÜ¶à¡£
¶þ¡¢ »ù±¾±àÒë
Õâ¸ö²»Ïë¶à˵ÁË£¬ÔÚ VC Àïн¨ dos ¿ØÖÆ̨¿Õ°×¹¤³Ì£¬°Ñ sqlite3.c ºÍ sqlite3.h Ìí¼Óµ½¹¤³Ì£¬ÔÙн¨Ò»¸ö main.cpp Îļþ¡£ÔÚÀïÃæд:
extern "C"
{
#include "./sqlite3.h"
};
int main( int , char** )
{
return 0;
}
ΪʲôҪ extern “C” £¿Èç¹ûÎÊÕâ¸öÎÊÌ⣬ÎÒ²»Ïë˵̫¶à£¬ÕâÊÇC++µÄ»ù´¡¡£ÒªÔÚ C++ ÀïʹÓÃÒ»¶Î C µÄ´úÂ룬±ØÐëÒªÓà extern “C” À¨ÆðÀ´¡£C++¸ú CËäÈ»Óï·¨ÉÏÓÐÖصþ£¬µ«ÊÇËüÃÇÊÇÁ½¸ö²»Í¬µÄ¶«Î÷£¬ÄÚ´æÀïµÄ²¼¾ÖÊÇÍêÈ«²»Í¬µÄ£¬ÔÚC++±àÒëÆ÷Àï²»ÓÃextern “C”À¨ÆðC´úÂ룬»áµ¼Ö±àÒëÆ÷²»ÖªµÀ¸ÃÈçºÎΪ C ´úÂëÃèÊöÄÚ´æ²¼¾Ö¡£
¿ÉÄÜÔÚ sqlite3.c ÀïÈ˼ÒÒѾ°ÑÕû¶Î´úÂ붼 extern “C” À¨ÆðÀ´ÁË£¬µ«ÊÇÄãÓöµ½Ò»¸ö .c Îļþ¾Í×Ô¾õµÄÔÙÀ¨Ò»´Î£¬Ò²Ã»Ê²Ã´²»ºÃ¡£
»ù±¾¹¤³Ì¾
Ïà¹ØÎĵµ£º
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/ ......
Ç°Ðò£º... 1
Ò»¡¢ °æ±¾... 1
¶þ¡¢ »ù±¾±àÒë... 2
Èý¡¢ SQLITE²Ù×÷ÈëÃÅ... 2
£¨1£© »ù±¾Á÷³Ì... 2
£¨2£© SQLÓï¾ä²Ù×÷... 4
£¨3£© ²Ù×÷¶þ½øÖÆ... 8
£¨4£© ÊÂÎñ´¦Àí... 10
ËÄ¡¢ ¸øÊý¾Ý¿â¼ÓÃÜ... 10
Îå¡¢ ºó¼Ç... 25
Ç°Ðò£º
Sqlite3 µÄÈ·ºÜºÃÓá£Ð¡ÇÉ¡¢Ëٶȿ졣µ«ÊÇÒòΪ·Ç΢ÈíµÄ²úÆ·£¬°ïÖúÎĵµ×ܾõµÃ²»¹» ......
£¨4£© ÊÂÎñ´¦Àí
sqlite ÊÇÖ§³ÖÊÂÎñ´¦ÀíµÄ¡£Èç¹ûÄãÖªµÀÄãҪͬ²½É¾³ýºÜ¶àÊý¾Ý£¬²»·Â°ÑËüÃÇ×ö³ÉÒ»¸öͳһµÄÊÂÎñ¡£
ͨ³£Ò»´Î sqlite3_exec ¾ÍÊÇÒ»´ÎÊÂÎñ£¬Èç¹ûÄãҪɾ³ý1ÍòÌõÊý¾Ý£¬sqlite¾Í×öÁË1Íò´Î£º¿ªÊ¼ÐÂÊÂÎñ->ɾ³ýÒ»ÌõÊý¾Ý->Ìá½»ÊÂÎ ......
zz from https://www.dream4ever.org/showthread.php?t=86440 feuvan @ DRL
ÔÎÄÔÚhttp://sqlitecn.feuvan.net/faq.html
Óï·¨²¿·ÖÕýÔÚ·ÒëÖУ¬¾´ÇëÆÚ´ý
FAQÖÐÎÄ°æ
ÈçºÎ´´½¨×ÔÔö×ֶΣ¿
SQLite Ö§³ÖÄÄЩÊý¾ÝÀàÐÍ£¿
ΪʲôÄÜÏò SQLite Êý¾Ý¿âµÄÕûÐÍ×Ö¶ÎÖвåÈë×Ö·û´®£¿
Ϊʲô SQLite ÈÏΪ±í´ïʽ '0'=='00' ΪÕ棿
......
Åжϱí´æÔڵķ½·¨ºÜ¼òµ¥,ÍøÉϺܶà:
SELECT COUNT(*) from sqlite_master where type='table' and name='%s'" % tname;
ÄÇôÅжÏ×Ö¶ÎÊÇ·ñ´æÔÚ, »òÕß˵ÈçºÎÅжϱíµÄ°æ±¾ÊÇ·ñ×îоÍÖ»ÐèÒª:
select * from sqlite_master where tbl_name='tblContactList';
sqlite_master µÄ±í½á¹¹ÈçÏÂ:
type |name  ......