MysqlÂÒÂëÖÕ¼«½â¾ö·½°¸
MysqlÂÒÂë²úÉúµÄÔÒò£º
²úÉú´ËÀàÎÊÌâµÄ×î¿ÉÄÜÊÇÄãµÄÊý¾Ý¿âÔÚ°²×°Ê±Ã»ÓÐÑ¡¶Ô×Ö·û¼¯£¬Õâ¸öÊ®·ÖÖØÒª.
Äã¿ÉÒÔͨ¹ýÈçϵķ½Ê½À´²é¿´£º´ò¿ªMysql´°¿Ú£¬ÔÚ´°¿ÚµÄ×î×óÉϽǵã»÷Êó±êÓÒ¼ü£¬Ñ¡ÔñÊôÐÔ£¬¾Í¿ÉÒÔ¿´µ½ÄãĬÈϵÄ×Ö·û±àÂëÁË£¨ÈçÏÂͼ£©£º
2. ʹÓöàÖÖУ¶Ô¹æÔò(Collation)À´±È½Ï×Ö·û´®
MySQL ÖÐÊǸù¾ÝÏÂÃ漸¸ö±äÁ¿È·¶¨·þÎñÆ÷¶ËºÍ¿Í»§¶ËÓõÄʲô×Ö·û¼¯£º
character_set_client¡¡¡¡¡¡ ¡¡ ¿Í»§¶Ë×Ö·û¼¯
¡¡¡¡character_set_connection¡¡¡¡ ¿Í»§¶ËÓë·þÎñÆ÷¶ËÁ¬½Ó²ÉÓõÄ×Ö·û¼¯
¡¡¡¡character_set_results¡¡¡¡¡¡¡¡¡¡SELECT²éѯ·µ»ØÊý¾ÝµÄ×Ö·û¼¯
¡¡¡¡character_set_database¡¡¡¡¡¡¡¡Êý¾Ý¿â²ÉÓõÄ×Ö·û¼¯
MySQLµÄ×Ö·û¼¯´¦ÀíÊÇÕâÑùµÄ£º
¡¡¡¡1¡¢·¢ËÍÇëÇó¡£
¡¡¡¡1)¿Í»§¶Ë·¢ËÍÇëÇóµ½·þÎñÆ÷¶Ë¡£
¡¡¡¡2)·þÎñÆ÷¶Ë»á°ÑÇëÇóµÄÊý¾Ý´Ó¿Í»§¶Ë×Ö·û¼¯(character_set_client)ת³É·þÎñÆ÷Á¬½Ó×Ö·û¼¯(character_set_connection)¡£
¡¡¡¡3)È»áá·þÎñÆ÷»á¼ì²â´æ´¢ÇøÓò(table£¬column)µÄ×Ö·û¼¯£¬È»ºó°ÑÊý¾Ý´ÓÁ¬½Ó×Ö·û¼¯(character_set_connection)תΪ´æ´¢ÇøÓò(table£¬column)µÄ×Ö·û¼¯£¬È»ááÔÙ´æ´¢»òÕß²éѯ¡£
¡¡¡¡2¡¢·µ»ØÇëÇó¡£
¡¡¡¡1)·þÎñÆ÷½«´æ´¢ÇøÓò(table£¬column)µÄ×Ö·û¼¯×ª»»³É·þÎñÆ÷Á¬½Ó×Ö·û¼¯(character_set_connection)¡£
¡¡¡¡2)½«·þÎñÆ÷Á¬½Ó×Ö·û¼¯(character_set_connection)ת»»³É½á¹û×Ö·û¼¯(character_set_results)£¬ÔÙ·¢Ë͵½¿Í»§¶Ë¡£
¿ÉÒÔ²ÉÓÃÈçϼ¸¸ö²½ÖèÈÃÉÏÃæµÄÇëÇó±àÂ붼ͳһ£¬ÕâÑù¾Í²»»á³öÏÖÂÒÂëµÄÎÊÌâÁË£º
£ª£ª£ª£ª£ªÊý¾Ý¿â£ª£ª£ª£ª£ª£ª£ª£ª
Ò»£º×îºÃÔÚ°²×°Ê± Ñ¡Ôñ utf8 »òÕß gbk
¶þ£ºÔÚ´´½¨Êý¾Ý¿âʱʱÓÃÈçÏ·½Ê
Ïà¹ØÎĵµ£º
ÏÈÇ°ÔÚ²âÊÔmysql connect c++½Ó¿ÚµÄʱºòÔËÐÐÆä¹Ù·½ÌṩµÄÀý×Ó
21.5.5.6. MySQL Connector/C++ Complete Example 2
The following code shows a complete example of how to use MySQL Connector/C++:
/* Copyright 2008 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify ......
MySQLÊÖ²áÖп´µ½µÄ£¬¼Ç¼Ï¡£
MySQL¿ÉÒÔΪ¶à¸öÁд´½¨Ë÷Òý¡£Ò»¸öË÷Òý¿ÉÒÔ°üÀ¨15¸öÁС£¶ÔÓÚijЩÁÐÀàÐÍ£¬¿ÉÒÔË÷ÒýÁеÄǰ׺(²Î¼û7.4.3½Ú£¬“ÁÐË÷Òý”)¡£
¶àÁÐË÷Òý¿ÉÒÔÊÓΪ°üº¬Í¨¹ýÁ¬½ÓË÷ÒýÁеÄÖµ¶ø´´½¨µÄÖµµÄÅÅÐòµÄÊý×é¡£
MySQL°´ÕâÑùµÄ·½Ê½Ê¹Óöà ......
×¢Ò⣺mysqlÖеÄÓû§±äÁ¿µÄÉúÃüÖÜÆÚÊǻỰ¼¶µÄ£¬²»ÊÇÓï¾ä¼¶µÄ£¡
´æ´¢¹ý³Ì--------------------------------------------------
drop procedure if exists usp_simple;
delimiter //
create procedure usp_simple(in ip int, out op int, inout iop int)
begin
select count(*) into op from t1;
set op ......
È¡µÃÎÄÕ¹ؼü×ÖΪkeywords
±ínewsµÄ¹Ø¼ü×Ö×Ö¶ÎΪkeyword
keywords=keywords.replace(',','|');
String sql="SELECT * from news WHERE keyword REGEXP '"+keywords+"' ORDER BY id ";
ÓÉÓÚijЩÔÒò£¬ÓÐʱºòÎÒÃÇûÓа´ÕÕ·¶Ê½µÄÉè¼Æ×¼Ôò¶ø°ÑһЩÊôÐԷŵ½Í¬Ò»¸ö×Ö·û´®×Ö¶ÎÖС£±ÈÈç¸öÈËÐËȤ£¬ÓÐʱºòÎÒÃÇÉè¼Æ±íΪ
cr ......
ÎÞÏÞ·ÖÀàÊÇÎÒÃÇ¿ª·¢Öзdz£³£¼ûµÄÓ¦Óã¬ÏñÂÛ̳µÄµÄ°æ¿é£¬CMSµÄÀà±ð£¬Ó¦Óõĵط½Ìرð¶à¡£
ÎÒÃÇ×î³£¼û×î¼òµ¥µÄ·½·¨¾ÍÊÇÔÚMySqlÀïID ,parentID,name£º
ÓŵãÊǼòµ¥£¬½á¹¹¼òµ¥¡£
ȱµãÊÇЧÂʲ»¸ß£¬ÒòΪÿһ´ÎµÝ¹é¶¼Òª²éѯÊý¾Ý¿â£¬¼¸°ÙÌõÊý¾Ý¿âʱ¾Í²»ÊǺܿìÁË£¡
´æ´¢Ê÷ÊÇÒ»ÖÖ³£¼ûµÄÎÊÌ⣬¶àÖÖ½â¾ö·½°¸¡£Ö÷ÒªÓÐÁ½ÖÖ·½·¨£ºÁÚ½Ó±íµ ......