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

SQLite C/C++½Ó¿Ú½éÉÜ

ÕâƪÎÄÕÂÊÇʹÓÃSQLite C/C++½Ó¿ÚµÄÒ»¸ö¸ÅÒª½éÉܺÍÈëÃÅÖ¸ÄÏ¡£
ÓÉÓÚÔçÆÚµÄSQLiteÖ»Ö§³Ö5¸öC/C++½Ó¿Ú£¬Òò¶ø·Ç³£ÈÝÒ×ѧϰºÍʹÓ㬵«ÊÇËæ×ÅSQLite¹¦ÄܵÄÔöÇ¿£¬ÐµÄC/C++½Ó¿Ú²»¶ÏµÄÔö¼Ó½øÀ´£¬µ½ÏÖÔÚÓг¬¹ý150¸ö²»Í¬µÄAPI½Ó¿Ú¡£ÕâÍùÍùʹ³õѧÕßÍû¶øÈ´²½¡£ÐÒÔ˵ÄÊÇ£¬´ó¶àÊýSQLiteÖеÄC/C++½Ó¿ÚÊÇרÓõģ¬Òò¶øºÜÉÙ±»Ê¹Óõ½¡£¾¡¹ÜÓÐÕâô¶àµÄµ÷Óýӿڣ¬ºËÐĵÄAPIÈÔÈ»Ïà¶Ô¼òµ¥ºÍ±ãÓÚµ÷Óᣱ¾Æ¬ÎÄÕµÄÄ¿µÄ¾ÍÊÇΪÁËÄܹ»¸üÒ×ÓÚÀí½âSQLiteµÄÔË×÷Ìṩ»ù´¡µÄ֪ʶ¡£
Áíһƪ¶ÀÁ¢µÄÎĵµ¡¶The SQLite C/C++ Interface¡·¶ÔSQLiteÖеÄËùÓÐC/C++½Ó¿ÚÌṩÁËÏêϸµÄʹÓÃ˵Ã÷¡£Ò»µ©¶ÁÕßÀí½âÁËSQLiteµÄ»ù±¾²Ù×÷Ô­Àí£¬ÕâƪÎĵµ¾ÍÓ¦µ±×÷Ϊһ±¾²Î¿¼Êֲᡣ±¾ÆªÎÄÕ½ö½öÊÇSQLiteµÄÒ»¸öÈëÃŽéÉÜ£¬¶ø²»ÊÇÍêÕûºÍȨÍþÐÔµÄSQLite API²Î¿¼Ö¸ÄÏ¡£
1.0 ºËÐĶÔÏóºÍ½Ó¿Ú
SQLÊý¾Ý¿âÒýÇæµÄ×îÖ÷ÒªÈÎÎñÊǽâÎöSQLÓï¾ä¡£ÎªÁË´ï³ÉÕâ¸öÄ¿µÄ£¬¿ª·¢ÕßÐèÒªÁ˽âÁ½¸ö¶ÔÏó£º
* Êý¾Ý¿âÁ¬½Ó¶ÔÏó£ºsqlite3
* Ô¤´¦ÀíÓï¾ä¶ÔÏó£ºsqlite3_stmt
ÑϸñÀ´½²£¬Ô¤´¦ÀíÓï¾ä¶ÔÏó²¢²»ÊDZØÐëµÄ£¬ÒòΪÄܹ»Ê¹ÓÃsqlite_exec»òÕßsqlite3_get_tableÕâЩ±ãÓÚʹÓõķâ×°½Ó¿Ú£¬¶øÕâЩ½Ó¿Ú·â×°²¢Òþ²ØÁËÔ¤´¦ÀíÓï¾ä¶ÔÏó¡£¾¡¹ÜÈç´Ë£¬¶ÔÔ¤´¦Àí¶ÔÏóµÄÀí½âÓÐÖúÓÚÎÒÃǸü³ä·ÖµÄʹÓÃSQLite¡£
Êý¾Ý¿âÁ¬½Ó¶ÔÏóºÍÔ¤´¦Àí¶ÔÏóÊÇÓÉÏÂÁеÄÒ»×éC/C++½Ó¿Úµ÷ÓòÙ×ݵģº
* sqlite3_open()
* sqlite3_prepare()
* sqlite3_step()
* sqlite3_column()
* sqlite3_finalize()
* sqlite3_close()
Õâ6¸öC/C++½Ó¿ÚÀý³ÌºÍÉÏÊöµÄÁ½¸ö¶ÔÏó¹¹³ÉÁËSQLiteµÄºËÐŦÄÜ¡£¿ª·¢Õ߶ÔÓÚËüÃǵÄÀí½âÄܹ»¸üºÃµÄʹÓÃSQLite¡£
×¢Ò⣬Õâ¸ö½Ó¿ÚÀý³ÌÁбí¸ü¶àÊǸÅÄîÉϵÄÒâÒå¶ø²»ÊÇʵ¼ÊµÄ½Ó¿Ú¡£Ðí¶àÕâЩ½Ó¿Ú¶¼³öÏÖÔÚ¸÷¸ö°æ±¾Ö®ÖС£ÀýÈ磬ÉÏÊöÁбíÖеÄsqlite3_open()Àý³Ìʵ¼ÊÉÏÓÐÈý¸ö²»Í¬µÄ½Ó¿ÚÒÔÂÔ΢²»Í¬µÄ·½Ê½ÊµÏÖÏàͬµÄ¹¦ÄÜ£ºslqite3_open()£¬sqlite3_open16()ºÍsqlite3_open_v2()¡£ÁбíÖеÄʵ¼ÊÉϲ¢²»´æÔÚsqlite3_column()Õâ¸ö½Ó¿Ú¡£ÏÔʾÔÚÁбíÖеēsqlite3_column()”½ö½öÊÇÒ»¸öռ룬±íʾһÕûÌ×ÓÃÓÚ´Ó±íÖвéѯ³ö¸÷ÖÖÊý¾ÝÀàÐ͵ÄÁмǼ½Ó¿Ú¡£
ÕâÀï˵Ã÷ϺËÐĽӿڵÄÖ÷Òª¹¦ÄÜ£º
* sqlite3_open() ¸Ã½Ó¿Ú´ò¿ªÓëÒ»¸öSQLiteÊý¾Ý¿âÎļþµÄÁ¬½Ó²¢·µ»ØÒ»¸öÊý¾Ý¿âÁ¬½Ó¶ÔÏó¡£Õâͨ³£ÊÇÓ¦ÓóÌÐòµ÷ÓõĵÚÒ»¸öSQLite API½Ó¿Ú¶øÇÒÒ²Êǵ÷ÓÃÆäËûSQLite API½Ó¿ÚÇ°ÐèÒªµ÷ÓõĽӿڡ£Ðí¶àSQLite½Ó¿ÚÐèÒªÒ»¸öÖ¸ÏòÊý¾Ý¿âÁ¬½Ó¶ÔÏóµÄÖ¸Õë×÷ΪËüÃǵĵÚÒ»¸ö²ÎÊý£¬Òò¶øÕâЩ½Ó¿ÚÒ²¿ÉÒÔÀí½â³ÉÊÇÊý


Ïà¹ØÎĵµ£º

C++ÖÐʹÓÃsqlite

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include ".\sqlite3_lib\sqlite3.h"
 
static int _callback_exec(void * notused,int argc, char ** argv, char ** aszColName)
{
    int i;
    for ( i=0; i<argc; i++ )
   ......

ÎÒÃÇÒ»Æðѧϰ sqlite µÄÓ¦ÓÃ


                                                       ......

sqliteÖб¨no such tableµÄ´íÎó½â¾ö·½·¨

ÕâÁ½ÌìC/SµÄÏîÄ¿ÖÐÓõ½ÁËsqlite£¬Õâ¸öС¶«Î÷»¹ÕæÊǺÃÓ᣷ÃÎÊËٶȺܿ첻˵£¬Éú³ÉµÄÊý¾Ý¿âÎļþÒ²ºÜС¡£·Ç³£ÊʺÏСÐÍÏîÄ¿µÄÊý¾Ý¿â¡£winceÖÐÇ¿ÁÒ½¨ÒéʹÓá£
²»¹ý½ñÌìÓöµ½Ò»¸öÎÊÌâÈÃÈËÍ·´ó£¬deleteÊý¾ÝµÄʱºòÌáʾno such table¡£
Êý¾Ý¿âÖеıíÃ÷Ã÷´æÔÚ£¬ÔÚÊý¾Ý¿âÖÐÖ´ÐÐdeleteµÄsqlҲûÓÐÎÊÌâ¡£¿´À´²»ÊÇsqlÓï¾äµÄÎÊÌâ¡£
µ«ÊÇÖ ......

SqliteÖÐÎÄÅÅÐòÑо¿

תÔØʱÇë×¢Ã÷³ö´¦ºÍ×÷ÕßÁªÏµ·½Ê½£ºhttp://blog.csdn.net/absurd
×÷ÕßÁªÏµ·½Ê½£ºLi XianJing <xianjimli at hotmail dot com>
¸üÐÂʱ¼ä£º2006-12-19
SqliteÊÇÒ»¸öÓÃCÓïÑÔʵÏÖµÄСÐÍSQLÊý¾Ý¿âÒýÇæ¡£ËüÌå»ýСÇɵ«¹¦ÄÜÇ¿´ó£¬¶ÔÓ²¼þ×ÊÔ´ÒªÇóºÜµÍ¶øÇÒÐÔÄܱíÏÖ׿Խ£¬·Ç³£ÊʺÏÓÚǶÈëʽӦÓû·¾³¡£×î½ü·¢ÏÖsqlite²¢²»Ö§³ÖÖÐÎ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ