c++µ÷ÓÃmysql½Ó¿ÚÒÔ¼°´æ´¢¹ý³Ì
mysqlÔÚsdkÖÐΪcÓïÑÔÌṩÁËһЩ·ÃÎʽӿڣ¬ÎÒÃÇ¿ÉÒÔʹÓÃÕâЩ½Ó¿ÚÁ¬½Ó²¢·ÃÎÊmysqlÊý¾Ý¿â£¬µ±È»Ò²¿ÉÒÔµ÷ÓÃmysqlµÄ´æ´¢¹ý³Ì¡£
Àý×Ó£º
Ê×ÏÈÏÂÔØmysqlµÄsdk£¬½âѹºÃÒÔºó£¬ÀïÃæ°üº¬Ò»¸öinclude,ºÍlibÎļþ¼Ð¡£ÎÒÃÇÔÚ×Ô¼ºµÄ¹¤³ÌÖаüº¬ÕâÁ½¸öÎļþ¼ÐµÄĿ¼£¬²¢ÇÒÉèÖúÃÁ¬½Ó¿âÑ¡Ïî¼´¿É¡£ ÎÒÃÇÏȽ¨Á¢Ò»¸ö¹¤³Ì£¬ÔËÐÐÏ¿´¿´£¬ÔÙ¿´ÆäÖеĴúÂë¡£
1. ÕâÀïÎÒÃÇʹÓÃvs2003½¨Á¢Ò»¸ö¿ÕµÄwindow console¹¤³Ì£¬Ìí¼ÓÒ»¸öcppÔ´Îļþ¡£
2. ¿½±´×îºóÃæµÄÔ´´úÂëµ½cppÎļþÖС£
3. ÉèÖúù¤³Ì·¾¶£ºproject --> properity --> c/c++ÏÂgeneralÑ¡ÏîÖÐAdditional include directoriesÑ¡ÏîÌí¼ÓÉÏÃæ˵µÄincludeĿ¼¡£ project --> properity --> linkerÏÂgeneralÑ¡ÏîÖÐAdditional library directoriesÖÐÌí¼ÓÉÏÃæµÄlibĿ¼¡£project --> properity --> linkerÏÂinputÑ¡ÏîÖÐÌí¼Ólibmysql.libÎļþ¡£ÕâÑùÎÒÃǵŤ³Ì¾ÍÉèÖÃÍê±Ï¡£
4. ÏÂÃæ±àÒë-Á¬½Ó-ÔËÐС£ÔÚ´°¿ÚÖпÉÒÔ¿´µ½½á¹û¡£
×ܽ᣺
1. mysqlÌṩmysql_query()À´ÔÚcÓïÑÔÖÐʹÓÃsqlÓï¾äÀ´·ÃÎÊÊý¾Ý¿â¡£Í¬Àí£¬ÎÒÃÇ¿ÉÒÔʹÓøýӿÚÖ´ÐÐcall processname()Õâ¸öÓï·¨À´µ÷ÓÃmysqlµÄ´æ´¢¹ý³Ì¡£´úÂëÖÐÒ²ÊÇÕâôʹÓõġ£
2. ÕâÀïÎÒÃÇÐèÒªÌáÇ°ÔÚmysqlÊý¾Ý¿âÖд´½¨Ò»¸ö´æ´¢¹ý³Ì£¬¾ßÌåµÄ´´½¨·½·¨£¬ÔÚÎÄÕ¡¾mysql´æ´¢¹ý³Ì¼ò½é ¡¿ÖÐÓнéÉÜ¡£
3. °üº¬mysql.hÐèÒª°üº¬window.h²Å¿ÉÒÔÕý³£±àÒë¡£
¸½
Êý¾Ý¿â˵Ã÷£º
¸ÃÀý×ÓÖУ¬ÎÒÃÇÒѾÔÚtestÊý¾Ý¿âÖн¨Á¢Ò»¸öshop±í£¬ÆäÖÐÓÐÈý¸ö×ֶΣ¬article int(4), dealer char(20), price double(16,2)¡£ ´æ´¢¹ý³ÌΪÔÚshop±íÖÐÔö¼ÓÒ»Ìõ¼Ç¼¡£
mysql´æ´¢¹ý³Ì´úÂ룺
CREATE DEFINER=`root`@`localhost` PROCEDURE `AddInfo`(`_article` int(4), `_dealer` char(20), `_price` double(16,2) )
BEGIN
set @result = 0;
insert into shop values( _article, _dealer, _price );
 
Ïà¹ØÎĵµ£º
/*
* XMLTool.h ÅäÖÃÎļþ½âÎö¶¯Ì¬¿âÍ·Îļþ
* Ö÷ÒªÊä³öº¯Êý½Ó¿Ú·Ö±ðʵÏÖ¶ÔÅäÖÃÎļþµÄ¶ÁÈ¡ºÍдÈ룬Õë¶Ô½á¹û¼¯µÄ¸´ÖÆÇå¿Õ£¬ºÍÁ½¸ö×Ö·û´®´¦Àíº¯Êý
* ¶ÁÈ¡ÅäÖÃÎļþ½Ó¿Ú £ºint ReadXMLFile(XML_Node_Vector *XmlNodeVector, string filepath);
* дÈëÅäÖ ......
дUnmanaged CodeÔÚ.NETʱ´ú³ÉΪһÖֺܱ¯²ÒµÄÊ£¬µ±ÄãÐèÒª´¦ÀíXMLÎļþʱ£¬ÕâÖָоõ»á±äµÃÓÈÆäÇ¿ÁÒ¡£FCLÖеÄSystem.XML¶à¼òµ¥°¡£¬Á¬Steve Ballmer¶¼ÖªµÀÔõôÓá£
ÊÂÇé²»»á×ÜÊÇÄÇôÀíÏëµÄ£¬¼ÙÈçÄãÒªÔÚC/C++³ÌÐòÀï´¦ÀíXMLÔõô°ìÄØ£¿
Ñ¡ÔñÒ»£ºÊÐÃæÉϵÄXML lib»¹ÊÇÓм¸¸öµÄ£¬×îÓÐÃûµÄµ±È»ÊÇlibXML¡£ÎÒÒ»ÄêÇ°Óùý£¬ºÜ²»´í£¬ÎÒ»¹ ......
¡¡1.¸ÅÊö
¡¡¡¡Ðí¶à³õѧÕ߶ÔC/C++ÓïÑÔÖеÄvoid¼°voidÖ¸ÕëÀàÐͲ»ÉõÀí½â£¬Òò´ËÔÚʹÓÃÉϳöÏÖÁËһЩ´íÎó¡£±¾ÎĽ«¶Ôvoid¹Ø¼ü×ÖµÄÉî¿Ìº¬Òå½øÐнâ˵£¬²¢ÏêÊövoid¼°voidÖ¸ÕëÀàÐ͵ÄʹÓ÷½·¨Óë¼¼ÇÉ¡£
¡¡¡¡2.voidµÄº¬Òå
¡¡¡¡voidµÄ×ÖÃæÒâ˼ÊÇ“ÎÞÀàÐÍ”£¬void *ÔòΪ“ÎÞÀàÐÍÖ¸Õ딣¬void *¿ÉÒÔÖ¸ÏòÈκÎÀàÐ͵ÄÊý¾ ......
Á½ÖÖÀàÐÍ×îÖ÷ÒªµÄ²î±ð¾ÍÊÇInnodb Ö§³ÖÊÂÎñ´¦ÀíÓëÍâ¼üºÍÐм¶Ëø.¶øMyISAM²»Ö§³Ö.ËùÒÔMyISAMÍùÍù¾ÍÈÝÒ×±»ÈËÈÏΪֻÊʺÏÔÚСÏîÄ¿ÖÐʹÓá£
ÎÒ×÷ΪʹÓÃMySQLµÄÓû§½Ç¶È³ö·¢£¬InnodbºÍMyISAM¶¼ÊDZȽÏϲ»¶µÄ£¬µ«ÊÇ´ÓÎÒÄ¿Ç°ÔËάµÄÊý¾Ý¿âƽ̨Ҫ´ïµ½ÐèÇó£º99.9%µÄÎȶ¨ÐÔ£¬·½±ãµÄÀ©Õ¹ÐԺ͸߿ÉÓÃÐÔÀ´ËµµÄ»°£¬MyISAM¾ø¶ÔÊÇÎÒµÄÊ×Ñ¡¡£
ÔÒ ......