Development

Changeset 1404

You must first sign up to be able to contribute.

Changeset 1404

Show
Ignore:
Timestamp:
06/09/06 14:35:29 (2 years ago)
Author:
fabien
Message:

updated creole to 1.1.0 [20] (closes #576 #563)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/vendor/creole/Creole.php

    r497 r1404  
    178178     
    179179    // gather any flags from the DSN 
    180     if (!empty($dsninfo['persistent'])) $flags |= Creole::PERSISTENT; 
    181     if (!empty($dsninfo['compat_assoc_lower'])) $flags |= Creole::COMPAT_ASSOC_LOWER; 
    182     if (!empty($dsninfo['compat_rtrim_string'])) $flags |= Creole::COMPAT_RTRIM_STRING; 
    183     if (!empty($dsninfo['compat_all'])) $flags |= Creole::COMPAT_ALL; 
     180    if ( isset ( $dsninfo['persistent'] ) && ! empty ( $dsninfo['persistent'] ) ) 
     181      $flags |= Creole::PERSISTENT; 
     182    if ( isset ( $dsninfo['compat_assoc_lower'] ) && ! empty ( $dsninfo['compat_assoc_lower'] ) ) 
     183      $flags |= Creole::COMPAT_ASSOC_LOWER; 
     184    if ( isset ( $dsninfo['compat_rtrim_string'] ) && ! empty ( $dsninfo['compat_rtrim_string'] ) ) 
     185      $flags |= Creole::COMPAT_RTRIM_STRING; 
     186    if ( isset ( $dsninfo['compat_all'] ) && ! empty ( $dsninfo['compat_all'] ) ) 
     187      $flags |= Creole::COMPAT_ALL; 
    184188     
    185189    if ($flags & Creole::NO_ASSOC_LOWER) { 
  • trunk/lib/vendor/creole/common/PreparedStatementCommon.php

    r497 r1404  
    318318    } 
    319319       
    320   if ($params) { 
    321       for($i=0,$cnt=count($params); $i < $cnt; $i++) { 
    322       $this->set($i+1, $params[$i]); 
    323    
    324       } 
     320       foreach ( (array) $params as $i=>$param ) { 
     321      $this->set ( $i + 1, $param ); 
     322      unset ( $i, $param ); 
     323   
     324  unset ( $params ); 
    325325         
    326326        $this->updateCount = null; // reset 
     
    344344    public function executeUpdate($params = null)  
    345345    { 
    346         if ($params) { 
    347             for($i=0,$cnt=count($params); $i < $cnt; $i++) { 
    348                 $this->set($i+1, $params[$i]); 
    349            
    350         } 
     346   foreach ( (array) $params as $i=>$param ) { 
     347      $this->set ( $i + 1, $param ); 
     348     unset ( $i, $param ); 
     349   
     350    unset ( $params ); 
    351351 
    352352        if($this->resultSet) $this->resultSet->close(); 
     
    400400      $type = 'float'; 
    401401      break; 
    402     // nice at a later date for large int handling? 
    403     //case 'gmp': 
    404402      } 
    405             $setter = 'set' . ucfirst($type); // PHP types are case-insensitive, but we'll do this in case that changes 
    406       $this->sql_cache_valid = false; 
    407             $this->$setter($paramIndex, $value); 
    408         }         
     403    $setter = 'set' . ucfirst($type); // PHP types are case-insensitive, but we'll do this in case that change 
     404    if ( method_exists ( $this, $setter ) ) { 
     405      $this->$setter($paramIndex, $value); 
     406    } else { 
     407      throw new SQLException ( "Unsupported datatype passed to set(): " . $type ); 
     408    } 
     409        } 
    409410    } 
    410411     
  • trunk/lib/vendor/creole/drivers/mysqli/metadata/MySQLiTableInfo.php

    r497 r1404  
    124124 
    125125        // Indexes 
    126         $res = mysqli_query($this->conn->getResource() . "SHOW INDEX FROM " . $this->name); 
     126        $res = mysqli_query($this->conn->getResource(), "SHOW INDEX FROM " . $this->name); 
    127127 
    128128        // Loop through the returned results, grouping the same key_name together 
  • trunk/lib/vendor/creole/drivers/pgsql/PgSQLConnection.php

    r497 r1404  
    142142            throw new SQLException('Could not execute query', pg_last_error($this->dblink), $sql); 
    143143        } 
    144   $this->result_affected_rows = @pg_affected_rows($result); 
     144  $this->result_affected_rows = (int) @pg_affected_rows($result); 
    145145 
    146146        return new PgSQLResultSet($this, $result, $fetchmode); 
     
    168168    protected function beginTrans() 
    169169    { 
    170         $result = @pg_query($this->dblink, "begin"); 
     170        $result = @pg_query($this->dblink, "BEGIN"); 
    171171        if (!$result) { 
    172172            throw new SQLException('Could not begin transaction', pg_last_error($this->dblink)); 
     
    181181    protected function commitTrans() 
    182182    { 
    183         $result = @pg_query($this->dblink, "end"); 
     183        $result = @pg_query($this->dblink, "COMMIT"); 
    184184        if (!$result) { 
    185185            throw new SQLException('Could not commit transaction', pg_last_error($this->dblink)); 
     
    194194    protected function rollbackTrans() 
    195195    { 
    196         $result = @pg_query($this->dblink, "abort"); 
     196        $result = @pg_query($this->dblink, "ROLLBACK"); 
    197197        if (!$result) { 
    198198            throw new SQLException('Could not rollback transaction', pg_last_error($this->dblink)); 
  • trunk/lib/vendor/creole/drivers/pgsql/PgSQLIdGenerator.php

    r497 r1404  
    7676            throw new SQLException("You must specify the sequence name when calling getId() method."); 
    7777        } 
    78         $rs = $this->conn->executeQuery("select nextval('" . $name . "')", ResultSet::FETCHMODE_NUM); 
     78        $rs = $this->conn->executeQuery("SELECT nextval('" . pg_escape_string ( $name ) . "')", ResultSet::FETCHMODE_NUM); 
    7979        $rs->next(); 
    8080        return $rs->getInt(1); 
  • trunk/lib/vendor/creole/drivers/pgsql/PgSQLPreparedStatement.php

    r1 r1404  
    5555            } else { 
    5656                if (is_string($el)) { 
    57                     $parts[] = '"' . pg_escape_string($el) . '"'; 
     57                    $parts[] = '"' . $this->escape($el) . '"'; 
    5858                } else { 
    5959                    $parts[] = $el; 
  • trunk/lib/vendor/creole/drivers/pgsql/PgSQLResultSet.php

    r497 r1404  
    3737   * @return PgSQLResultSetIterator 
    3838   */ 
     39  /* 
    3940  public function getIterator() 
    4041  {    
     
    4243    return new PgSQLResultSetIterator($this); 
    4344  } 
     45  */ 
    4446 
    4547  /** 
     
    200202    return ($this->fields[$column] === 't'); 
    201203  } 
    202        
     204 
    203205} 
  • trunk/lib/vendor/creole/drivers/pgsql/PgSQLResultSetIterator.php

    r1 r1404  
    2929 * @package   creole.drivers.pgsql 
    3030 */ 
    31 class PgSQLResultSetIterator implements SeekableIterator
     31class PgSQLResultSetIterator implements SeekableIterator, Countable
    3232 
    3333    private $result; 
    3434    private $pos = 0; 
    3535    private $fetchmode; 
    36     private $row; 
    3736    private $row_count; 
    3837     
     
    9493    function seek ( $index ) 
    9594    { 
     95      if ( ! is_int ( $index ) ) { 
     96    throw new InvalidArgumentException ( 'Invalid arguement to seek' ); 
     97  } 
    9698  if ( $index < 0 || $index > $this->row_count ) { 
    97     throw new Exception('Seeking to an unavailable index.'); 
     99    throw new OutOfBoundsException ( 'Invalid seek position' ); 
    98100  } 
    99101  $this->pos = $index; 
    100102    } 
     103 
     104    function count ( ) { 
     105  return $this->row_count; 
     106    } 
    101107} 
  • trunk/lib/vendor/creole/drivers/pgsql/metadata/PgSQLDatabaseInfo.php

    r497 r1404  
    4040         
    4141        // Get Database Version 
    42         $result = pg_exec ($this->conn->getResource(), "SELECT version() as ver"); 
     42  // TODO: www.php.net/pg_version 
     43        $result = pg_query ($this->conn->getResource(), "SELECT version() as ver"); 
    4344         
    4445        if (!$result) 
     
    5556        $result = null; 
    5657 
    57         $result = pg_exec($this->conn->getResource(), "SELECT oid, relname FROM pg_class 
     58        $result = pg_query($this->conn->getResource(), "SELECT oid, relname FROM pg_class 
    5859                    WHERE relkind = 'r' AND relnamespace = (SELECT oid 
    5960                    FROM pg_namespace 
     
    8788    $this->sequences = array(); 
    8889        
    89         $result = pg_exec($this->conn->getResource(), "SELECT oid, relname FROM pg_class 
     90        $result = pg_query($this->conn->getResource(), "SELECT oid, relname FROM pg_class 
    9091                    WHERE relkind = 'S' AND relnamespace = (SELECT oid 
    9192                    FROM pg_namespace 
  • trunk/lib/vendor/creole/drivers/sqlite/SQLiteResultSetIterator.php

    r1 r1404  
    3232    private $pos = 0; 
    3333    private $fetchmode; 
    34     private $row; 
    3534    private $row_count; 
    3635