cvs: pear /MDB2/MDB2/Driver/Datatype ibase.php
| From: | Lorenzo Alberton | Date: | Wed, 12 Oct 2005 14:38:29 +0000 |
| Subject: | cvs: pear /MDB2/MDB2/Driver/Datatype ibase.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-35444@lists.php.net to get a copy of this message | ||
quipo Wed Oct 12 10:38:29 2005 EDT
Modified files:
/pear/MDB2/MDB2/Driver/Datatype ibase.php
Log:
fixed mapNativeDatatype()
http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Datatype/ibase.php?r1=1.42&r2=1.43&ty=u
Index: pear/MDB2/MDB2/Driver/Datatype/ibase.php
diff -u pear/MDB2/MDB2/Driver/Datatype/ibase.php:1.42 pear/MDB2/MDB2/Driver/Datatype/ibase.php:1.43
--- pear/MDB2/MDB2/Driver/Datatype/ibase.php:1.42 Fri Oct 7 09:02:32 2005
+++ pear/MDB2/MDB2/Driver/Datatype/ibase.php Wed Oct 12 10:38:28 2005
@@ -3,8 +3,8 @@
// +----------------------------------------------------------------------+
// | PHP versions 4 and 5 |
// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2004 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
+// | Copyright (c) 1998-2005 Manuel Lemos, Tomas V.V.Cox, |
+// | Stig. S. Bakken, Lukas Smith, Lorenzo Alberton |
// | All rights reserved. |
// +----------------------------------------------------------------------+
// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
@@ -44,7 +44,7 @@
// | Lorenzo Alberton <l.alberton@quipo.it> |
// +----------------------------------------------------------------------+
//
-// $Id: ibase.php,v 1.42 2005/10/07 13:02:32 lsmith Exp $
+// $Id: ibase.php,v 1.43 2005/10/12 14:38:28 quipo Exp $
require_once 'MDB2/Driver/Datatype/Common.php';
@@ -593,18 +593,21 @@
*/
function mapNativeDatatype($field)
{
- $db_type = preg_replace('/\d/','',
strtolower($field['typname']) );
- $length = $field['attlen'];
- if ($length == '-1') {
- $length = $field['atttypmod']-4;
- }
+ $length = $field['field_length'];
if ((int)$length <= 0) {
$length = null;
}
$type = array();
- switch ($db_type) {
+ switch ($field['field_type']) {
case 'smallint':
case 'integer':
+ case 'int64':
+ //these may be 'numeric' or 'decimal'
+ if (!empty($field['field_sub_type'])) {
+ $field['field_type'] = $field['field_sub_type'];
+ continue;
+ }
+ case 'quad':
$type[] = 'integer';
if ($length == '1') {
$type[] = 'boolean';
@@ -612,6 +615,7 @@
break;
case 'char':
case 'varchar':
+ case 'cstring':
$type[] = 'text';
if ($length == '1') {
$type[] = 'boolean';
@@ -630,7 +634,9 @@
$length = null;
break;
case 'float':
+ case 'double':
case 'double precision':
+ case 'd_float':
$type[] = 'float';
break;
case 'decimal':