SQLite3 C/C++ ¿ª·¢½Ó¿Ú¼ò½é£¨APIº¯Êý£©
SQLite3ÊÇSQLiteÒ»¸öȫеİ汾,ËüËäÈ»ÊÇÔÚSQLite 2.8.13µÄ´úÂë»ù´¡Ö®ÉÏ¿ª·¢µÄ,µ«ÊÇʹÓÃÁ˺Í֮ǰµÄ°æ±¾²»¼æÈݵÄÊý¾Ý¿â¸ñʽºÍAPI. SQLite3ÊÇΪÁËÂú×ãÒÔϵÄÐèÇó¶ø¿ª·¢µÄ:
Ö§³ÖUTF-16±àÂë.
Óû§×Ô¶¨ÒåµÄÎı¾ÅÅÐò·½·¨.
¿ÉÒÔ¶ÔBLOBs×ֶν¨Á¢Ë÷Òý.
Òò´ËΪÁËÖ§³ÖÕâЩÌØÐÔÎҸıäÁËÊý¾Ý¿âµÄ¸ñʽ,½¨Á¢ÁËÒ»¸öÓë֮ǰ°æ±¾²»¼æÈݵÄ3.0°æ. ÖÁÓÚÆäËûµÄ¼æÈÝÐԵĸıä,ÀýÈçȫеÄAPIµÈµÈ,¶¼½«ÔÚÀíÂÛ½éÉÜÖ®ºóÏòÄã˵Ã÷,ÕâÑù¿ÉÒÔʹÄã×î¿ìµÄÒ»´ÎÐÔ°ÚÍѼæÈÝÐÔÎÊÌâ.
3.0°æµÄºÍ2.X°æµÄAPI·Ç³£ÏàËÆ,µ«ÊÇÓÐһЩÖØÒªµÄ¸Ä±äÐèҪעÒâ. ËùÓÐAPI½Ó¿Úº¯ÊýºÍÊý¾Ý½á¹¹µÄǰ׺¶¼ÓÉ"sqlite_
"¸ÄΪÁË"sqlite3_
". ÕâÊÇΪÁ˱ÜÃâͬʱʹÓÃSQLite 2.XºÍSQLite 3.0ÕâÁ½¸ö°æ±¾µÄʱºò·¢ÉúÁ´½Ó³åÍ».
ÓÉÓÚ¶ÔÓÚCÓïÑÔÓ¦¸ÃÓÃʲôÊý¾ÝÀàÐÍÀ´´æ·ÅUTF-16±àÂëµÄ×Ö·û´®²¢Ã»ÓÐÒ»ÖµĹ淶. Òò´ËSQLiteʹÓÃÁËÆÕͨµÄvoid* ÀàÐÍÀ´Ö¸ÏòUTF-16±àÂëµÄ×Ö·û´®. ¿Í»§¶ËʹÓùý³ÌÖпÉÒÔ°Ñvoid*Ó³Éä³ÉÊʺÏËûÃǵÄϵͳµÄÈκÎÊý¾ÝÀàÐÍ.
2.0 C/C++ ½Ó¿Ú
SQLite 3.0Ò»¹²ÓÐ83¸öAPIº¯Êý,´ËÍ⻹ÓÐһЩÊý¾Ý½á¹¹ºÍÔ¤¶¨Òå(#defines). (ÍêÕûµÄAPI½éÉÜÇë²Î¿´ÁíÒ»·ÝÎĵµ.)
²»¹ýÄãÃÇ¿ÉÒÔ·ÅÐÄ,ÕâЩ½Ó¿ÚʹÓÃÆðÀ´²»»áÏñËüµÄÊýÁ¿Ëù°µÊ¾µÄÄÇô¸´ÔÓ. ×î¼òµ¥µÄ³ÌÐòÈÔȻʹÓÃÈý¸öº¯Êý¾Í¿ÉÒÔÍê³É: sqlite3_open(),
sqlite3_exec(), ºÍ sqlite3_close().
ÒªÊÇÏë¸üºÃµÄ¿ØÖÆÊý¾Ý¿âÒýÇæµÄÖ´ÐÐ,¿ÉÒÔʹÓÃÌṩµÄsqlite3_prepare()º¯Êý°ÑSQLÓï¾ä±àÒë³É×Ö½ÚÂë,È»ºóÔÚʹÓÃ
sqlite3_step()º¯ÊýÀ´Ö´ÐбàÒëºóµÄ×Ö½ÚÂë. ÒÔsqlite3_column_¿ªÍ·µÄÒ»×éAPIº¯ÊýÓÃÀ´»ñÈ¡²éѯ½á¹û¼¯ÖеÄÐÅÏ¢.
Ðí¶à½Ó¿Úº¯Êý¶¼ÊdzɶԳöÏÖµÄ,ͬʱÓÐUTF-8ºÍUTF-16Á½¸ö°æ±¾. ²¢ÇÒÌṩÁËÒ»×麯ÊýÓÃÀ´Ö´ÐÐÓû§×Ô¶¨ÒåµÄSQLº¯ÊýºÍÎı¾ÅÅÐòº¯Êý.
2.1 ÈçºÎ´ò¿ª¹Ø±ÕÊý¾Ý¿â
typedef struct sqlite3 sqlite3;
int sqlite3_open(const char*, sqlite3**);
int sqlite3_open16(const void*, sqlite3**);
int sqlite3_close(sqlite3*);
const char *sqlite3_errmsg(sqlite3*);
const void *sqlite3_errmsg16(sqlite3*);
int sqlite3_errcode(sqlite3*);
sqlite3_open() º¯Êý·µ»ØÒ»¸öÕûÊý´íÎó´úÂë,¶ø²»ÊÇÏñµÚ¶þ°æÖÐÒ»Ñù·µ»ØÒ»¸öÖ¸Ïòsqlite3½á¹¹ÌåµÄÖ¸Õë.
sqlite3_open() ºÍ sqlite3_open16() µÄ²»Í¬Ö®´¦ÔÚÓÚsqlite3_open16()
ʹÓÃUTF-16±àÂë(ʹÓñ¾µØÖ÷»ú×Ö½Ú˳Ðò)´«µÝÊý¾Ý¿âÎļþÃû. Èç¹ûÒª´´½¨ÐÂÊý¾Ý¿â, sqlite3_open16()
½«ÄÚ²¿
Ïà¹ØÎĵµ£º
C/C++ÊÇ×îÖ÷ÒªµÄ±à³ÌÓïÑÔ¡£ÕâÀïÁгöÁË50ÃûÓÅÐãÍøÕ¾ºÍÍøÒ³Çåµ¥£¬ÕâЩÍøÕ¾Ìṩc/c++Ô´´úÂë¡£Õâ·ÝÇåµ¥ÌṩÁËÔ´´úÂëµÄÁ´½ÓÒÔ¼°ËüÃǵÄС˵Ã÷¡£ÎÒÒÑ
¾¡Á¦°üÀ¨×î¼ÑµÄC/C++Ô´´úÂëµÄÍøÕ¾¡£Õâ²»ÊÇÒ»¸öÍêÕûµÄÇåµ¥£¬ÄúÓн¨Òé¿ÉÒÔÁªÏµÎÒ£¬ÎÒ½«»¶ÓÄúµÄ½¨Ò飬ÒÔ½øÒ»²½¼ÓÇ¿Õâ·½ÃæµÄÇåµ¥¡£
1¡¢http://snippets.dzone.com/tag/c/
--Ê ......
1 ÏÂÔØ°²×°jre£¬Eclipse±¾ÉíÊÇJava³ÌÐò£¬ÔËÐеÄʱºòÐèÒªjre¡£
2 ÏÂÔØEclispe for C/C++£¬½âѹµ½ÈÎÒâλÖá£
3 ÏÂÔØMingw°²×°³ÌÐò£¬ÔËÐУ¬Ñ¡ÔñÐèÒªµÄ×é¼þ£¬ÎÒÑ¡ÔñÁËg++±àÒëÆ÷ºÍMakefile¹¤¾ß£¬Ëü»á×Ô¶¯ÏÂÔØ°²×°¡£
4 ÏÂÔØ°²×°gdbµ½MingwµÄ°²×°Ä¿Â¼£¬gdbµÄbinºÍincludeĿ¼»áºÍMingwµÄͬÃûĿ¼ºÏ²¢µÄ¡£
ÏÂÃ濪ʼÅäÖÃEclipse¡ ......
Regarding C Run-Time Error R6034 for VS2005/VS2008
Regarding "C Run-Time Error R6034"
Microsoft's recommendation is very confusing. That is, it recommends to include a manifest file and to re-compile the project.
I recently had a problem with 'R6034' error message even with a manifest file ......
³£¼ûÎÊÌ⣺
±àÒëʧ°Ü£¬±¨´íÈçÏ“ÎÞ·¨½âÎöµÄÍⲿ·ûºÅ _WSACleanup@0”µÈ¡£
ÔÒòÊÇûÓÐÒýÓÃwinsock.hËùÔڵĿâ--Ws2_32.lib¡£
ÕâʱֻҪÌí¼ÓÒ»ÐдúÂë
#pragma comment( lib, "Ws2_32.lib")
¼´¿É¡£ ......
C/C++Í·ÎļþÒ»ÀÀ ÊÕ²Ø
C/C++Í·ÎļþÒ»ÀÀ
C¡¢´«Í³ C++
#include <assert.h>¡¡¡¡¡¡¡¡//É趨²åÈëµã
#include <ctype.h>¡¡¡¡¡¡¡¡ //×Ö·û´¦Àí
#include <errno.h>¡¡¡¡¡¡¡¡ //¶¨Òå´íÎóÂë
#include <float.h>¡¡¡¡¡¡¡¡ //¸¡µãÊý´¦Àí
#include <fstream.h>¡¡¡¡¡¡ //ÎļþÊäÈ룯Êä³ö
#i ......