2 rcs_id('$Id: PearDB_oci8.php,v 1.6 2004-12-06 19:50:04 rurban Exp $');
5 * Oracle extensions for the Pear DB backend.
6 * @author: Philippe.Vanhaesendonck@topgame.be
9 require_once('lib/WikiDB/backend/PearDB_pgsql.php');
11 class WikiDB_backend_PearDB_oci8
12 extends WikiDB_backend_PearDB_pgsql
17 function WikiDB_backend_PearDB_oci8($dbparams) {
18 // Backend constructor
19 $this->WikiDB_backend_PearDB($dbparams);
21 // Empty strings are NULLS
22 $this->_expressions['notempty'] = "IS NOT NULL";
23 $this->_expressions['iscontent'] = "DECODE(DBMS_LOB.GETLENGTH(content), NULL, 0, 0, 0, 1)";
27 // - No persistent conections (I don't like them)
28 $dbh->setOption('persistent', false);
29 // - Set lowercase compatibility option
30 // - Set numrows as well -- sure why this is needed, but some queries
31 // are triggering DB_ERROR_NOT_CAPABLE
32 $dbh->setOption('portability',
33 DB_PORTABILITY_LOWERCASE | DB_PORTABILITY_NULL_TO_EMPTY | DB_PORTABILITY_NUMROWS);
41 // Do nothing here -- Leave that for the DBA
42 // Cost Based Optimizer tuning vary from version to version
47 * Lock all tables we might use.
49 function _lock_tables($write_lock=true) {
52 // Not sure if we really need to lock tables here, the Oracle row
53 // locking mechanism should be more than enough
54 // For the time being, lets stay on the safe side and lock...
56 // Next line is default behaviour, so just skip it
57 // $dbh->query("SET TRANSACTION READ WRITE");
58 foreach ($this->_table_names as $table) {
59 $dbh->query("LOCK TABLE $table IN EXCLUSIVE MODE");
62 // Just ensure read consistency
63 $dbh->query("SET TRANSACTION READ ONLY");
68 class WikiDB_backend_PearDB_oci8_search
69 extends WikiDB_backend_PearDB_search
71 // If we want case insensitive search, one need to create a Context
72 // Index on the CLOB. While it is very efficient, it requires the
73 // Intermedia Text option, so let's stick to the 'simple' thing
74 // Note that this does only an exact fulltext search, not using MATCH or LIKE.
75 function _fulltext_match_clause($node) {
76 $page = $node->sql($word);
77 $exactword = $node->_sql_quote();
78 return $this->_case_exact
79 ? "pagename LIKE '$page' OR DBMS_LOB.INSTR(content, '$exactword') > 0"
80 : "LOWER(pagename) LIKE '$page' OR DBMS_LOB.INSTR(content, '$exactword') > 0";
85 // (c-file-style: "gnu")
90 // c-hanging-comment-ender-p: nil
91 // indent-tabs-mode: nil