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-ado.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,  
     
    148148*/ 
    149149         
    150         function &MetaTables() 
     150        function MetaTables() 
    151151        { 
    152152                $arr= array(); 
     
    170170        } 
    171171         
    172         function &MetaColumns($table) 
     172        function MetaColumns($table, $normalize=true) 
    173173        { 
    174174                $table = strtoupper($table); 
     
    205205         
    206206        /* returns queryID or false */ 
    207         function &_query($sql,$inputarr=false)  
     207        function _query($sql,$inputarr=false)  
    208208        { 
    209209                 
     
    222222                        $oCmd->CommandType = 1; 
    223223 
    224                         foreach($inputarr as $val) { 
     224      // Map by http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdmthcreateparam.asp 
     225      // Check issue http://bugs.php.net/bug.php?id=40664 !!! 
     226                        while(list(, $val) = each($inputarr)) { 
     227                                $type = gettype($val); 
     228                                $len=strlen($val); 
     229                                if ($type == 'boolean') 
     230                                        $this->adoParameterType = 11; 
     231                                else if ($type == 'integer') 
     232                                        $this->adoParameterType = 3; 
     233                                else if ($type == 'double') 
     234                                        $this->adoParameterType = 5; 
     235                                elseif ($type == 'string') 
     236                                        $this->adoParameterType = 202; 
     237                                else if (($val === null) || (!defined($val))) 
     238                                        $len=1; 
     239                                else 
     240                                        $this->adoParameterType = 130; 
     241                                 
    225242                                // name, type, direction 1 = input, len, 
    226                                 $this->adoParameterType = 130; 
    227                                 $p = $oCmd->CreateParameter('name',$this->adoParameterType,1,strlen($val),$val); 
    228                                 //print $p->Type.' '.$p->value; 
     243                        $p = $oCmd->CreateParameter('name',$this->adoParameterType,1,$len,$val); 
     244 
    229245                                $oCmd->Parameters->Append($p); 
    230246                        } 
     
    338354 
    339355        // returns the field object 
    340         function &FetchField($fieldOffset = -1) { 
     356        function FetchField($fieldOffset = -1) { 
    341357                $off=$fieldOffset+1; // offsets begin at 1 
    342358                 
     
    588604                                $this->fields[] = (float) $f->value; 
    589605                                break; 
     606                        case 11: //BIT; 
     607                                $val = ""; 
     608                                if(is_bool($f->value))  { 
     609                                        if($f->value==true) $val = 1; 
     610                                        else $val = 0; 
     611                                } 
     612                                if(is_null($f->value)) $val = null; 
     613                                 
     614                                $this->fields[] = $val; 
     615                                break; 
    590616                        default: 
    591617                                $this->fields[] = $f->value;  
     
    600626                 
    601627                if ($this->fetchMode & ADODB_FETCH_ASSOC) { 
    602                         $this->fields = &$this->GetRowAssoc(ADODB_ASSOC_CASE); 
     628                        $this->fields = $this->GetRowAssoc(ADODB_ASSOC_CASE); 
    603629                } 
    604630                return true; 
Note: See TracChangeset for help on using the changeset viewer.