cvs: pear /MDB2/MDB2/Driver/Datatype Common.php fbsql.php ibase.php mssql.php oci8.php pgsql.php sqlite.php

From: Date: Wed, 27 Oct 2004 16:57:00 +0000
Subject: cvs: pear /MDB2/MDB2/Driver/Datatype Common.php fbsql.php ibase.php mssql.php oci8.php pgsql.php sqlite.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-25293@lists.php.net to get a copy of this message
lsmith Wed Oct 27 12:57:00 2004 EDT Modified files: /pear/MDB2/MDB2/Driver/Datatype Common.php fbsql.php ibase.php mssql.php oci8.php pgsql.php sqlite.php Log: - cosmetic fixes

http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/Common.php?r1=1.15&r2=1.16&ty=u Index: pear/MDB2/MDB2/Driver/Datatype/Common.php diff -u pear/MDB2/MDB2/Driver/Datatype/Common.php:1.15 pear/MDB2/MDB2/Driver/Datatype/Common.php:1.16 --- pear/MDB2/MDB2/Driver/Datatype/Common.php:1.15 Fri Oct 22 16:38:12 2004 +++ pear/MDB2/MDB2/Driver/Datatype/Common.php Wed Oct 27 12:56:57 2004 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: Common.php,v 1.15 2004/10/22 20:38:12 lsmith Exp $ +// $Id: Common.php,v 1.16 2004/10/27 16:56:57 lsmith Exp $ /** * @package MDB2 @@ -143,40 +143,40 @@ { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; switch ($type) { - case 'text': - return $value; - case 'integer': - return intval($value); - case 'boolean': - return $value == 'Y'; - case 'decimal': - return $value; - case 'float': - return doubleval($value); - case 'date': - return $value; - case 'time': - return $value; - case 'timestamp': - return $value; - case 'clob': - case 'blob': - $db->lobs[] = array( - 'value' => $value, - 'position' => 0 - ); - end($db->lobs); - $lob = key($db->lobs); - $dst_lob = array( - 'database' => &$db, - 'type' => 'resultlob', - 'resultLOB' => $lob, - ); - $lob = $this->createLOB($dst_lob); - return $lob; - default: - return $db->raiseError(MDB2_ERROR_INVALID, null, null, - 'attempt to convert result value to an unknown type ' . $type); + case 'text': + return $value; + case 'integer': + return intval($value); + case 'boolean': + return $value == 'Y'; + case 'decimal': + return $value; + case 'float': + return doubleval($value); + case 'date': + return $value; + case 'time': + return $value; + case 'timestamp': + return $value; + case 'clob': + case 'blob': + $db->lobs[] = array( + 'value' => $value, + 'position' => 0 + ); + end($db->lobs); + $lob = key($db->lobs); + $dst_lob = array( + 'database' => &$db, + 'type' => 'resultlob', + 'resultLOB' => $lob, + ); + $lob = $this->createLOB($dst_lob); + return $lob; + default: + return $db->raiseError(MDB2_ERROR_INVALID, null, null, + 'attempt to convert result value to an unknown type ' . $type); } } @@ -222,18 +222,18 @@ } $type = $types[$current_column]; switch ($type) { - case 'text': - break; - case 'integer': - $row[$key] = intval($row[$key]); - break; - default: - $value = $this->convertResult($row[$key], $type); - if (MDB2::isError($value)) { - return $value; - } - $row[$key] = $value; - break; + case 'text': + break; + case 'integer': + $row[$key] = intval($row[$key]); + break; + default: + $value = $this->convertResult($row[$key], $type); + if (MDB2::isError($value)) { + return $value; + } + $row[$key] = $value; + break; } } } @@ -1053,19 +1053,19 @@ $class_name = 'MDB2_LOB'; if (isset($arguments['type'])) { switch ($arguments['type']) { - case 'data': - break; - case 'resultlob': - $class_name = 'MDB2_LOB_Result'; - break; - case 'inputfile': - $class_name = 'MDB2_LOB_Input_File'; - break; - case 'outputfile': - $class_name = 'MDB2_LOB_Output_File'; - break; - default: - return $db->raiseError('createLOB: '.$arguments['type'] . ' is not a valid type of large object'); + case 'data': + break; + case 'resultlob': + $class_name = 'MDB2_LOB_Result'; + break; + case 'inputfile': + $class_name = 'MDB2_LOB_Input_File'; + break; + case 'outputfile': + $class_name = 'MDB2_LOB_Output_File'; + break; + default: + return $db->raiseError('createLOB: '.$arguments['type'] . ' is not a valid type of large object'); } } else { if (isset($arguments['class'])) { http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/fbsql.php?r1=1.11&r2=1.12&ty=u Index: pear/MDB2/MDB2/Driver/Datatype/fbsql.php diff -u pear/MDB2/MDB2/Driver/Datatype/fbsql.php:1.11 pear/MDB2/MDB2/Driver/Datatype/fbsql.php:1.12 --- pear/MDB2/MDB2/Driver/Datatype/fbsql.php:1.11 Fri Oct 22 16:38:34 2004 +++ pear/MDB2/MDB2/Driver/Datatype/fbsql.php Wed Oct 27 12:56:57 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: fbsql.php,v 1.11 2004/10/22 20:38:34 lsmith Exp $ +// $Id: fbsql.php,v 1.12 2004/10/27 16:56:57 lsmith Exp $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -72,16 +72,16 @@ { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; switch ($type) { - case 'boolean': - return $value == 'T'; - case 'time': - if ($value[0] == '+') { - return substr($value, 1); - } else { - return $value; - } - default: - return $this->_baseConvertResult($value, $type); + case 'boolean': + return $value == 'T'; + case 'time': + if ($value[0] == '+') { + return substr($value, 1); + } else { + return $value; + } + default: + return $this->_baseConvertResult($value, $type); } return $this->_baseConvertResult($value, $type); } http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/ibase.php?r1=1.14&r2=1.15&ty=u Index: pear/MDB2/MDB2/Driver/Datatype/ibase.php diff -u pear/MDB2/MDB2/Driver/Datatype/ibase.php:1.14 pear/MDB2/MDB2/Driver/Datatype/ibase.php:1.15 --- pear/MDB2/MDB2/Driver/Datatype/ibase.php:1.14 Sat Oct 23 05:58:01 2004 +++ pear/MDB2/MDB2/Driver/Datatype/ibase.php Wed Oct 27 12:56:57 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: ibase.php,v 1.14 2004/10/23 09:58:01 quipo Exp $ +// $Id: ibase.php,v 1.15 2004/10/27 16:56:57 lsmith Exp $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -71,12 +71,12 @@ { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; switch ($type) { - case 'decimal': - return sprintf('%.'.$db->options['decimal_places'].'f', doubleval($value)/pow(10.0, $db->options['decimal_places'])); - case 'timestamp': - return substr($value, 0, strlen('YYYY-MM-DD HH:MM:SS')); - default: - return $this->_baseConvertResult($value, $type); + case 'decimal': + return sprintf('%.'.$db->options['decimal_places'].'f', doubleval($value)/pow(10.0, $db->options['decimal_places'])); + case 'timestamp': + return substr($value, 0, strlen('YYYY-MM-DD HH:MM:SS')); + default: + return $this->_baseConvertResult($value, $type); } } @@ -109,29 +109,28 @@ function _getTypeDeclaration($field) { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; - switch ($field['type']) - { - case 'text': - $length = (isset($field['length']) ? $field['length'] : (!MDB2::isError($length = $db->options['default_text_field_length']) ? $length : 4000)); - return 'VARCHAR ('.$length.')'; - case 'clob': - return 'BLOB SUB_TYPE 1'; - case 'blob': - return 'BLOB SUB_TYPE 0'; - case 'integer': - return 'INTEGER'; - case 'boolean': - return 'CHAR (1)'; - case 'date': - return 'DATE'; - case 'time': - return 'TIME'; - case 'timestamp': - return 'TIMESTAMP'; - case 'float': - return 'DOUBLE PRECISION'; - case 'decimal': - return 'DECIMAL(18,'.$db->options['decimal_places'].')'; + switch ($field['type']) { + case 'text': + $length = (isset($field['length']) ? $field['length'] : (!MDB2::isError($length = $db->options['default_text_field_length']) ? $length : 4000)); + return 'VARCHAR ('.$length.')'; + case 'clob': + return 'BLOB SUB_TYPE 1'; + case 'blob': + return 'BLOB SUB_TYPE 0'; + case 'integer': + return 'INTEGER'; + case 'boolean': + return 'CHAR (1)'; + case 'date': + return 'DATE'; + case 'time': + return 'TIME'; + case 'timestamp': + return 'TIMESTAMP'; + case 'float': + return 'DOUBLE PRECISION'; + case 'decimal': + return 'DECIMAL(18,'.$db->options['decimal_places'].')'; } return ''; } http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/mssql.php?r1=1.11&r2=1.12&ty=u Index: pear/MDB2/MDB2/Driver/Datatype/mssql.php diff -u pear/MDB2/MDB2/Driver/Datatype/mssql.php:1.11 pear/MDB2/MDB2/Driver/Datatype/mssql.php:1.12 --- pear/MDB2/MDB2/Driver/Datatype/mssql.php:1.11 Fri Oct 22 16:38:34 2004 +++ pear/MDB2/MDB2/Driver/Datatype/mssql.php Wed Oct 27 12:56:57 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: mssql.php,v 1.11 2004/10/22 20:38:34 lsmith Exp $ +// $Id: mssql.php,v 1.12 2004/10/27 16:56:57 lsmith Exp $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -71,20 +71,20 @@ { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; switch ($type) { - case 'boolean': - return $value == '1'; - case 'date': - if (strlen($value) > 10) { - $value = substr($value,0,10); - } - return $value; - case 'time': - if (strlen($value) > 8) { - $value = substr($value,11,8); - } - return $value; - default: - return $this->_baseConvertResult($value,$type); + case 'boolean': + return $value == '1'; + case 'date': + if (strlen($value) > 10) { + $value = substr($value,0,10); + } + return $value; + case 'time': + if (strlen($value) > 8) { + $value = substr($value,11,8); + } + return $value; + default: + return $this->_baseConvertResult($value,$type); } } http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/oci8.php?r1=1.12&r2=1.13&ty=u Index: pear/MDB2/MDB2/Driver/Datatype/oci8.php diff -u pear/MDB2/MDB2/Driver/Datatype/oci8.php:1.12 pear/MDB2/MDB2/Driver/Datatype/oci8.php:1.13 --- pear/MDB2/MDB2/Driver/Datatype/oci8.php:1.12 Thu Sep 9 15:13:37 2004 +++ pear/MDB2/MDB2/Driver/Datatype/oci8.php Wed Oct 27 12:56:57 2004 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ -// $Id: oci8.php,v 1.12 2004/09/09 19:13:37 lsmith Exp $ +// $Id: oci8.php,v 1.13 2004/10/27 16:56:57 lsmith Exp $ require_once 'MDB2/Driver/Datatype/Common.php'; @@ -69,12 +69,12 @@ { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; switch ($type) { - case 'date': - return substr($value, 0, strlen('YYYY-MM-DD')); - case 'time': - return substr($value, strlen('YYYY-MM-DD '), strlen('HH:MI:SS')); - default: - return $this->_baseConvertResult($value, $type); + case 'date': + return substr($value, 0, strlen('YYYY-MM-DD')); + case 'time': + return substr($value, strlen('YYYY-MM-DD '), strlen('HH:MI:SS')); + default: + return $this->_baseConvertResult($value, $type); } } @@ -107,27 +107,26 @@ function _getTypeDeclaration($field) { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; - switch ($field['type']) - { - case 'text': - $length = (isset($field['length']) ? $field['length'] : (($length = $db->options['default_text_field_length']) ? $length : 4000)); - return 'VARCHAR ('.$length.')'; - case 'clob': - return 'CLOB'; - case 'blob': - return 'BLOB'; - case 'integer': - return 'INT'; - case 'boolean': - return 'CHAR (1)'; - case 'date': - case 'time': - case 'timestamp': - return 'DATE'; - case 'float': - return 'NUMBER'; - case 'decimal': - return 'NUMBER(*,'.$db->options['decimal_places'].')'; + switch ($field['type']) { + case 'text': + $length = (isset($field['length']) ? $field['length'] : (($length = $db->options['default_text_field_length']) ? $length : 4000)); + return 'VARCHAR ('.$length.')'; + case 'clob': + return 'CLOB'; + case 'blob': + return 'BLOB'; + case 'integer': + return 'INT'; + case 'boolean': + return 'CHAR (1)'; + case 'date': + case 'time': + case 'timestamp': + return 'DATE'; + case 'float': + return 'NUMBER'; + case 'decimal': + return 'NUMBER(*,'.$db->options['decimal_places'].')'; } } http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/pgsql.php?r1=1.10&r2=1.11&ty=u Index: pear/MDB2/MDB2/Driver/Datatype/pgsql.php diff -u pear/MDB2/MDB2/Driver/Datatype/pgsql.php:1.10 pear/MDB2/MDB2/Driver/Datatype/pgsql.php:1.11 --- pear/MDB2/MDB2/Driver/Datatype/pgsql.php:1.10 Fri Oct 22 16:38:34 2004 +++ pear/MDB2/MDB2/Driver/Datatype/pgsql.php Wed Oct 27 12:56:57 2004 @@ -42,7 +42,7 @@ // | Author: Paul Cooper <pgc@ucecom.com> | // +----------------------------------------------------------------------+ // -// $Id: pgsql.php,v 1.10 2004/10/22 20:38:34 lsmith Exp $ +// $Id: pgsql.php,v 1.11 2004/10/27 16:56:57 lsmith Exp $ require_once 'MDB2/Driver/Datatype/Common.php'; @@ -70,18 +70,18 @@ { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; switch ($type) { - case 'boolean': - return $value == 't'; - case 'float': - return doubleval($value); - case 'date': - return $value; - case 'time': - return $value; - case 'timestamp': - return substr($value, 0, strlen('YYYY-MM-DD HH:MM:SS')); - default: - return $this->_baseConvertResult($value, $type); + case 'boolean': + return $value == 't'; + case 'float': + return doubleval($value); + case 'date': + return $value; + case 'time': + return $value; + case 'timestamp': + return substr($value, 0, strlen('YYYY-MM-DD HH:MM:SS')); + default: + return $this->_baseConvertResult($value, $type); } } http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/sqlite.php?r1=1.11&r2=1.12&ty=u Index: pear/MDB2/MDB2/Driver/Datatype/sqlite.php diff -u pear/MDB2/MDB2/Driver/Datatype/sqlite.php:1.11 pear/MDB2/MDB2/Driver/Datatype/sqlite.php:1.12 --- pear/MDB2/MDB2/Driver/Datatype/sqlite.php:1.11 Thu Sep 9 15:13:37 2004 +++ pear/MDB2/MDB2/Driver/Datatype/sqlite.php Wed Oct 27 12:56:57 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: sqlite.php,v 1.11 2004/09/09 19:13:37 lsmith Exp $ +// $Id: sqlite.php,v 1.12 2004/10/27 16:56:57 lsmith Exp $ // require_once 'MDB2/Driver/Datatype/Common.php'; @@ -71,10 +71,10 @@ { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; switch ($type) { - case 'decimal': - return sprintf('%.'.$db->options['decimal_places'].'f', doubleval($value)/pow(10.0, $db->options['decimal_places'])); - default: - return $this->_baseConvertResult($value, $type); + case 'decimal': + return sprintf('%.'.$db->options['decimal_places'].'f', doubleval($value)/pow(10.0, $db->options['decimal_places'])); + default: + return $this->_baseConvertResult($value, $type); } }
« previous php.pear.cvs (#25293) next »