freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

讀寫分離的三種方法-wenkub

2022-11-13 21:39:24 本頁面
 

【正文】 return ($id = mysql_insert_id($thislink)) = 0 ? $id : $thisresult($thisquery(SELECT last_insert_id()), 0)。 } function num_rows($query) { $query = mysql_num_rows($query)。 } function error() { return (($thislink) ? mysql_error($thislink) : mysql_error())。, $sql)。 $type != 39。 : 39。 function_exists(39。 } $func = $type == 39。 //判斷是否 select 語句 if($thisro_exist amp。 } function query($sql, $type = 39。 } function fetch_one_array($sql, $type = 39。 } } function select_db($dbname) { //同時(shí)操作兩個(gè)數(shù)據(jù)庫連接 $this cur_db = $dbname。dbuser39。 } } //設(shè)置一系列只讀數(shù)據(jù)庫 并且連接其中一個(gè) function set_ro_list($ro_list){ if(is_array($ro_list)){ //隨機(jī)選擇其中一個(gè) $link_ro = $ro_list[array_rand($ro_list)]。 if($thiscur_db){ //如果已經(jīng)選擇過數(shù)據(jù)庫則需要操作一次 mysql_select_db($thiscur_db, $thislink_ro)。 //不產(chǎn)生 halt 錯(cuò)誤 $this connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect, false)。 } } //連接一個(gè)只讀的 mysql 數(shù)據(jù)庫 function connect_ro($dbhost, $dbuser, $dbpw, $dbname = 39。) { mysql_query(SET sql_mode=39。39。amp。 $thishalt(39。Can not connect to MySQL server39。39。 //是否存在有效的只讀數(shù)據(jù)庫連接 var $ro_exist = false。 //當(dāng)前操作的數(shù)據(jù)庫連接 var $link = null。 封裝的方式比較簡(jiǎn)單,增加了只讀數(shù)據(jù)庫連接的接口擴(kuò)展,不使用只讀數(shù)據(jù)庫也不影響原代碼使用。 2. MySQL Proxy+LUA 腳本法 。 3. 更 HA 方式 :MySQL Proxy+MMM。 有待以后不斷完善。 //字符集 var $charset。 //只讀數(shù)據(jù)庫連接 var $link_ro = null。, $pconnect = 0, $halt = TRUE) { if($pconnect) { if(!$thislink = mysql_pconnect($dbhost, $dbuser, $dbpw)) { $halt amp。)。Can not connect to MySQL server39。 !$halt) return false。) { if($thischarset) { mysql_query(SET character_set_connection=$thischarset, character_set_results=$thischarset, character_set_client=binary, $thislink)。39。39。 if($thislink){ //連接成功 //echo link ro sussess!br。 } }else{ //連接失敗 //echo link ro failed!br。 $thisconnect_ro($link_ro[39。], $link_ro[39。 if($thisro_exist){ mysql_select_db($dbname, $thislink_ro)。39。39。amp。UNBUFFERED39。mysql_unbuffered_query39。mysql_query39。SILENT39。 } $this querynum++。 } function errno() { return intval(($thislink) ? mysql_errno($thislink) : mysql_errno())。 return $query。 } function fetch_row($query) { $query = mysql_fetch_row($query)。 } function close() { return mysql_close($thislink)。39。fontsize:11px。\ bMySQL Error/bbr bMessage/b: $messagebr bSQL/b: $sqlbr bError/b: $dberrorbr bErrno./b: $dberrnobr /div。)。39。aslibra39。39。test39。=39。=39。=39。 //connect Master $DBconnect($db_rw[dbhost], $db_rw[dbuser], $db_rw[dbpw], $db_rw[dbname])。test39。 while($row = $DBfetch_array($qr)){ echo $row[a]。 測(cè)試過程中取消了 B 和 C 的 REPLICATION。make install。 +++++++ | Field | Type | Null | Key | Default | Extra | +++++++ | id | int(11) | NO | PRI | NULL | auto_increment | | c_str | char(64) | NO | | | | +++++++ 2 rows in set ( sec) 2 rows in set ( sec) 我在 B 上插入一條記錄 mysql insert into t(c_str) values(39。C39。 下來我們來看試驗(yàn)結(jié)果。 mysql insert into t(c_str) values (39。 +++++++++ | Id | User | Host | db | Command | Time | State | Info | +++++++++ | 12 | t_girl_user | :44975 | t_girl | Sleep | 28 | | NULL | | 13 | t_girl_user | :44976 | t_girl | Sleep | 15 | | NULL | | 14 | t_girl_user | :44977 | t_girl | Sleep | 19 | | NULL | | 15 | t_girl_user | :44978 | t_girl | Query | 0 | NULL | show processlist | +++++++++ 4 rows in set ( sec) 4 rows in set ( sec) 讀數(shù)據(jù)(現(xiàn)在還是寫和讀都在 B 上) mysql select * from t。 waiting for the slave I/O thread to update it | NULL | | 5 | root | localhost | t_girl | Query | 0 | NULL | show processlist | | 12 | t_girl_user | :44975 | t_girl | Sleep | 446 | | NULL | | 13 | t_girl_user | :44976 | t_girl | Sleep | 188 | | NULL | | 14 | t_girl_user | :44977 | t_girl | Sleep | 206 | | NULL | | 15 | t_girl_user | :44978 | t_girl | Sleep | 203 | | NULL | | 16 | t_girl_user | :44979 | t_girl | Sleep | 164 | | NULL | | 17 | t_girl_user | :44980 | t_girl | Sleep | 210 | | NULL | +++++++++ 8 rows in set ( sec) 現(xiàn)在我們來讀數(shù)據(jù)。wangwei39。 還是沒有數(shù)據(jù)。 waiting for the slave I/O thread to update it | NULL | | 5 | root | localhost | t_girl | Query | 0 | NULL | show processlist | | 12 | t_girl_user | :44975 | t_girl | Sleep | 446 | | NULL | | 13 | t_girl_user | :44976 | t_girl | Sleep | 188 | | NULL | | 14 | t_girl_user | :44977 | t_girl | Sleep | 206 | | NULL | | 15 | t_girl_user | :44978 | t_girl | Sleep | 203 | | NULL | | 16 | t_girl_user | :44979 | t_girl | Sleep | 164 | | NULL | | 17 | t_girl_user | :44980 | t_girl | Sleep | 210 | | NULL | +++++++++ 8 rows in set ( sec) mysql select * from t?;镜脑硎亲屩鲾?shù)據(jù)庫處理事務(wù)性查詢,而從數(shù)據(jù)庫處理 SELECT 查詢。 MySQL 協(xié)議首先進(jìn)行握手。
點(diǎn)擊復(fù)制文檔內(nèi)容
公司管理相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號(hào)-1