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

MySQLµÄcµ÷ÓÃ


1. ¸½¼ÓÏîÒ»¶¨ ¼ÓÉÏlibmysql.lib¡£
2. include Ò»¶¨¼ÓÉÏ mysqlµÄinclude£¨ÒòΪҪÅÜÕâ¹Ø¼üÒ»¾ä
#include <mysql.h>£©
3  lib Ò»¶¨¼ÓÉÏ mysqlµÄlib
 
ºÃÁËÏÂÃæÊÇʵÀýºÍphpº¯Êý»ù±¾Ò»ÑùµÄ¡£±¾È˲»¿ÉÄܸøÄã·­ÒëÎĵµ£¬º¯Êý²»¶®×Ô¼º¿´¡£
#include
<windows.h>//ÓÃÕâ¸ö·½±ã£¬°üº¬winsock.hËùÒÔ°üº¬winsockÒ²¿ÉÒÔ
#include <iostream>
#include <mysql.h>
using namespace std;
int main( int argc, char * argv[] )
{
//ÕâÀàÐͱð´íÁË£¬¾ßÌå¿´Îĵµ
 MYSQL mysql;
 MYSQL *pdata;
 MYSQL_RES
*result;   
 MYSQL_ROW
row;   
 char sqlcommand[80];
 mysql_init(&mysql);//Ò»¸ö³õʼ»¯
 mysql_options(&mysql,MYSQL_READ_DEFAULT_GROUP,"Gamer");
//¿ØÖÆÁ´½ÓÐÐΪµÄ
 pdata=mysql_real_connect(&mysql,"localhost","root","123456","gamer",0,NULL,0);
//Êý¾Ý¿âÁ´½Ó
 if(pdata)
 {
  cout<<"connect
successful!!"<<endl;
 }
 if(mysql_select_db(pdata,"gamerdata"))
 {
  cout<<"select_db
successful!!"<<endl;
 }
//È»ºóÑ¡ÔñÊý¾Ý¿âÁË£¬µ±È»ÓÃsqlÒ»Ñù£¬º¯Êý¿´×Å·½±ãµã
 sprintf(sqlcommand,"select * from
gamerdata");   
 
 mysql_query(pdata,sqlcommand);
//Õâ¾ä¸ÉʲôµÄ²»ÓÃÎÒ·Ñ´½ÉàÁË
 result =
mysql_use_result(pdata);
//»ñÈ¡¼Ç¼¼¯
 row = mysql_fetch_row(result);
//°´Êý×鷽ʽ°ÑÊý¾Ý·Åµ½rowÖУ¬µ±Ç°ÐеÄ
//¿´ËùÓÐÐмӸöÑ­»·¾ÍºÃ£¬Óαê×Ô¼º»áÅÜ£¬²»ÀÍ´ó¼Ò·ÑÐÄ¡£
 cout<<row[1];
//¿ÉÒÔÊä³öÁË£¬´ó¹¦¸æ³É
 mysql_close(pdata);
//±ðÍüÁË¿ªµÆ£¬ÍüÁ˹صÆ
}


Ïà¹ØÎĵµ£º

Mysql Explain Ïê½â

Mysql Explain Ïê½â
ת×ÔITPUBhttp://www.itpub.net/viewthread.php?tid=1034410&extra=page%3D1%26amp%3Bfilter%3Ddigest&page=1
Ò».Óï·¨
explain < table_name >
ÀýÈç: explain select * from t3 where id=3952602;
¶þ.explainÊä³ö½âÊÍ
+----+-------------+-------+-------+-------------------+--- ......

Mysql ´íÎó×ܽá

/***************************by
garcon1986********************************/
1.´´½¨±í¸ñʱ´íÎó£º ERROR 1005: Can't
create table (errno: 150)
 Õâ¸ö´íÎóÊÇÓÐÓÉÓÚÖ÷±íºÍÒýÓñíµÄÍâ¼ü¹ØÁª×ֶζ¨Òå²»Ò»ÖÂÒý·¢µÄ¡£
¼ì²éÁ½¸ö±íµÄ¹ØÁª×Ö¶ÎÊÇ·ñÀàÐͱàÂëÍêȫһÖ¡£
 ÁíÍ⻹ÓÐÒ»ÖÖ¿ÉÄܾÍÊǹØÁª×Ö¶ÎÔÚÒýÓñíÖÐ ......

C/C++ÖÐ×óÖµºÍÓÒÖµµÄ²î±ð

ÎÒÃdz£ËµµÄ×óÖµlvalueºÍÓÒÖµrvalue²¢²»¼òµ¥µØÒâζ×Å×óÓÒÇø±ð£¬ËüµÄԭʼ¶¨ÒåÈçÏ£º
Definition:
C and C++ have the notion of lvalues and rvalues associated with
variables and constants. The rvalue is the data value of the variable,
that is, what information it contains. The "r" in rvalue can ......

»ùÓÚSphinx+MySQLÈ«ÎļìË÷¼Ü¹¹Éè¼Æ

ǰÑÔ£º
±¾ÎIJûÊöµÄÊÇÒ»¿î¾­¹ýÉú²ú»·¾³¼ìÑéµÄǧÍò¼¶Êý¾ÝÈ«ÎļìË÷£¨ËÑË÷ÒýÇæ£©¼Ü¹¹¡£±¾ÎÄÖ»Áгöǰ¼¸ÕµÄÄÚÈݽÚÑ¡£¬²»ÌṩȫÎÄÄÚÈÝ¡£
ÔÚDELL PowerEdge 6850·þÎñÆ÷£¨ËÄ¿Å64 λInter Xeon MP 7110N´¦ÀíÆ÷ / 8GBÄڴ棩¡¢RedHat AS4 Linux²Ù×÷ϵͳ¡¢MySQL 5.1.26¡¢MyISAM´æ´¢ÒýÇæ¡¢key_buffer=1024M»·¾³ÏÂʵ²â£¬µ¥±í1000ÍòÌõ¼Ç ......

cµÄ¹ØÓÚÊý×é³õʼ»¯ ºÍ memsetÓ÷¨

½ñÌìΪÁ˳¹µ×¸ã¶¨Ò»¸ö¹ØÓÚcÖÐÊý×é³õʼ»¯ºÍÉùÃ÷²»Í¬Çé¿öÏ£¬±ÈÈçÖ»ÉùÃ÷Ò»¸öÊý×échar str[20];ÄÇôÕâstrÀïÃæÊÇʲôÄÚÈÝÄØ£¿ÎÒÓÃvc6++£¬debugÏ¿´µ½¶¼ÊÇ-56¶öascÂ룬ºóÀ´Çë½ÌÁËÒ»¸ö»ªÎªµÄ´óÅ££¬Ëû˵ °´ÕÕÀíÂÛÀ´ËµÀïÃæµÄÄÚÈݶ¼ÊÇÓпÉÄܵģ¬ÕâºÍ½Ð×ö“ÔàÄÚ´æ”»òÕß½Ð×ö“Ò°Êý×锡£ºÃÁ˵ÚÒ»¸öÎÊÌâ¸ã¶®ÁË¡£
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ