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

MySQLµÄLOCK TABLES/UNLOCK TABLES

LOCK TABLES/UNLOCK TABLES ¾ä·¨
LOCK TABLES tbl_name [AS alias] {READ [LOCAL] | [LOW_PRIORITY] WRITE}
[, tbl_name [AS alias] {READ [LOCAL] | [LOW_PRIORITY] WRITE} ...]
...
UNLOCK TABLES
LOCK TABLES Ϊµ±Ç°Ïß³ÌËø¶¨±í¡£UNLOCK TABLES Êͷŵ±Ç°Ïß³ÌÓµÓеÄËùÓÐËø¶¨¡£µ±Ï̷߳¢³öÁíÒ»¸ö LOCK TABLES£¬»òµ±Óë·þÎñÆ÷µÄÁ¬½Ó±»¹Ø±Õʱ£¬±»µ±Ç°Ïß³ÌËø¶¨µÄËùÓÐ±í½«±»×Ô¶¯µØ½âËø¡£
ΪÁËÔÚ MySQL 4.0.2 ʹÓà LOCK TABLES £¬Äã±ØÐëÓµÓÐÒ»¸öÈ«¾ÖµÄ LOCK TABLES ȨÏÞºÍÒ»¸öÔÚÏà¹Ø±íÉ쵀 SELECT ȨÏÞ¡£ÔÚ MySQL 3.23 ÖУ¬Äã¶Ô¸Ã±íÐèÒªÓÐ SELECT¡¢insert¡¢DELETE ºÍ UPDATE ȨÏÞ¡£
ʹÓà LOCK TABLES µÄÖ÷ÒªÔ­ÒòÊÇ£¬·ÂЧÊÂÎñ´¦Àí»òÔÚ¸üбíʱµÃµ½¸ü¿ìµÄËٶȡ£´Ëºó»áÓиüÏêϸµÄÃèÊö¡£
Èç¹ûÒ»¸öÏß³ÌÔÚÒ»¸ö±íÉϵõ½Ò»¸ö READ Ëø£¬¸ÃÏß³Ì (ºÍËùÓÐÆäËüÏß³Ì) Ö»ÄÜ´Ó±íÖжÁÈ¡¡£Èç¹ûÒ»¸öÏß³ÌÔÚÒ»¸ö±íÉϵõ½Ò»¸ö WRITE Ëø£¬ÄÇôֻÓÐÓµÓÐÕâ¸öËøµÄÏ߳̿ÉÒÔ´Ó±íÖжÁÈ¡ºÍд±í¡£ÆäËüµÄÏ̱߳»×èÈû¡£
READ LOCAL ºÍ READ Ö®¼äµÄ²»Í¬¾ÍÔÚÓÚ£¬µ±Ëø±»¼ÓÔØʱ£¬READ LOCAL ÔÊÐí·Ç³åÍ»(non-conflicting) INSERT Óï¾äÖ´ÐС£Èç¹ûµ±Äã¼ÓÔØ×ÅËøʱ´Ó MySQL Íⲿ²Ù×÷Êý¾Ý¿âÎļþ£¬Õ⽫ÈÔ²»Äܱ»Ê¹Óá£
µ±ÄãʹÓà LOCK TABLES Êǵأ¬Äã±ØÐëËø¶¨ËùÓÐÄ㽫ʹÓÃµÄ±í£¬²¢ÇÒ±ØÐëʹÓÃÓëÄãµÄ²éѯÖн«Ê¹ÓõıðÃûÏàͬ£¡Èç¹ûÄãÔÚÒ»¸ö²éѯÖжà´ÎʹÓÃÒ»¸ö±í(ÓñðÃû)£¬Äã±ØÐëΪÿһ¸ö±ðÃû»ñµÃÒ»¸öËø¡£
WRITE Ëøͨ¹ý±È READ ËøÓиü¸ßµÄȨÏÞ£¬ÒÔÈ·±£¸üб»¾¡¿ìµØ´¦Àí¡£Õâ¾ÍÒâζ×Å£¬Èç¹ûÒ»¸öÏ̻߳ñµÃÒ»¸ö READ Ëø£¬¶øͬʱÁíÍâÒ»¸öÏß³ÌÇëÇóÒ»¸ö WRITE Ëø£¬²¢·¢µÄ READ ËøÇëÇ󽫵ȴýÖ±µ½ WRITE Ï̵߳õ½ÁËËø²¢ÊÍ·ÅÁËËü¡£Äã¿ÉÒÔʹÓà LOW_PRIORITY WRITE Ëø£¬µ±¸ÃÏß³ÌÔڵȴý WRITE Ëøʱ£¬Ëü½«ÔÊÐíÆäËüµÄÏ̻߳ñµÃ READ Ëø¡£ ÄãÓ¦¸ÃֻʹÓà LOW_PRIORITY WRITE Ëø£¬Èç¹ûÄãÈ·ÐÅÕ⽫ÊÇ×îºóÒ»´Î£¬µ±Ã»ÓÐÏ߳̽«ÓµÓÐ READ Ëø¡£
LOCK TABLES ¹¤×÷ÈçÏ£º
ÒÔÄÚ²¿¶¨ÒåµÄ´ÎÐòÅÅÐòËùÓб»Ëø¶¨µÄ±í (´ÓÓû§Á¢³¡Ëµ£¬¸Ã´ÎÐòÊDz»Ã÷È·µÄ)¡£
Èç¹ûÒ»¸ö±í±»ÒÔÒ»¸ö¶ÁËøºÍÒ»¸öдËøËø¶¨£¬½«Ð´Ëø·ÅÔÚ¶ÁËø֮ǰ¡£
Ò»´ÎÖ»Ëø¶¨Ò»¸ö±í£¬Ö»µ½Ï̵߳õ½ËùÓеÄËø¶¨¡£
Õâ¸ö·½°¸ÊÇΪÁËÈ·±££¬±íËø¶¨ËÀËøÊÍ·Å¡£ ¶ÔÓÚÕâ¸öģʽÄãÈÔÈ»ÓÐЩÆäËüÊÂÇéÐèÒªÖªµÀ£º
Èç¹ûÄã¶ÔÒ»¸ö±íʹÓÃÒ»¸ö LOW_PRIORITY WRITE Ëø¶¨£¬Õâ¾ÍÒâζ×Å£¬MySQL ½«µÈ´ýÕâ¸öËø£¬Ö±µ½Ã»ÓÐÏß³ÌÇëÇóÒ»¸ö READ Ëø¡£µ±Ï̵߳õ½ÁË WRITE Ëø£¬²¢µÈ´ý»ñµÃËø¶¨±íÁбíÖеÄÏÂÒ»¸ö


Ïà¹ØÎĵµ£º

ÅäÖÃMySQLÖ÷´Ó¸´ÖÆ(Replication)


MySQLÖ§³Öµ¥Ïò¡¢Òì²½¸´ÖÆ£¬¸´Öƹý³ÌÖÐÒ»¸ö·þÎñÆ÷³äµ±Ö÷·þÎñÆ÷£¬¶øÒ»¸ö»ò¶à¸öÆäËü·þÎñÆ÷³äµ±´Ó·þÎñÆ÷¡£Ö÷·þÎñÆ÷½«¸üÐÂдÈë¶þ½øÖÆÈÕÖ¾Îļþ£¬²¢Î¬»¤ÈÕÖ¾ÎļþµÄÒ»¸öË÷ÒýÒÔ¸ú×ÙÈÕ־ѭ»·¡£µ±Ò»¸ö´Ó·þÎñÆ÷Á¬½Óµ½Ö÷·þÎñÆ÷ʱ£¬Ëü֪ͨÖ÷·þÎñÆ÷´Ó·þÎñÆ÷ÔÚÈÕÖ¾ÖжÁÈ¡µÄ×îºóÒ»´Î³É¹¦¸üеÄλÖᣴӷþÎñÆ÷½ÓÊÕ´ÓÄÇʱÆð·¢ÉúµÄÈκθüУ¬È ......

MySqlÊý¾Ý¿âÖÐÎÄÂÒÂë½â¾ö·½·¨


½â¾öÂÒÂë×îºÃµÄ·½·¨ÊÇÔÚÏîÄ¿Éè¼ÆÖ®³õ£¬Í³Ò»ËùÓеÄ×Ö·û¼¯£¬ÀýÈçÒ³Ãæ¡¢request¶ÔÏóÒÔ¼°Êý¾Ý¿âµÈµÈ¡£
Ò»¡¢
¼¸ÖÖ³£¼ûµÄÂÒÂëÏÖÏó£º
1¡¢Ò³ÃæÂÒÂë
   
µ¥´¿µÄÒ³ÃæÂÒÂëÊǺܺýâ¾öµÄ£¬Ö»ÒªÐÞ¸ÄÍ·²¿ÊʺϵÄ×Ö·û¼¯¼´¿É£¬Èç¹ûÒ³ÃæÖÐÎÄÏÔʾÂÒÂ룬Äã¿ÉÒÔ°Ñ×Ö·û¼¯ÐÞ¸ÄΪ£ºgb2312»ògbk¡£
2¡¢
Ò³ÃæÖ®¼ä´«µÝµÄ²Î ......

ʵÀý½²½âÈçºÎʹÓÃC++²Ù×÷MySQLÊý¾Ý¿âÀà

 
¡¡¡¡ÓÃC++²Ù×÷MySQLÊý¾Ý¿âÀࣺ
¡¡¡¡×¢ÊÍ£ºÕ⼸¸öÀà¶Ô´¦Àí²»ÊǺܴóÊý¾ÝÁ¿µÄ²Ù×÷ÊǺÜÀíÏëµÄ£¬ µ«²»ÊÊÒËÌØ´óÐ͵ÄÊý¾ÝµÄ²éѯ£¬ÒòΪԴÂëÖн«²éѯµ½µÄÊý¾ÝÖ±½Ó·ÅÈëÁËÄÚ´æ¡£
¡¡¡¡/*
¡¡¡¡* project:
¡¡¡¡* ͨÓÃÄ£¿é ( Óà c++ ´¦Àí mysql Êý¾Ý¿âÀ࣬ÏñADO )
¡¡¡¡*
¡¡¡¡* description:
¡¡¡¡*
¡¡¡¡* ͨ¹ýDataBase,Reco ......

windows»·¾³ÏµÄPHP+Apache+MySqlµÄ»·¾³´î½¨

²Ù×÷ϵͳ: windows xp
php°æ±¾:5.2.5 http://www.php.net/downloads.php
Apache http server °æ±¾:2.2.6http://httpd.apache.org/download.cgi
Mysql°æ±¾: 6.0.3http://dev.mysql.com/get/Downloads/MySQL-6.0
1.apacheµÄ°²×°:
1)Ë«»÷apache_2.2.6-win32-x86-no_ssl.msiͼ±ê£¬Æô¶¯apache°²×°³ÌÐò£»
2£©°²×°ÒÔÒ»¸ö»¶Ó­ ......

MySQLµÄ±íËøÎÊÌâ

ÔÚmysqlÊÖ²áÀïÃæÓÐÒ»¶ÎÃèÊö¹ØÓÚlock tablesµÄÓï·¨µÄ.
LOCK TABLES    tbl_name [AS alias] {READ [LOCAL] | [LOW_PRIORITY] WRITE}    [, tbl_name [AS alias] {READ [LOCAL] | [LOW_PRIORITY] WRITE}] ...UNLOCK TABLESREAD
µ±±í²»´æÔÚ WRITE дËøʱ READ ¶ÁËø±»Ö´ÐÐ,Õâ¸Ã״̬ÏÂ,µ±Ç°Ïß³Ì ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ