From 00d69809d435ca17ce73cc2bdbc7cb75cf2f7f02 Mon Sep 17 00:00:00 2001 From: skodak Date: Mon, 16 Oct 2006 08:42:51 +0000 Subject: [PATCH] backported new adodb 4.93 from HEAD --- lib/adodb/adodb-active-record.inc.php | 13 +++-- lib/adodb/adodb-csvlib.inc.php | 2 +- lib/adodb/adodb-datadict.inc.php | 2 +- lib/adodb/adodb-error.inc.php | 2 +- lib/adodb/adodb-errorhandler.inc.php | 2 +- lib/adodb/adodb-errorpear.inc.php | 2 +- lib/adodb/adodb-exceptions.inc.php | 2 +- lib/adodb/adodb-iterator.inc.php | 2 +- lib/adodb/adodb-lib.inc.php | 12 ++--- lib/adodb/adodb-pager.inc.php | 2 +- lib/adodb/adodb-pear.inc.php | 2 +- lib/adodb/adodb-perf.inc.php | 38 ++++++++----- lib/adodb/adodb-php4.inc.php | 2 +- lib/adodb/adodb.inc.php | 47 +++++++++------- lib/adodb/datadict/datadict-access.inc.php | 2 +- lib/adodb/datadict/datadict-db2.inc.php | 2 +- lib/adodb/datadict/datadict-firebird.inc.php | 2 +- lib/adodb/datadict/datadict-generic.inc.php | 2 +- lib/adodb/datadict/datadict-ibase.inc.php | 2 +- lib/adodb/datadict/datadict-informix.inc.php | 2 +- lib/adodb/datadict/datadict-mssql.inc.php | 2 +- lib/adodb/datadict/datadict-mysql.inc.php | 2 +- lib/adodb/datadict/datadict-oci8.inc.php | 2 +- lib/adodb/datadict/datadict-postgres.inc.php | 2 +- lib/adodb/datadict/datadict-sybase.inc.php | 2 +- lib/adodb/drivers/adodb-access.inc.php | 2 +- lib/adodb/drivers/adodb-ado.inc.php | 2 +- lib/adodb/drivers/adodb-ado5.inc.php | 2 +- lib/adodb/drivers/adodb-ado_access.inc.php | 2 +- lib/adodb/drivers/adodb-ado_mssql.inc.php | 3 +- lib/adodb/drivers/adodb-borland_ibase.inc.php | 2 +- lib/adodb/drivers/adodb-csv.inc.php | 2 +- lib/adodb/drivers/adodb-db2.inc.php | 2 +- lib/adodb/drivers/adodb-fbsql.inc.php | 2 +- lib/adodb/drivers/adodb-firebird.inc.php | 2 +- lib/adodb/drivers/adodb-ibase.inc.php | 2 +- lib/adodb/drivers/adodb-informix.inc.php | 2 +- lib/adodb/drivers/adodb-informix72.inc.php | 2 +- lib/adodb/drivers/adodb-ldap.inc.php | 2 +- lib/adodb/drivers/adodb-mssql.inc.php | 22 ++++---- lib/adodb/drivers/adodb-mssqlpo.inc.php | 2 +- lib/adodb/drivers/adodb-mysql.inc.php | 2 +- lib/adodb/drivers/adodb-mysqli.inc.php | 4 +- lib/adodb/drivers/adodb-mysqlt.inc.php | 2 +- lib/adodb/drivers/adodb-netezza.inc.php | 2 +- lib/adodb/drivers/adodb-oci8.inc.php | 8 +-- lib/adodb/drivers/adodb-oci805.inc.php | 2 +- lib/adodb/drivers/adodb-oci8po.inc.php | 2 +- lib/adodb/drivers/adodb-odbc.inc.php | 2 +- lib/adodb/drivers/adodb-odbc_db2.inc.php | 2 +- lib/adodb/drivers/adodb-odbc_mssql.inc.php | 54 +++++++++++++++---- lib/adodb/drivers/adodb-odbc_oracle.inc.php | 2 +- lib/adodb/drivers/adodb-odbtp.inc.php | 2 +- lib/adodb/drivers/adodb-odbtp_unicode.inc.php | 2 +- lib/adodb/drivers/adodb-oracle.inc.php | 2 +- lib/adodb/drivers/adodb-pdo.inc.php | 4 +- lib/adodb/drivers/adodb-pdo_mssql.inc.php | 2 +- lib/adodb/drivers/adodb-pdo_mysql.inc.php | 2 +- lib/adodb/drivers/adodb-pdo_oci.inc.php | 2 +- lib/adodb/drivers/adodb-pdo_pgsql.inc.php | 2 +- lib/adodb/drivers/adodb-postgres.inc.php | 2 +- lib/adodb/drivers/adodb-postgres64.inc.php | 12 ++++- lib/adodb/drivers/adodb-postgres7.inc.php | 11 +--- lib/adodb/drivers/adodb-postgres8.inc.php | 2 +- lib/adodb/drivers/adodb-proxy.inc.php | 2 +- lib/adodb/drivers/adodb-sapdb.inc.php | 2 +- lib/adodb/drivers/adodb-sqlanywhere.inc.php | 2 +- lib/adodb/drivers/adodb-sqlite.inc.php | 2 +- lib/adodb/drivers/adodb-sqlitepo.inc.php | 2 +- lib/adodb/drivers/adodb-sybase.inc.php | 2 +- lib/adodb/drivers/adodb-sybase_ase.inc.php | 2 +- lib/adodb/drivers/adodb-vfp.inc.php | 2 +- lib/adodb/perf/perf-db2.inc.php | 2 +- lib/adodb/perf/perf-informix.inc.php | 2 +- lib/adodb/perf/perf-mssql.inc.php | 2 +- lib/adodb/perf/perf-mysql.inc.php | 2 +- lib/adodb/perf/perf-oci8.inc.php | 2 +- lib/adodb/perf/perf-postgres.inc.php | 2 +- lib/adodb/pivottable.inc.php | 2 +- lib/adodb/readme_moodle.txt | 15 ++---- lib/adodb/rsfilter.inc.php | 2 +- lib/adodb/session/adodb-compress-bzip2.php | 2 +- lib/adodb/session/adodb-compress-gzip.php | 2 +- lib/adodb/session/adodb-cryptsession.php | 2 +- lib/adodb/session/adodb-cryptsession2.php | 2 +- lib/adodb/session/adodb-encrypt-mcrypt.php | 2 +- lib/adodb/session/adodb-encrypt-md5.php | 2 +- lib/adodb/session/adodb-encrypt-secret.php | 2 +- lib/adodb/session/adodb-session-clob.php | 2 +- lib/adodb/session/adodb-session-clob2.php | 2 +- lib/adodb/session/adodb-session.php | 2 +- lib/adodb/session/adodb-session2.php | 2 +- lib/adodb/session/old/adodb-cryptsession.php | 2 +- lib/adodb/session/old/adodb-session-clob.php | 2 +- lib/adodb/session/old/adodb-session.php | 2 +- lib/adodb/session/session_schema2.xml | 2 +- lib/adodb/toexport.inc.php | 2 +- lib/adodb/tohtml.inc.php | 2 +- 98 files changed, 235 insertions(+), 178 deletions(-) diff --git a/lib/adodb/adodb-active-record.inc.php b/lib/adodb/adodb-active-record.inc.php index c5c6cb79f2c..fb2395154f3 100644 --- a/lib/adodb/adodb-active-record.inc.php +++ b/lib/adodb/adodb-active-record.inc.php @@ -1,7 +1,7 @@ $d) { - if ($d->db == $db) return $k; + if (PHP_VERSION >= 5) { + if ($d->db == $db) return $k; + } else { + if ($d->db->_connectionID == $db->_connectionID && $db->database == $d->db->database) + return $k; + } } $obj = new ADODB_Active_DB(); @@ -218,12 +223,12 @@ class ADODB_Active_Record { break; default: foreach($cols as $name => $fldobj) { - $name = ($name); + $name = ($fldobj->$name); $this->$name = null; $attr[$name] = $fldobj; } foreach($pkeys as $k => $name) { - $keys[$name] = ($name); + $keys[$name] = $cols[$name]->name; } break; } diff --git a/lib/adodb/adodb-csvlib.inc.php b/lib/adodb/adodb-csvlib.inc.php index e7923db870b..a031d985cc7 100644 --- a/lib/adodb/adodb-csvlib.inc.php +++ b/lib/adodb/adodb-csvlib.inc.php @@ -8,7 +8,7 @@ $ADODB_INCLUDED_CSV = 1; /* - V4.92a 29 Aug 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. + V4.93 10 Oct 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. See License.txt. diff --git a/lib/adodb/adodb-datadict.inc.php b/lib/adodb/adodb-datadict.inc.php index 9674cd95c59..edfa5a65c8f 100644 --- a/lib/adodb/adodb-datadict.inc.php +++ b/lib/adodb/adodb-datadict.inc.php @@ -1,7 +1,7 @@ $v) { - if ($autoQuote && !is_numeric($v) and strncmp($v,"'",1) !== 0 and strcasecmp($v,'null')!=0) { + if ($autoQuote && !is_numeric($v) and strncmp($v,"'",1) !== 0 and strcasecmp($v,$zthis->null2null)!=0) { $v = $zthis->qstr($v); $fieldArray[$k] = $v; } @@ -616,7 +616,7 @@ function _adodb_getupdatesql(&$zthis,&$rs, $arrFields,$forceUpdate=false,$magicq //********************************************************// if (is_null($arrFields[$upperfname]) || (empty($arrFields[$upperfname]) && strlen($arrFields[$upperfname]) == 0) - || $arrFields[$upperfname] === 'null' + || $arrFields[$upperfname] === $zthis->null2null ) { switch ($force) { @@ -638,7 +638,7 @@ function _adodb_getupdatesql(&$zthis,&$rs, $arrFields,$forceUpdate=false,$magicq default: case 3: //Set the value that was given in array, so you can give both null and empty values - if (is_null($arrFields[$upperfname]) || $arrFields[$upperfname] === 'null') { + if (is_null($arrFields[$upperfname]) || $arrFields[$upperfname] === $zthis->null2null) { $setFields .= $field->name . " = null, "; } else { $setFields .= _adodb_column_sql($zthis, 'U', $type, $upperfname, $fnameq,$arrFields, $magicq); @@ -779,7 +779,7 @@ static $cacheCols; /********************************************************/ if (is_null($arrFields[$upperfname]) || (empty($arrFields[$upperfname]) && strlen($arrFields[$upperfname]) == 0) - || $arrFields[$upperfname] === 'null' + || $arrFields[$upperfname] === $zthis->null2null ) { switch ($force) { @@ -801,7 +801,7 @@ static $cacheCols; default: case 3: //Set the value that was given in array, so you can give both null and empty values - if (is_null($arrFields[$upperfname]) || $arrFields[$upperfname] === 'null') { + if (is_null($arrFields[$upperfname]) || $arrFields[$upperfname] === $zthis->null2null) { $values .= "null, "; } else { $values .= _adodb_column_sql($zthis, 'I', $type, $upperfname, $fnameq, $arrFields, $magicq); diff --git a/lib/adodb/adodb-pager.inc.php b/lib/adodb/adodb-pager.inc.php index c302d8e4556..0aa3e6a69b2 100644 --- a/lib/adodb/adodb-pager.inc.php +++ b/lib/adodb/adodb-pager.inc.php @@ -1,7 +1,7 @@ fnExecute = false; + $connx->fnExecute = false; $t0 = microtime(); - $rs =& $conn->Execute($sql,$inputarr); + $rs =& $connx->Execute($sql,$inputarr); $t1 = microtime(); - if (!empty($conn->_logsql) && (empty($conn->_logsqlErrors) || !$rs)) { + if (!empty($connx->_logsql) && (empty($connx->_logsqlErrors) || !$rs)) { + global $ADODB_LOG_CONN; + + if (!empty($ADODB_LOG_CONN)) { + $conn = &$ADODB_LOG_CONN; + if ($conn->databaseType != $connx->databaseType) + $prefix = '/*dbx='.$connx->databaseType .'*/ '; + else + $prefix = ''; + } else { + $conn =& $connx; + $prefix = ''; + } + $conn->_logsql = false; // disable logsql error simulation $dbT = $conn->databaseType; @@ -84,8 +96,8 @@ function& adodb_log_sql(&$conn,$sql,$inputarr) $time = $a1 - $a0; if (!$rs) { - $errM = $conn->ErrorMsg(); - $errN = $conn->ErrorNo(); + $errM = $connx->ErrorMsg(); + $errN = $connx->ErrorNo(); $conn->lastInsID = 0; $tracer = substr('ERROR: '.htmlspecialchars($errM),0,250); } else { @@ -126,6 +138,7 @@ function& adodb_log_sql(&$conn,$sql,$inputarr) } if (is_array($sql)) $sql = $sql[0]; + if ($prefix) $sql = $prefix.$sql; $arr = array('b'=>strlen($sql).'.'.crc32($sql), 'c'=>substr($sql,0,3900), 'd'=>$params,'e'=>$tracer,'f'=>adodb_round($time,6)); //var_dump($arr); @@ -136,7 +149,7 @@ function& adodb_log_sql(&$conn,$sql,$inputarr) if (empty($d)) $d = date("'Y-m-d H:i:s'"); if ($conn->dataProvider == 'oci8' && $dbT != 'oci8po') { $isql = "insert into $perf_table values($d,:b,:c,:d,:e,:f)"; - } else if ($dbT == 'odbc_mssql' || $dbT == 'informix' || $dbT == 'odbtp') { + } else if ($dbT == 'odbc_mssql' || $dbT == 'informix' || strncmp($dbT,'odbtp',4)==0) { $timer = $arr['f']; if ($dbT == 'informix') $sql2 = substr($sql2,0,230); @@ -152,7 +165,6 @@ function& adodb_log_sql(&$conn,$sql,$inputarr) if ($dbT == 'db2') $arr['f'] = (float) $arr['f']; $isql = "insert into $perf_table (created,sql0,sql1,params,tracer,timer) values( $d,?,?,?,?,?)"; } - $ok = $conn->Execute($isql,$arr); $conn->debug = $saved; @@ -178,10 +190,10 @@ function& adodb_log_sql(&$conn,$sql,$inputarr) $conn->_logsql = false; } } - $conn->_errorMsg = $errM; - $conn->_errorCode = $errN; + $connx->_errorMsg = $errM; + $connx->_errorCode = $errN; } - $conn->fnExecute = 'adodb_log_sql'; + $connx->fnExecute = 'adodb_log_sql'; return $rs; } diff --git a/lib/adodb/adodb-php4.inc.php b/lib/adodb/adodb-php4.inc.php index abe990b3e51..a23dc17038c 100644 --- a/lib/adodb/adodb-php4.inc.php +++ b/lib/adodb/adodb-php4.inc.php @@ -1,7 +1,7 @@ = 5.0) { + if ($_adodb_ver >= 5.2) { + define('ADODB_PHPVER',0x5200); + } else if ($_adodb_ver >= 5.0) { define('ADODB_PHPVER',0x5000); } else if ($_adodb_ver > 4.299999) { # 4.3 define('ADODB_PHPVER',0x4300); @@ -166,12 +168,13 @@ // Initialize random number generator for randomizing cache flushes - srand(((double)microtime())*1000000); + // -- note Since PHP 4.2.0, the seed becomes optional and defaults to a random value if omitted. + srand(((double)microtime())*1000000); /** * ADODB version as a string. */ - $ADODB_vers = 'V4.90 8 June 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. Released BSD & LGPL.'; + $ADODB_vers = 'V4.93 10 Oct 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. Released BSD & LGPL.'; /** * Determines whether recordset->RecordCount() is used. @@ -305,6 +308,8 @@ var $transCnt = 0; /// count of nested transactions var $fetchMode=false; + + var $null2null = 'null'; // in autoexecute/getinsertsql/getupdatesql, this value will be converted to a null // // PRIVATE VARS // @@ -323,6 +328,8 @@ var $_logsql = false; var $_transmode = ''; // transaction mode + + /** * Constructor */ @@ -1408,7 +1415,8 @@ function &CacheGetAll($secs2cache,$sql=false,$inputarr=false) { - return $this->CacheGetArray($secs2cache,$sql,$inputarr); + $arr =& $this->CacheGetArray($secs2cache,$sql,$inputarr); + return $arr; } function &CacheGetArray($secs2cache,$sql=false,$inputarr=false) @@ -2937,8 +2945,12 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1 if ($ADODB_EXTENSION) { if ($numIndex) { while (!$this->EOF) { - // $results[trim($this->fields[0])] = array_slice($this->fields, 1); - // Fix for array_slice re-numbering numeric associative keys in PHP5 + $results[trim($this->fields[0])] = array_slice($this->fields, 1); + adodb_movenext($this); + } + } else { + while (!$this->EOF) { + // Fix for array_slice re-numbering numeric associative keys $keys = array_slice(array_keys($this->fields), 1); $sliced_array = array(); @@ -2947,20 +2959,18 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1 } $results[trim(reset($this->fields))] = $sliced_array; - - adodb_movenext($this); - } - } else { - while (!$this->EOF) { - $results[trim(reset($this->fields))] = array_slice($this->fields, 1); adodb_movenext($this); } } } else { if ($numIndex) { while (!$this->EOF) { - //$results[trim($this->fields[0])] = array_slice($this->fields, 1); - // Fix for array_slice re-numbering numeric associative keys in PHP5 + $results[trim($this->fields[0])] = array_slice($this->fields, 1); + $this->MoveNext(); + } + } else { + while (!$this->EOF) { + // Fix for array_slice re-numbering numeric associative keys $keys = array_slice(array_keys($this->fields), 1); $sliced_array = array(); @@ -2971,11 +2981,6 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1 $results[trim(reset($this->fields))] = $sliced_array; $this->MoveNext(); } - } else { - while (!$this->EOF) { - $results[trim(reset($this->fields))] = array_slice($this->fields, 1); - $this->MoveNext(); - } } } } else { @@ -3548,6 +3553,8 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1 'DATE' => 'D', 'D' => 'D', ## + 'UNIQUEIDENTIFIER' => 'C', # MS SQL Server + ## 'TIME' => 'T', 'TIMESTAMP' => 'T', 'DATETIME' => 'T', diff --git a/lib/adodb/datadict/datadict-access.inc.php b/lib/adodb/datadict/datadict-access.inc.php index aac218262ea..b6b5379e39e 100644 --- a/lib/adodb/datadict/datadict-access.inc.php +++ b/lib/adodb/datadict/datadict-access.inc.php @@ -1,7 +1,7 @@ PrepareSP('sp_server_info'); - $val = 2; + if ($this->fetchMode === false) { $savem = $ADODB_FETCH_MODE; $ADODB_FETCH_MODE = ADODB_FETCH_NUM; } else $savem = $this->SetFetchMode(ADODB_FETCH_NUM); + + if (0) { + $stmt = $this->PrepareSP('sp_server_info'); + $val = 2; + $this->Parameter($stmt,$val,'attribute_id'); + $row = $this->GetRow($stmt); + } - - $this->Parameter($stmt,$val,'attribute_id'); - $row = $this->GetRow($stmt); - - //$row = $this->GetRow("execute sp_server_info 2"); + $row = $this->GetRow("execute sp_server_info 2"); if ($this->fetchMode === false) { @@ -410,7 +412,7 @@ order by constraint_name, referenced_table_name, keyno"; { if(@mssql_select_db("master")) { $qry=$this->metaDatabasesSQL; - if($rs=@mssql_query($qry)){ + if($rs=@mssql_query($qry,$this->_connectionID)){ $tmpAr=$ar=array(); while($tmpAr=@mssql_fetch_row($rs)) $ar[]=$tmpAr[0]; @@ -698,7 +700,7 @@ order by constraint_name, referenced_table_name, keyno"; } $decl = $this->qstr($decl); if ($this->debug) ADOConnection::outp("sp_executesql N{$sql[1]},N$decl,$params"); - $rez = mssql_query("sp_executesql N{$sql[1]},N$decl,$params"); + $rez = mssql_query("sp_executesql N{$sql[1]},N$decl,$params", $this->_connectionID); } else if (is_array($sql)) { # PrepareSP() diff --git a/lib/adodb/drivers/adodb-mssqlpo.inc.php b/lib/adodb/drivers/adodb-mssqlpo.inc.php index bfdacf2f3e3..5e7ae1f4047 100644 --- a/lib/adodb/drivers/adodb-mssqlpo.inc.php +++ b/lib/adodb/drivers/adodb-mssqlpo.inc.php @@ -1,6 +1,6 @@ type = $rs->fields[1]; $fld->max_length = $rs->fields[2]; $fld->scale = $rs->fields[3]; - if ($rs->fields[1] == 'NUMBER' && $rs->fields[3] == 0) { - $fld->type ='INT'; + if ($rs->fields[1] == 'NUMBER') { + if ($rs->fields[3] == 0) $fld->type = 'INT'; $fld->max_length = $rs->fields[4]; } $fld->not_null = (strncmp($rs->fields[5], 'NOT',3) === 0); diff --git a/lib/adodb/drivers/adodb-oci805.inc.php b/lib/adodb/drivers/adodb-oci805.inc.php index b96690e47e7..4073b604c44 100644 --- a/lib/adodb/drivers/adodb-oci805.inc.php +++ b/lib/adodb/drivers/adodb-oci805.inc.php @@ -1,6 +1,6 @@ GetOne($this->identitySQL); } + function MetaForeignKeys($table, $owner=false, $upper=false) { global $ADODB_FETCH_MODE; @@ -135,6 +134,47 @@ order by constraint_name, referenced_table_name, keyno"; return $arr; } + + function &MetaIndexes($table,$primary=false) + { + $table = $this->qstr($table); + + $sql = "SELECT i.name AS ind_name, C.name AS col_name, USER_NAME(O.uid) AS Owner, c.colid, k.Keyno, + CASE WHEN I.indid BETWEEN 1 AND 254 AND (I.status & 2048 = 2048 OR I.Status = 16402 AND O.XType = 'V') THEN 1 ELSE 0 END AS IsPK, + CASE WHEN I.status & 2 = 2 THEN 1 ELSE 0 END AS IsUnique + FROM dbo.sysobjects o INNER JOIN dbo.sysindexes I ON o.id = i.id + INNER JOIN dbo.sysindexkeys K ON I.id = K.id AND I.Indid = K.Indid + INNER JOIN dbo.syscolumns c ON K.id = C.id AND K.colid = C.Colid + WHERE LEFT(i.name, 8) <> '_WA_Sys_' AND o.status >= 0 AND O.Name LIKE $table + ORDER BY O.name, I.Name, K.keyno"; + + global $ADODB_FETCH_MODE; + $save = $ADODB_FETCH_MODE; + $ADODB_FETCH_MODE = ADODB_FETCH_NUM; + if ($this->fetchMode !== FALSE) { + $savem = $this->SetFetchMode(FALSE); + } + + $rs = $this->Execute($sql); + if (isset($savem)) { + $this->SetFetchMode($savem); + } + $ADODB_FETCH_MODE = $save; + + if (!is_object($rs)) { + return FALSE; + } + + $indexes = array(); + while ($row = $rs->FetchRow()) { + if (!$primary && $row[5]) continue; + + $indexes[$row[0]]['unique'] = $row[6]; + $indexes[$row[0]]['columns'][] = $row[1]; + } + return $indexes; + } + function _query($sql,$inputarr) { if (is_string($sql)) $sql = str_replace('||','+',$sql); @@ -151,12 +191,6 @@ order by constraint_name, referenced_table_name, keyno"; if (!stristr($transaction_mode,'isolation')) $transaction_mode = 'ISOLATION LEVEL '.$transaction_mode; $this->Execute("SET TRANSACTION ".$transaction_mode); } - - //Just wrap over mssql because this is one mssql odbc db - function &MetaIndexes($table,$primary=false) - { - return ADODB_mssql::MetaIndexes($table,$primary); - } // "Stein-Aksel Basma" // tested with MSSQL 2000 @@ -267,4 +301,4 @@ class ADORecordSet_odbc_mssql extends ADORecordSet_odbc { return $this->ADORecordSet_odbc($id,$mode); } } -?> +?> \ No newline at end of file diff --git a/lib/adodb/drivers/adodb-odbc_oracle.inc.php b/lib/adodb/drivers/adodb-odbc_oracle.inc.php index b9588f0ea89..9b3e540f59e 100644 --- a/lib/adodb/drivers/adodb-odbc_oracle.inc.php +++ b/lib/adodb/drivers/adodb-odbc_oracle.inc.php @@ -1,6 +1,6 @@ name = $arr['name']; - if (isset($arr['native_type'])) $o->type = $arr['native_type']; + if (isset($arr['native_type']) && $arr['native_type'] <> "null") $o->type = $arr['native_type']; else $o->type = adodb_pdo_type($arr['pdo_type']); $o->max_length = $arr['len']; $o->precision = $arr['precision']; diff --git a/lib/adodb/drivers/adodb-pdo_mssql.inc.php b/lib/adodb/drivers/adodb-pdo_mssql.inc.php index c97b74f3cf8..cdfcaae1ee7 100644 --- a/lib/adodb/drivers/adodb-pdo_mssql.inc.php +++ b/lib/adodb/drivers/adodb-pdo_mssql.inc.php @@ -2,7 +2,7 @@ /* -V4.92a 29 Aug 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. +V4.93 10 Oct 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. diff --git a/lib/adodb/drivers/adodb-pdo_mysql.inc.php b/lib/adodb/drivers/adodb-pdo_mysql.inc.php index e4ec76660e9..fc803b76692 100644 --- a/lib/adodb/drivers/adodb-pdo_mysql.inc.php +++ b/lib/adodb/drivers/adodb-pdo_mysql.inc.php @@ -2,7 +2,7 @@ /* -V4.92a 29 Aug 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. +V4.93 10 Oct 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. diff --git a/lib/adodb/drivers/adodb-pdo_oci.inc.php b/lib/adodb/drivers/adodb-pdo_oci.inc.php index 66c32b780a8..ebfd4a39861 100644 --- a/lib/adodb/drivers/adodb-pdo_oci.inc.php +++ b/lib/adodb/drivers/adodb-pdo_oci.inc.php @@ -2,7 +2,7 @@ /* -V4.92a 29 Aug 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. +V4.93 10 Oct 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. diff --git a/lib/adodb/drivers/adodb-pdo_pgsql.inc.php b/lib/adodb/drivers/adodb-pdo_pgsql.inc.php index 5367da40da9..5c0c531a071 100644 --- a/lib/adodb/drivers/adodb-pdo_pgsql.inc.php +++ b/lib/adodb/drivers/adodb-pdo_pgsql.inc.php @@ -1,7 +1,7 @@ = 0x5200) { + return "'".pg_escape_string($this->_connectionID,$s)."'"; + } if (ADODB_PHPVER >= 0x4200) { return "'".pg_escape_string($s)."'"; } @@ -424,6 +427,7 @@ select viewname,'V' from pg_views where viewname like $mask"; */ function BlobEncode($blob) { + if (ADODB_PHPVER >= 0x5200) return pg_escape_bytea($this->_connectionID, $blob); if (ADODB_PHPVER >= 0x4200) return pg_escape_bytea($blob); /*92=backslash, 0=null, 39=single-quote*/ @@ -683,6 +687,12 @@ WHERE (c2.relname=\'%s\' or c2.relname=lower(\'%s\'))'; } if ($this->_connectionID === false) return false; $this->Execute("set datestyle='ISO'"); + + $info = $this->ServerInfo(); + $this->pgVersion = (float) substr($info['version'],0,3); + if ($this->pgVersion >= 7.1) { // good till version 999 + $this->_nestedSQL = true; + } return true; } diff --git a/lib/adodb/drivers/adodb-postgres7.inc.php b/lib/adodb/drivers/adodb-postgres7.inc.php index 8440ea0ffb9..83b225cff06 100644 --- a/lib/adodb/drivers/adodb-postgres7.inc.php +++ b/lib/adodb/drivers/adodb-postgres7.inc.php @@ -1,6 +1,6 @@ rsPrefix .= 'assoc_'; } $this->_bindInputArray = PHP_VERSION >= 5.1; - - $this->_nestedSQL = true; - /*$info = $this->ServerInfo(); - $this->pgVersion = (float) substr($info['version'],0,3); - if ($this->pgVersion >= 7.1) { // good till version 999 - $this->_nestedSQL = true; - }*/ } @@ -268,4 +261,4 @@ class ADORecordSet_assoc_postgres7 extends ADORecordSet_postgres64{ return false; } } -?> +?> \ No newline at end of file diff --git a/lib/adodb/drivers/adodb-postgres8.inc.php b/lib/adodb/drivers/adodb-postgres8.inc.php index a82fe417718..ab364a71d93 100644 --- a/lib/adodb/drivers/adodb-postgres8.inc.php +++ b/lib/adodb/drivers/adodb-postgres8.inc.php @@ -1,6 +1,6 @@ - + diff --git a/lib/adodb/toexport.inc.php b/lib/adodb/toexport.inc.php index b3dd6efe513..6e0f777d531 100644 --- a/lib/adodb/toexport.inc.php +++ b/lib/adodb/toexport.inc.php @@ -1,7 +1,7 @@