Ignore:
Timestamp:
09/26/13 15:41:49 (11 years ago)
Author:
angelo
Message:

Ticket #3491 - Compatibilizar Expresso com novas versoes do PHP

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/2.5.1-evolucao/phpgwapi/inc/adodb/drivers/adodb-odbc.inc.php

    r34 r8222  
    11<?php 
    22/*  
    3 V4.94 23 Jan 2007  (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved. 
     3V5.18 3 Sep 2012  (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved. 
    44  Released under both BSD license and Lesser GPL library license.  
    55  Whenever there is any discrepancy between the two licenses,  
     
    5353                if (!function_exists('odbc_connect')) return null; 
    5454                 
    55                 if ($this->debug && $argDatabasename && $this->databaseType != 'vfp') { 
    56                         ADOConnection::outp("For odbc Connect(), $argDatabasename is not used. Place dsn in 1st parameter."); 
    57                 } 
     55                if (!empty($argDatabasename) && stristr($argDSN, 'Database=') === false) { 
     56                        $argDSN = trim($argDSN); 
     57                        $endDSN = substr($argDSN, strlen($argDSN) - 1); 
     58                        if ($endDSN != ';') $argDSN .= ';'; 
     59                        $argDSN .= 'Database='.$argDatabasename; 
     60                } 
     61                 
    5862                if (isset($php_errormsg)) $php_errormsg = ''; 
    5963                if ($this->curmode === false) $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword); 
     
    162166                                $this->genID = $num; 
    163167                                return $num; 
     168                        } elseif ($this->affected_rows() == 0) { 
     169                                // some drivers do not return a valid value => try with another method 
     170                                $value = $this->GetOne("select id from $seq"); 
     171                                if ($value == $num + 1) { 
     172                                        return $value; 
     173                                } 
    164174                        } 
    165175                } 
     
    253263                $rs->_has_stupid_odbc_fetch_api_change = $this->_has_stupid_odbc_fetch_api_change; 
    254264                 
    255                 $arr =& $rs->GetArray(); 
     265                $arr = $rs->GetArray(); 
    256266                $rs->Close(); 
    257267                //print_r($arr); 
     
    265275         
    266276         
    267         function &MetaTables($ttype=false) 
     277        function MetaTables($ttype=false) 
    268278        { 
    269279        global $ADODB_FETCH_MODE; 
     
    282292                $rs->_has_stupid_odbc_fetch_api_change = $this->_has_stupid_odbc_fetch_api_change; 
    283293                 
    284                 $arr =& $rs->GetArray(); 
     294                $arr = $rs->GetArray(); 
    285295                //print_r($arr); 
    286296                 
     
    371381        } 
    372382         
    373         function &MetaColumns($table) 
     383        function MetaColumns($table, $normalize=true) 
    374384        { 
    375385        global $ADODB_FETCH_MODE; 
     
    423433                if (empty($qid)) return $false; 
    424434                 
    425                 $rs =& new ADORecordSet_odbc($qid); 
     435                $rs = new ADORecordSet_odbc($qid); 
    426436                $ADODB_FETCH_MODE = $savem; 
    427437                 
     
    615625 
    616626        // returns the field object 
    617         function &FetchField($fieldOffset = -1)  
     627        function FetchField($fieldOffset = -1)  
    618628        { 
    619629                 
     
    662672         
    663673        // speed up SelectLimit() by switching to ADODB_FETCH_NUM as ADODB_FETCH_ASSOC is emulated 
    664         function &GetArrayLimit($nrows,$offset=-1)  
     674        function GetArrayLimit($nrows,$offset=-1)  
    665675        { 
    666676                if ($offset <= 0) { 
    667                         $rs =& $this->GetArray($nrows); 
     677                        $rs = $this->GetArray($nrows); 
    668678                        return $rs; 
    669679                } 
     
    674684                 
    675685                if ($this->fetchMode & ADODB_FETCH_ASSOC) { 
    676                         $this->fields =& $this->GetRowAssoc(ADODB_ASSOC_CASE); 
     686                        $this->fields = $this->GetRowAssoc(ADODB_ASSOC_CASE); 
    677687                } 
    678688                 
     
    701711                        if ($rez) { 
    702712                                if ($this->fetchMode & ADODB_FETCH_ASSOC) { 
    703                                         $this->fields =& $this->GetRowAssoc(ADODB_ASSOC_CASE); 
     713                                        $this->fields = $this->GetRowAssoc(ADODB_ASSOC_CASE); 
    704714                                } 
    705715                                return true; 
     
    722732                if ($rez) { 
    723733                        if ($this->fetchMode & ADODB_FETCH_ASSOC) { 
    724                                 $this->fields =& $this->GetRowAssoc(ADODB_ASSOC_CASE); 
     734                                $this->fields = $this->GetRowAssoc(ADODB_ASSOC_CASE); 
    725735                        } 
    726736                        return true; 
Note: See TracChangeset for help on using the changeset viewer.