Changeset 10068

Show
Ignore:
Timestamp:
12/04/08 08:49:47 (1 month ago)
Author:
afz
Message:

Update PEAR::MDB2 Drivers

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/0.8/jaws/html/libraries/pear/MDB2/Driver/Datatype/ibase.php

    r7942 r10068  
    4545// +----------------------------------------------------------------------+ 
    4646// 
    47 // $Id: ibase.php,v 1.89 2007/03/28 16:58:54 quipo Exp $ 
     47// $Id: ibase.php,v 1.90 2008/11/09 18:41:32 quipo Exp $ 
    4848 
    4949require_once 'MDB2/Driver/Datatype/Common.php'; 
     
    8181 
    8282        switch ($type) { 
     83        case 'text': 
     84            $blob_info = @ibase_blob_info($value); 
     85            if (is_array($blob_info) && $blob_info['length'] > 0) { 
     86                //LOB => fetch into variable 
     87                $clob = $this->_baseConvertResult($value, 'clob', $rtrim); 
     88                if (!PEAR::isError($clob) && is_resource($clob)) { 
     89                    $clob_value = ''; 
     90                    while (!feof($clob)) { 
     91                        $clob_value .= fread($clob, 8192); 
     92                    } 
     93                    $this->destroyLOB($clob); 
     94                } 
     95                $value = $clob_value; 
     96            } 
     97            if ($rtrim) { 
     98                $value = rtrim($value); 
     99            } 
     100            return $value; 
    83101        case 'timestamp': 
    84102            return substr($value, 0, strlen('YYYY-MM-DD HH:MM:SS')); 
  • branches/0.8/jaws/html/libraries/pear/MDB2/Driver/Datatype/oci8.php

    r7942 r10068  
    4343// +----------------------------------------------------------------------+ 
    4444 
    45 // $Id: oci8.php,v 1.72 2007/03/28 16:58:54 quipo Exp $ 
     45// $Id: oci8.php,v 1.73 2008/10/07 10:57:37 quipo Exp $ 
    4646 
    4747require_once 'MDB2/Driver/Datatype/Common.php'; 
     
    7373        } 
    7474        switch ($type) { 
     75        case 'text': 
     76            if (is_object($value) && is_a($value, 'OCI-Lob')) { 
     77                //LOB => fetch into variable 
     78                $clob = $this->_baseConvertResult($value, 'clob', $rtrim); 
     79                if (!PEAR::isError($clob) && is_resource($clob)) { 
     80                    $clob_value = ''; 
     81                    while (!feof($clob)) { 
     82                        $clob_value .= fread($clob, 8192); 
     83                    } 
     84                    $this->destroyLOB($clob); 
     85                } 
     86                $value = $clob_value; 
     87            } 
     88            if ($rtrim) { 
     89                $value = rtrim($value); 
     90            } 
     91            return $value; 
    7592        case 'date': 
    7693            return substr($value, 0, strlen('YYYY-MM-DD')); 
  • branches/0.8/jaws/html/libraries/pear/MDB2/Driver/Manager/mysql.php

    r9249 r10068  
    4343// +----------------------------------------------------------------------+ 
    4444// 
    45 // $Id: mysql.php,v 1.112 2008/08/13 23:02:47 afz Exp $ 
     45// $Id: mysql.php,v 1.113 2008/11/23 20:30:29 quipo Exp $ 
    4646// 
    4747 
     
    961961        } 
    962962        $fields = array(); 
    963         foreach (array_keys($definition['fields']) as $field) { 
    964             $fields[] = $db->quoteIdentifier($field, true); 
     963        foreach ($definition['fields'] as $field => $fieldinfo) { 
     964            $quoted = $db->quoteIdentifier($field, true); 
     965            if (!empty($fieldinfo['length'])) { 
     966                $quoted .= '(' . $fieldinfo['length'] . ')'; 
     967            } 
     968            $fields[] = $quoted; 
    965969        } 
    966970        $query .= ' ('. implode(', ', $fields) . ')'; 
     
    973977            $query .= ' ('. implode(', ', $referenced_fields) . ')'; 
    974978            $query .= $this->_getAdvancedFKOptions($definition); 
     979 
     980            // add index on FK column(s) or we can't add a FK constraint 
     981            // @see http://forums.mysql.com/read.php?22,19755,226009 
     982            $result = $this->createIndex($table, $name.'_fkidx', $definition); 
     983            if (PEAR::isError($result)) { 
     984                return $result; 
     985            } 
    975986        } 
    976987        $res = $db->exec($query); 
  • branches/0.8/jaws/html/libraries/pear/MDB2/Driver/Manager/mysqli.php

    r9249 r10068  
    4343// +----------------------------------------------------------------------+ 
    4444// 
    45 // $Id: mysqli.php,v 1.99 2008/08/13 23:03:13 afz Exp $ 
     45// $Id: mysqli.php,v 1.100 2008/11/23 20:30:29 quipo Exp $ 
    4646// 
    4747 
     
    961961        } 
    962962        $fields = array(); 
    963         foreach (array_keys($definition['fields']) as $field) { 
    964             $fields[] = $db->quoteIdentifier($field, true); 
     963        foreach ($definition['fields'] as $field => $fieldinfo) { 
     964            $quoted = $db->quoteIdentifier($field, true); 
     965            if (!empty($fieldinfo['length'])) { 
     966                $quoted .= '(' . $fieldinfo['length'] . ')'; 
     967            } 
     968            $fields[] = $quoted; 
    965969        } 
    966970        $query .= ' ('. implode(', ', $fields) . ')'; 
     
    973977            $query .= ' ('. implode(', ', $referenced_fields) . ')'; 
    974978            $query .= $this->_getAdvancedFKOptions($definition); 
     979 
     980            // add index on FK column(s) or we can't add a FK constraint 
     981            // @see http://forums.mysql.com/read.php?22,19755,226009 
     982            $result = $this->createIndex($table, $name.'_fkidx', $definition); 
     983            if (PEAR::isError($result)) { 
     984                return $result; 
     985            } 
    975986        } 
    976987        $res = $db->exec($query); 
  • branches/0.8/jaws/html/libraries/pear/MDB2/Driver/Reverse/ibase.php

    r7942 r10068  
    4343// +----------------------------------------------------------------------+ 
    4444// 
    45 // $Id: ibase.php,v 1.78 2007/11/25 13:38:29 quipo Exp $ 
     45// $Id: ibase.php,v 1.79 2008/11/17 00:00:15 quipo Exp $ 
    4646// 
    4747 
     
    154154                         RDB\$RELATION_FIELDS.RDB\$DESCRIPTION AS description, 
    155155                         RDB\$RELATION_FIELDS.RDB\$NULL_FLAG AS null_flag, 
    156                          RDB\$FIELDS.RDB\$DEFAULT_SOURCE AS default_source 
     156                         RDB\$FIELDS.RDB\$DEFAULT_SOURCE AS default_source, 
     157                         RDB\$CHARACTER_SETS.RDB\$CHARACTER_SET_NAME AS \"charset\", 
     158                         RDB\$COLLATIONS.RDB\$COLLATION_NAME AS \"collation\" 
    157159                    FROM RDB\$FIELDS 
    158160               LEFT JOIN RDB\$RELATION_FIELDS ON RDB\$FIELDS.RDB\$FIELD_NAME = RDB\$RELATION_FIELDS.RDB\$FIELD_SOURCE 
     161               LEFT JOIN RDB\$CHARACTER_SETS ON RDB\$FIELDS.RDB\$CHARACTER_SET_ID = RDB\$CHARACTER_SETS.RDB\$CHARACTER_SET_ID 
     162               LEFT JOIN RDB\$COLLATIONS ON RDB\$FIELDS.RDB\$COLLATION_ID = RDB\$COLLATIONS.RDB\$COLLATION_ID 
    159163                   WHERE UPPER(RDB\$RELATION_FIELDS.RDB\$RELATION_NAME)=$table 
    160164                     AND UPPER(RDB\$RELATION_FIELDS.RDB\$FIELD_NAME)=$field_name;"; 
     
    197201        } 
    198202 
    199         $definition[0] = array('notnull' => $notnull, 'nativetype' => $column['type']); 
     203        $definition[0] = array( 
     204            'notnull'    => $notnull, 
     205            'nativetype' => $column['type'], 
     206            'charset'    => $column['charset'], 
     207            'collation'  => $column['collation'], 
     208        ); 
    200209        if (!is_null($length)) { 
    201210            $definition[0]['length'] = $length; 
  • branches/0.8/jaws/html/libraries/pear/MDB2/Driver/ibase.php

    r9331 r10068  
    4444// +----------------------------------------------------------------------+ 
    4545// 
    46 // $Id: ibase.php,v 1.221 2008/08/25 19:57:10 afz Exp $ 
     46// $Id: ibase.php,v 1.223 2008/12/01 18:41:45 afz Exp $ 
    4747 
    4848/** 
     
    537537        } 
    538538 
    539         if (!empty($this->database_name)) { 
    540             $connection = $this->_doConnect($this->dsn['username'], 
    541                                             $this->dsn['password'], 
    542                                             $this->database_name, 
    543                                             $this->options['persistent']); 
    544             if (PEAR::isError($connection)) { 
    545                 return $connection; 
    546             } 
    547             $this->connection =& $connection; 
    548             $this->connected_dsn = $this->dsn; 
    549             $this->connected_database_name = $database_file; 
    550             $this->opened_persistent = $this->options['persistent']; 
    551             $this->dbsyntax = $this->dsn['dbsyntax'] ? $this->dsn['dbsyntax'] : $this->phptype; 
    552             $this->supported['limit_queries'] = ($this->dbsyntax == 'firebird') ? true : 'emulated'; 
    553         } 
     539        if (empty($this->database_name)) { 
     540            return $this->raiseError(MDB2_ERROR_CONNECT_FAILED, null, null, 
     541            'unable to establish a connection', __FUNCTION__); 
     542        } 
     543 
     544        $connection = $this->_doConnect($this->dsn['username'], 
     545                                        $this->dsn['password'], 
     546                                        $this->database_name, 
     547                                        $this->options['persistent']); 
     548        if (PEAR::isError($connection)) { 
     549            return $connection; 
     550        } 
     551        $this->connection =& $connection; 
     552        $this->connected_dsn = $this->dsn; 
     553        $this->connected_database_name = $database_file; 
     554        $this->opened_persistent = $this->options['persistent']; 
     555        $this->dbsyntax = $this->dsn['dbsyntax'] ? $this->dsn['dbsyntax'] : $this->phptype; 
     556        $this->supported['limit_queries'] = ($this->dbsyntax == 'firebird') ? true : 'emulated'; 
     557 
    554558        return MDB2_OK; 
    555559    } 
     
    14431447     * @param mixed $result_class string which specifies which result class to use 
    14441448     * @param mixed $result_wrap_class string which specifies which class to wrap results in 
    1445      * @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure 
     1449     * 
     1450     * @return mixed MDB2_Result or integer (affected rows) on success, 
     1451     *               a MDB2 error on failure 
    14461452     * @access private 
    14471453     */ 
  • branches/0.8/jaws/html/libraries/pear/MDB2/Driver/mysql.php

    r9167 r10068  
    4444// +----------------------------------------------------------------------+ 
    4545// 
    46 // $Id: mysql.php,v 1.213 2008/07/14 15:58:01 quipo Exp $ 
     46// $Id: mysql.php,v 1.214 2008/11/16 21:45:08 quipo Exp $ 
    4747// 
    4848 
     
    15871587     * @param mixed $result_class string which specifies which result class to use 
    15881588     * @param mixed $result_wrap_class string which specifies which class to wrap results in 
    1589      * @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure 
     1589     * 
     1590     * @return mixed MDB2_Result or integer (affected rows) on success, 
     1591     *               a MDB2 error on failure 
    15901592     * @access private 
    15911593     */ 
  • branches/0.8/jaws/html/libraries/pear/MDB2/Driver/mysqli.php

    r9167 r10068  
    4444// +----------------------------------------------------------------------+ 
    4545// 
    46 // $Id: mysqli.php,v 1.191 2008/07/14 15:58:01 quipo Exp $ 
     46// $Id: mysqli.php,v 1.192 2008/11/16 21:45:08 quipo Exp $ 
    4747// 
    4848 
     
    16531653     * @param mixed $result_class string which specifies which result class to use 
    16541654     * @param mixed $result_wrap_class string which specifies which class to wrap results in 
    1655      * @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure 
     1655     * 
     1656     * @return mixed MDB2_Result or integer (affected rows) on success, 
     1657     *               a MDB2 error on failure 
    16561658     * @access private 
    16571659     */ 
  • branches/0.8/jaws/html/libraries/pear/MDB2/Driver/oci8.php

    r9167 r10068  
    4444// +----------------------------------------------------------------------+ 
    4545 
    46 // $Id: oci8.php,v 1.215 2008/07/14 15:58:01 quipo Exp $ 
     46// $Id: oci8.php,v 1.217 2008/11/16 21:45:08 quipo Exp $ 
    4747 
    4848/** 
     
    857857                } else { 
    858858                    ++$parameter; 
    859                     $length = strlen($parameter); 
     859                    //$length = strlen($parameter); 
     860                    $length = 1; // strlen('?') 
    860861                } 
    861862                if (!in_array($parameter, $positions)) { 
     
    14141415     * @param mixed $result_class string which specifies which result class to use 
    14151416     * @param mixed $result_wrap_class string which specifies which class to wrap results in 
    1416      * @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure 
     1417     * 
     1418     * @return mixed MDB2_Result or integer (affected rows) on success, 
     1419     *               a MDB2 error on failure 
    14171420     * @access private 
    14181421     */