Changeset 10068
- Timestamp:
- 12/04/08 08:49:47 (1 month ago)
- Files:
-
- branches/0.8/jaws/html/libraries/pear/MDB2/Driver/Datatype/ibase.php (modified) (2 diffs)
- branches/0.8/jaws/html/libraries/pear/MDB2/Driver/Datatype/oci8.php (modified) (2 diffs)
- branches/0.8/jaws/html/libraries/pear/MDB2/Driver/Manager/mysql.php (modified) (3 diffs)
- branches/0.8/jaws/html/libraries/pear/MDB2/Driver/Manager/mysqli.php (modified) (3 diffs)
- branches/0.8/jaws/html/libraries/pear/MDB2/Driver/Reverse/ibase.php (modified) (3 diffs)
- branches/0.8/jaws/html/libraries/pear/MDB2/Driver/ibase.php (modified) (3 diffs)
- branches/0.8/jaws/html/libraries/pear/MDB2/Driver/mysql.php (modified) (2 diffs)
- branches/0.8/jaws/html/libraries/pear/MDB2/Driver/mysqli.php (modified) (2 diffs)
- branches/0.8/jaws/html/libraries/pear/MDB2/Driver/oci8.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/0.8/jaws/html/libraries/pear/MDB2/Driver/Datatype/ibase.php
r7942 r10068 45 45 // +----------------------------------------------------------------------+ 46 46 // 47 // $Id: ibase.php,v 1. 89 2007/03/28 16:58:54quipo Exp $47 // $Id: ibase.php,v 1.90 2008/11/09 18:41:32 quipo Exp $ 48 48 49 49 require_once 'MDB2/Driver/Datatype/Common.php'; … … 81 81 82 82 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; 83 101 case 'timestamp': 84 102 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 43 43 // +----------------------------------------------------------------------+ 44 44 45 // $Id: oci8.php,v 1.7 2 2007/03/28 16:58:54quipo Exp $45 // $Id: oci8.php,v 1.73 2008/10/07 10:57:37 quipo Exp $ 46 46 47 47 require_once 'MDB2/Driver/Datatype/Common.php'; … … 73 73 } 74 74 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; 75 92 case 'date': 76 93 return substr($value, 0, strlen('YYYY-MM-DD')); branches/0.8/jaws/html/libraries/pear/MDB2/Driver/Manager/mysql.php
r9249 r10068 43 43 // +----------------------------------------------------------------------+ 44 44 // 45 // $Id: mysql.php,v 1.11 2 2008/08/13 23:02:47 afzExp $45 // $Id: mysql.php,v 1.113 2008/11/23 20:30:29 quipo Exp $ 46 46 // 47 47 … … 961 961 } 962 962 $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; 965 969 } 966 970 $query .= ' ('. implode(', ', $fields) . ')'; … … 973 977 $query .= ' ('. implode(', ', $referenced_fields) . ')'; 974 978 $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 } 975 986 } 976 987 $res = $db->exec($query); branches/0.8/jaws/html/libraries/pear/MDB2/Driver/Manager/mysqli.php
r9249 r10068 43 43 // +----------------------------------------------------------------------+ 44 44 // 45 // $Id: mysqli.php,v 1. 99 2008/08/13 23:03:13 afzExp $45 // $Id: mysqli.php,v 1.100 2008/11/23 20:30:29 quipo Exp $ 46 46 // 47 47 … … 961 961 } 962 962 $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; 965 969 } 966 970 $query .= ' ('. implode(', ', $fields) . ')'; … … 973 977 $query .= ' ('. implode(', ', $referenced_fields) . ')'; 974 978 $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 } 975 986 } 976 987 $res = $db->exec($query); branches/0.8/jaws/html/libraries/pear/MDB2/Driver/Reverse/ibase.php
r7942 r10068 43 43 // +----------------------------------------------------------------------+ 44 44 // 45 // $Id: ibase.php,v 1.7 8 2007/11/25 13:38:29quipo Exp $45 // $Id: ibase.php,v 1.79 2008/11/17 00:00:15 quipo Exp $ 46 46 // 47 47 … … 154 154 RDB\$RELATION_FIELDS.RDB\$DESCRIPTION AS description, 155 155 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\" 157 159 FROM RDB\$FIELDS 158 160 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 159 163 WHERE UPPER(RDB\$RELATION_FIELDS.RDB\$RELATION_NAME)=$table 160 164 AND UPPER(RDB\$RELATION_FIELDS.RDB\$FIELD_NAME)=$field_name;"; … … 197 201 } 198 202 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 ); 200 209 if (!is_null($length)) { 201 210 $definition[0]['length'] = $length; branches/0.8/jaws/html/libraries/pear/MDB2/Driver/ibase.php
r9331 r10068 44 44 // +----------------------------------------------------------------------+ 45 45 // 46 // $Id: ibase.php,v 1.22 1 2008/08/25 19:57:10afz Exp $46 // $Id: ibase.php,v 1.223 2008/12/01 18:41:45 afz Exp $ 47 47 48 48 /** … … 537 537 } 538 538 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 554 558 return MDB2_OK; 555 559 } … … 1443 1447 * @param mixed $result_class string which specifies which result class to use 1444 1448 * @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 1446 1452 * @access private 1447 1453 */ branches/0.8/jaws/html/libraries/pear/MDB2/Driver/mysql.php
r9167 r10068 44 44 // +----------------------------------------------------------------------+ 45 45 // 46 // $Id: mysql.php,v 1.21 3 2008/07/14 15:58:01quipo Exp $46 // $Id: mysql.php,v 1.214 2008/11/16 21:45:08 quipo Exp $ 47 47 // 48 48 … … 1587 1587 * @param mixed $result_class string which specifies which result class to use 1588 1588 * @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 1590 1592 * @access private 1591 1593 */ branches/0.8/jaws/html/libraries/pear/MDB2/Driver/mysqli.php
r9167 r10068 44 44 // +----------------------------------------------------------------------+ 45 45 // 46 // $Id: mysqli.php,v 1.19 1 2008/07/14 15:58:01quipo Exp $46 // $Id: mysqli.php,v 1.192 2008/11/16 21:45:08 quipo Exp $ 47 47 // 48 48 … … 1653 1653 * @param mixed $result_class string which specifies which result class to use 1654 1654 * @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 1656 1658 * @access private 1657 1659 */ branches/0.8/jaws/html/libraries/pear/MDB2/Driver/oci8.php
r9167 r10068 44 44 // +----------------------------------------------------------------------+ 45 45 46 // $Id: oci8.php,v 1.21 5 2008/07/14 15:58:01quipo Exp $46 // $Id: oci8.php,v 1.217 2008/11/16 21:45:08 quipo Exp $ 47 47 48 48 /** … … 857 857 } else { 858 858 ++$parameter; 859 $length = strlen($parameter); 859 //$length = strlen($parameter); 860 $length = 1; // strlen('?') 860 861 } 861 862 if (!in_array($parameter, $positions)) { … … 1414 1415 * @param mixed $result_class string which specifies which result class to use 1415 1416 * @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 1417 1420 * @access private 1418 1421 */
