mysql ÀàÐÍת»»º¯Êý
12.8. Castº¯ÊýºÍ²Ù×÷·û
BINARY
BINARY²Ù×÷·û½«ºóÃæµÄ×Ö·û´®Å׸øÒ»¸ö¶þ½øÖÆ×Ö·û´®¡£ÕâÊÇÒ»ÖÖ¼òµ¥µÄ·½Ê½À´´ÙʹÖð×Ö½Ú¶ø²»ÊÇÖð×Ö·ûµÄ½øÐÐÁбȽϡ£ÕâʹµÃ±È½ÏÇø·Ö´óСд£¬¼´Ê¹¸ÃÁв»±»¶¨ÒåΪ BINARY»ò BLOB¡£BINARYÒ²»á²úÉú½áβ¿Õ°×£¬´Ó¶ø¸ü¼ÓÏÔÑÛ¡£
mysql> SELECT 'a' = 'A';
-> 1
mysql> SELECT BINARY 'a' = 'A';
-> 0
mysql> SELECT 'a' = 'a ';
-> 1
mysql> SELECT BINARY 'a' = 'a ';
-> 0
BINARYÓ°ÏìÕû¸ö±È½Ï£»Ëü¿ÉÒÔÔÚÈκβÙ×÷ÊýÇ°±»¸ø¶¨£¬¶ø²úÉúÏàͬµÄ½á¹û¡£
BINARY str ÊÇCAST(str AS BINARY)µÄËõÂÔÐÎʽ¡£
×¢Ò⣬ÔÚһЩÓï¾³ÖУ¬¼ÙÈçÄ㽫һ¸ö±àÈëË÷ÒýµÄÁÐÅɸøBINARY, MySQL ½«²»ÄÜÓÐЧʹÓÃÕâ¸öË÷Òý¡£
¼ÙÈçÄãÏëÒª½«Ò»¸ö BLOBÖµ»òÆäËü¶þ½øÖÆ×Ö·û´®½øÐÐÇø·Ö´óСдµÄ±È½Ï£¬Äã¿ÉÀûÓöþ½øÖÆ×Ö·û´®Ã»ÓÐ×Ö·û¼¯ÕâÒ
Ïà¹ØÎĵµ£º
1¡¢È·¶¨Êý¾Ý¿âĬÈϱàÂ룬±ÈÈç±àÂëΪutf8,½«¶ÁÈë;¾¶±àÂëͬÑùÉèΪutf8£¬ÃüÁîΪ£ºset names utf8;
2¡¢source d:/20080613.sql µ¼ÈëÊý¾Ý¡£ÑéÖ¤Êý¾Ý¿âÖеÄÊý¾ÝÊÇ·ñ´æÔÚÂÒÂë¡£
3¡¢Èç¹ûÈÔÈ»´æÔÚÂÒÂëÎÊÌ⣬Õâʱºò¾ÍÒª¿¼ÂǸı䵼ÈëÎļþµÄ±à ......
MySQLÓкܶà¿ÉÒÔµ¼ÈëÊý¾ÝµÄ·½·¨£¬È»¶øÕâЩֻÊÇÊý¾Ý´«ÊäÖеÄÒ»°ë£¬ÁíÍâµÄÒ»°ãÊÇ´ÓMySQLÊý¾Ý¿âÖе¼³öÊý¾Ý¡£ÓÐÐí¶àµÄÔÒòÎÒÃÇÐèÒªµ¼³öÊý¾Ý¡£Ò»¸öÖØ
ÒªµÄÔÒòÊÇÓÃÓÚ±¸·ÝÊý¾Ý¿â¡£Êý¾ÝµÄÔì¼Û³£³£ÊÇ°º¹óµÄ£¬ÐèÒª½÷É÷´¦ÀíËüÃÇ¡£¾³£µØ±¸·Ý¿ÉÒÔ°ïÖú·ÀÖ¹±¦¹óÊý¾ÝµØ¶ªÊ§£»ÁíÍâÒ»¸öÔÒòÊÇ£¬Ò²ÐíÄúÏ£Íûµ¼³öÊý¾ÝÀ´¹²
Ïí¡£ ÔÚÕâ¸öÐÅÏ¢¼¼Ê ......
Ò»¡¢MYSQL´æ´¢ÒýÇæ´óÈ«£º
·MyISAM£ºÄ¬ÈϵÄMySQL²å¼þʽ´æ´¢ÒýÇ棬ËüÊÇÔÚWeb¡¢Êý¾Ý²Ö´¢ºÍÆäËûÓ¦Óû·¾³ÏÂ×ʹÓõĴ洢ÒýÇæÖ®Ò»¡£×¢Ò⣬ͨ¹ý¸ü¸ÄSTORAGE_ENGINEÅäÖñäÁ¿£¬Äܹ»·½±ãµØ¸ü¸ÄMySQL·þÎñÆ÷µÄĬÈÏ´æ´¢ÒýÇæ¡£
·InnoDB£ºÓÃÓÚÊÂÎñ´¦ÀíÓ¦ÓóÌÐò£¬¾ßÓÐÖÚ¶àÌØÐÔ£¬°üÀ¨ACIDÊÂÎñÖ§³Ö¡£
·BDB£º¿ÉÌæ´úI ......
Ò»:mysqlÀïÄ¿Ç°Ö»Ö§³Ö4ÖÖË÷Òý·Ö±ðÊÇ:b-tree,full-text,hashÒÔ¼°r-treeË÷Òý b-treeË÷ÒýÓ¦¸ÃÊÇmysqlÀï×î¹ã·ºµÄË÷ÒýµÄÁË,³ýÁËarchive,»ù±¾ËùÓеĴ洢ÒýÇ涼֧³ÖËü. 1.b-treeÔÚmyisamÀïµÄÐÎʽºÍinnodbÉÔÓв»Í¬ ÔÚinnodbÀïÃæÓÐÁ½ÖÖÐÎ̬:ÆäÒ»ÊÇprimary keyÐÎ̬Æäleaf nodeÀï´æ·ÅµÄÊÇÊý¾Ý.¶øÇÒ²»½ö´æ·ÅÁËË÷Òý¼üµÄÊý¾Ý,»¹´æ·ÅÁËÆ ......
#include <stdio.h>
#include <windows.h>
#include <mysql.h>
#define host "localhost"
#define username "root"
#define password "123"
#define database "oa"
MYSQL *conn;
int main()
{
MYSQL_RES *res_set;
MYSQL_ROW row;
unsigned int i,ret;
FILE *fp;
MYSQL_FIELD *field;
......