source: trunk/phpgwapi/inc/adodb/drivers/adodb-odbc_oracle.inc.php @ 2

Revision 2, 3.2 KB checked in by niltonneto, 18 years ago (diff)

Removida todas as tags usadas pelo CVS ($Id, $Source).
Primeira versão no CVS externo.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2/*
3V4.51 29 July 2004  (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
4  Released under both BSD license and Lesser GPL library license.
5  Whenever there is any discrepancy between the two licenses,
6  the BSD license will take precedence.
7Set tabs to 4 for best viewing.
8 
9  Latest version is available at http://adodb.sourceforge.net
10 
11  Oracle support via ODBC. Requires ODBC. Works on Windows.
12*/
13// security - hide paths
14if (!defined('ADODB_DIR')) die();
15
16if (!defined('_ADODB_ODBC_LAYER')) {
17        include(ADODB_DIR."/drivers/adodb-odbc.inc.php");
18}
19
20 
21class  ADODB_odbc_oracle extends ADODB_odbc {   
22        var $databaseType = 'odbc_oracle';
23        var $replaceQuote = "''"; // string to use to replace quotes
24        var $concat_operator='||';
25        var $fmtDate = "'Y-m-d 00:00:00'";
26        var $fmtTimeStamp = "'Y-m-d h:i:sA'";
27        var $metaTablesSQL = 'select table_name from cat';
28        var $metaColumnsSQL = "select cname,coltype,width from col where tname='%s' order by colno";
29        var $sysDate = "TRUNC(SYSDATE)";
30        var $sysTimeStamp = 'SYSDATE';
31       
32        //var $_bindInputArray = false;
33       
34        function ADODB_odbc_oracle()
35        {
36                $this->ADODB_odbc();
37        }
38               
39        function &MetaTables()
40        {
41                if ($this->metaTablesSQL) {
42                        $rs = $this->Execute($this->metaTablesSQL);
43                        if ($rs === false) return false;
44                        $arr = $rs->GetArray();
45                        $arr2 = array();
46                        for ($i=0; $i < sizeof($arr); $i++) {
47                                $arr2[] = $arr[$i][0];
48                        }
49                        $rs->Close();
50                        return $arr2;
51                }
52                return false;
53        }
54       
55        function &MetaColumns($table)
56        {
57                if (!empty($this->metaColumnsSQL)) {
58               
59                        $rs = $this->Execute(sprintf($this->metaColumnsSQL,strtoupper($table)));
60                        if ($rs === false) return false;
61
62                        $retarr = array();
63                        while (!$rs->EOF) { //print_r($rs->fields);
64                                $fld = new ADOFieldObject();
65                                $fld->name = $rs->fields[0];
66                                $fld->type = $rs->fields[1];
67                                $fld->max_length = $rs->fields[2];
68                               
69                               
70                                if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) $retarr[] = $fld;     
71                                else $retarr[strtoupper($fld->name)] = $fld;
72                               
73                                $rs->MoveNext();
74                        }
75                        $rs->Close();
76                        return $retarr;
77                }
78                return false;
79        }
80
81        // returns true or false
82        function _connect($argDSN, $argUsername, $argPassword, $argDatabasename)
83        {
84        global $php_errormsg;
85       
86                $php_errormsg = '';
87                $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword,SQL_CUR_USE_ODBC );
88                $this->_errorMsg = $php_errormsg;
89               
90                $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'");
91                //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true);
92                return $this->_connectionID != false;
93        }
94        // returns true or false
95        function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename)
96        {
97        global $php_errormsg;
98                $php_errormsg = '';
99                $this->_connectionID = odbc_pconnect($argDSN,$argUsername,$argPassword,SQL_CUR_USE_ODBC );
100                $this->_errorMsg = $php_errormsg;
101               
102                $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'");
103                //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true);
104                return $this->_connectionID != false;
105        }
106}
107 
108class  ADORecordSet_odbc_oracle extends ADORecordSet_odbc {     
109       
110        var $databaseType = 'odbc_oracle';
111       
112        function ADORecordSet_odbc_oracle($id,$mode=false)
113        {
114                return $this->ADORecordSet_odbc($id,$mode);
115        }
116}
117?>
Note: See TracBrowser for help on using the repository browser.