⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 peardb_oci8.php

📁 PhpWiki是sourceforge的一个开源项目
💻 PHP
字号:
<?php // -*-php-*-rcs_id('$Id: PearDB_oci8.php,v 1.8 2005/01/18 20:55:48 rurban Exp $');/** * Oracle extensions for the Pear DB backend. * @author: Philippe.Vanhaesendonck@topgame.be */require_once('lib/WikiDB/backend/PearDB_pgsql.php');class WikiDB_backend_PearDB_oci8extends WikiDB_backend_PearDB_pgsql{    /**     * Constructor     */    function WikiDB_backend_PearDB_oci8($dbparams) {        // Backend constructor        $this->WikiDB_backend_PearDB($dbparams);                // Empty strings are NULLS        $this->_expressions['notempty'] = "IS NOT NULL";        $this->_expressions['iscontent'] = "DECODE(DBMS_LOB.GETLENGTH(content), NULL, 0, 0, 0, 1)";        // Set parameters:        $dbh = &$this->_dbh;        // - No persistent conections (I don't like them)        $dbh->setOption('persistent', false);        // - Set lowercase compatibility option        // - Set numrows as well -- sure why this is needed, but some queries         //   are triggering DB_ERROR_NOT_CAPABLE        $dbh->setOption('portability',            DB_PORTABILITY_LOWERCASE | DB_PORTABILITY_NULL_TO_EMPTY | DB_PORTABILITY_NUMROWS);    }                /**     * Pack tables.     */    function optimize() {        // Do nothing here -- Leave that for the DBA        // Cost Based Optimizer tuning vary from version to version        return 1;    }    /**     * Lock all tables we might use.     */    function _lock_tables($write_lock=true) {        $dbh = &$this->_dbh;                // Not sure if we really need to lock tables here, the Oracle row        // locking mechanism should be more than enough        // For the time being, lets stay on the safe side and lock...        if ($write_lock) {            // Next line is default behaviour, so just skip it            // $dbh->query("SET TRANSACTION READ WRITE");            foreach ($this->_table_names as $table) {                $dbh->query("LOCK TABLE $table IN EXCLUSIVE MODE");            }        } else {            // Just ensure read consistency            $dbh->query("SET TRANSACTION READ ONLY");        }    }};class WikiDB_backend_PearDB_oci8_searchextends WikiDB_backend_PearDB_search{    // If we want case insensitive search, one need to create a Context    // Index on the CLOB. While it is very efficient, it requires the    // Intermedia Text option, so let's stick to the 'simple' thing    // Note that this does only an exact fulltext search, not using MATCH or LIKE.    function _fulltext_match_clause($node) {         $page = $node->sql($word);        $exactword = $node->_sql_quote();        return ($this->_case_exact                ? "pagename LIKE '$page' OR DBMS_LOB.INSTR(content, '$exactword') > 0"                : "LOWER(pagename) LIKE '$page' OR DBMS_LOB.INSTR(content, '$exactword') > 0");    }}// (c-file-style: "gnu")// Local Variables:// mode: php// tab-width: 8// c-basic-offset: 4// c-hanging-comment-ender-p: nil// indent-tabs-mode: nil// End:   ?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -