/** * setForceMaster 設定要不要強制從 master 抓資料。 * * @param mixed $enable * @static * @access public * @return void */ public static function setForceMaster($enable) { self::$_force_master = intval($enable); }
/** * refreshRowData 去資料庫更新這一個 row 的資料 * * @access public * @return void */ public function refreshRowData() { $db = $this->getRowDb(); $this->_relation_data = array(); // 若 db 不支援 immediate_consistency ,就不需要去 db 更新資料了 if (!$db->support('immediate_consistency')) { return; } // XXX: 保險起見這邊強制從 master 抓 if ($db->support('force_master')) { $old_force_master = Pix_Table::$_force_master; Pix_Table::$_force_master = true; } if ($row = $db->fetchOne($this->getTable(), $this->getPrimaryValues())) { $this->_data = $this->_orig_data = $row; } if ($db->support('force_master')) { Pix_Table::$_force_master = $old_force_master; } }