Changeset 6145


Ignore:
Timestamp:
05/08/12 17:39:37 (12 years ago)
Author:
natan
Message:

Ticket #2201 - Problemas API (JavaScript?) -> Rollback sobre um conceito - Correção

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/prototype/services/PostgreSQL.php

    r6132 r6145  
    4040 */ 
    4141 
    42 /** 
    43  * 
    44  * @package    Prototype 
    45  * @license    http://www.gnu.org/copyleft/gpl.html GPL 
    46  * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 
    47  * @version    2.4 
    48  * @sponsor    Caixa Econômica Federal 
    49  * @since      Classe disponibilizada na versão 2.4 
    50  */ 
    5142class PostgreSQL implements Service 
    5243{ 
     
    109100            $rs = pg_query( $this->con, $sql ); 
    110101 
    111             if( is_bool( $rs ) ) 
    112             { 
    113                 if ( !$rs ) 
     102            switch( pg_num_rows( $rs ) ) 
     103            { 
     104                case -1:  
    114105                  $this->error = pg_last_error ( $this->con ); 
    115  
    116                 return( $rs ); 
    117             } 
    118  
    119             if( pg_num_rows( $rs ) <= 0 ) 
    120                 return array(); 
    121  
    122             $return = array(); 
    123  
    124             while( $row = pg_fetch_assoc( $rs ) ) 
    125                 $return[] = $row; 
    126  
    127             return( $unique ? $return[0] : $return ); 
    128     } 
     106                  return( false ); 
     107 
     108                case 0: 
     109                  return( pg_affected_rows( $rs ) ? true : array() ); 
     110 
     111                default: 
     112                  $return = array(); 
     113 
     114                  while( $row = pg_fetch_assoc( $rs ) ) 
     115                      $return[] = $row; 
     116 
     117                  return( $unique ? $return[0] : $return ); 
     118            } 
     119    } 
     120 
    129121 
    130122    //@DEPRECATED 
Note: See TracChangeset for help on using the changeset viewer.