メモります、つまり、メモリ増す。

概要

引数

実装

    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.

0
Posted by check it out 2014年01月23日(木) 01:09:21 返信

コメントをかく


「http://」を含む投稿は禁止されています。

利用規約をご確認のうえご記入下さい

管理人/副管理人のみ編集できます