最終更新: daidaibousi 2012年10月19日(金) 03:33:26履歴
function __construct($dsn = '', $force_run = false, $new = false) { if ($dsn == '') { $dsn = array('phptype' => DB_TYPE, 'username' => DB_USER, 'password' => DB_PASSWORD, 'protocol' => 'tcp', 'hostspec' => DB_SERVER, 'port' => DB_PORT, 'database' => DB_NAME ); } // オプション $options = array( // 持続的接続 'persistent' => PEAR_DB_PERSISTENT, // Debugモード 'debug' => PEAR_DB_DEBUG, ); // バッファリング trueにするとメモリが解放されない。 // 連続クエリ実行時に問題が生じる。 $options['result_buffering'] = false; if ($new) { $this->conn = MDB2::connect($dsn, $options); } else { $this->conn = MDB2::singleton($dsn, $options); } if (!PEAR::isError($this->conn)) { $this->conn->setCharset('utf8'); $this->conn->setFetchMode(MDB2_FETCHMODE_ASSOC); } // XXX 上書きインストール時にDBを変更するケースを想定し第1引数を与えている。 $this->dbFactory = SC_DB_DBFactory_Ex::getInstance($this->conn->dsn['phptype']); $this->dbFactory->initObjQuery($this); $this->force_run = $force_run; }
このページへのコメント
IODwdG Great, thanks for sharing this blog post.Really looking forward to read more. Really Cool.