Mysql·Ö²¼ÊÂÎñµÄ̽Ë÷
ÓÉÓÚÏîÄ¿ÐèÒª,¶Ômysql·Ö²¼ÊÂÎñÓÐÒ»¶¨ÒªÇó.ÕâÀïÏȼòµ¥ËµÃ÷±ØÒª.
¼ÙÉè,ÈÕ³£²ÆÎñÖÐ,ÒªÍê³ÉÒ»¸öÓµ»¤¶©¹º,±ØÐ뽫¶¨µ¥²Ù×÷ºÍ²ÆÎñ²Ù×÷·âÔÚÒ»¸öÊÂÎñÖвÅÄܱ£Ö¤½»Ò×ÍêÕûÐÔ.
Èç¹û¶¨µ¥ºÍ²ÆÎñÊý¾Ý¶¼·Ö²¼ÔÚ¸÷×ÔµÄʵÀýÖÐ,Ôò±ØÐëÓ÷ֲ¼ÊÂÎñ²ÅÄÜÂú×ã.
·Ï»°²»¶à£¬½øÈë·Ö²¼ÊÂÎñ̽Ë÷¡£
(±¾ÎÄÀý×ÓÀ´×ÔÍøÂ磬±¾ÎÄÖ»×¢ÖØ̽Ë÷£©
1.ÔÚ±¾»ú localhostºÍÁíһ̨»úÆ÷ÉÏ192.168.123.xxxÉÏÖ§³Ö·Ö²¼ÊÂÎñµÄÊý¾Ý¿âtestÀィϱí:
CREATE TABLE `test_transation1` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
2.È»ºóÿ¸ö±í·Ö±ð²åÈëÊý¾Ý
insert into test_transation1 (name) value('jonhn2');
insert into test_transation1 (name) value('jonhn');
3.ÓÃϽű¾²âÊÔ
<?php
$mapfarm = new mysqli("192.168.123.xx","test","testtest","test");
$map = new mysqli("localhost","root","","test");
$age = rand(1, 255);
$grid = uniqid("");
$map->query("XA START '$grid'");
$mapfarm->query("XA START '$grid'");
$values = array(1,"");
$id = rand(1,2);
try {
$sql="UPDATE test_transation1 SET name=$age WHERE id=$id";
print $sql." 113 <br>";
$return = $map->query($sql);
if($return == false) {
throw new Exception("<a href='http://'>113¸üÐÂʧ°Ü!$sql </a>");
}
$sql="UPDATE test_transation1 SET name=$age WHERE id=$id";
print $sql." 116 <br>";
$return = $mapfarm->query($sql);
if($return == false) {
throw new Exception("116¸üÐÂʧ°Ü! ");
}
$map->query("XA END '$grid'");
$map->query("XA PREPARE '$grid'");
$mapfarm->query("XA END '$grid'");
$mapfarm->query("XA PREPARE '$grid'");
$mapfarm->query("XA COMMIT '$grid'");
$map->query("XA COMMIT '$grid'");
} catch (Exception $e) {
$mapfarm->query("XA ROLLBACK '$grid'");
$map->query("XA ROLLBACK '$grid'");
print "roll
Ïà¹ØÎĵµ£º
MYSQLÖÐÖ»ÓÐINNODBºÍBDBÀàÐ͵ÄÊý¾Ý±í²ÅÄÜÖ§³ÖÊÂÎñ´¦Àí£¡ÆäËûµÄÀàÐÍÊDz»Ö§³ÖµÄ£¡
$lnk = mysql_connect("localhost", "root", "");
mysql_select_db("test");
mysql_query("BEGIN");
$query = mysql_query("INSERT INTO test VALUES(1, 'yangjun')&quo ......
±¾ÎÄתÔØ×Ô£ºhttp://hi.baidu.com/xiaoxiaolq/blog/item/7984dcbf15dd030018d81f27.html
MyISAMºÍInnoDBÊÇÔÚʹÓÃMySQL×î³£ÓõÄÁ½¸ö±íÀàÐÍ£¬¸÷ÓÐÓÅȱµã£¬ÊÓ¾ßÌåÓ¦Óöø¶¨¡£»ù±¾µÄ²î±ðΪ£ºMyISAMÀàÐͲ»Ö§³ÖÊÂÎñ´¦ÀíµÈ¸ß¼¶´¦Àí£¬¶øInnoDBÀàÐÍÖ§³Ö¡£MyISAMÀàÐ͵ıíÇ¿µ÷µÄÊÇÐÔÄÜ£¬ÆäÖ´ÐÐÊý¶È±ÈInnoDBÀàÐ͸ü¿ì£¬µ«ÊDz»Ìá¹©Ê ......
Õ⼸Ìì°²×°ÁËһ̨linux·þÎñÆ÷¡£±¾À´Ò»Î»Í¦¼òµ¥¸öÊ£¬Ã»Ïëµ½ÕÛÌÚÁ˺ü¸Ìì¡£
Ê×ÏÈÊÇ °²×° AS4.4
·þÎñÆ÷ÊÇÁªÏë R520 G6£¬±¾ÒÔΪŪ¸öаæµÄunbuntu¾ÍÄÜÇý¶¯ÆðÀ´£¬Ã»Ïëµ½ÉÏÀ´¾ÍÓöµ½ÁËÂé·³¡£Ð°æµÄlinux»¹ÊÇû°ì·¨Çý¶¯ÆðÀ´£¬ÁªÏëËæ»ú¸øµÄÇý¶¯×î¸ß¾Íµ½AS4.4£¬Ã»°ì·¨Ö»ºÃÕÒÕÒAS4.4 °²×°ÁË¡£
Ê×ÏȹâÅÌÆô¶¯ ÊäÈë linux dd&nb ......