Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.5.0b5

Request #7170 length/scale support for numeric types
Submitted: 2006-03-21 10:27 UTC
From: nolife at gmail dot com Assigned: lsmith
Status: Closed Package: MDB2 (version 2.0.0)
PHP Version: 5.1.2 OS: irrelevant
Roadmaps: (Not assigned)    
Subscription  


 [2006-03-21 10:27 UTC] nolife at gmail dot com (nolife)
Description: ------------ There are a few issues with numeric datatypes and the oci8 driver (did not check other drivers). for once: when the integer datatype is used oracle (9r2) changes it into a number(38) which is probably more than expected and required. when the boolean datatype is used the oci8.php driver also uses an INT type internal, which means we have 38 digits for a true/false datatype. a length parameter is not supported. The patch below can be used to implements a length parameter for INT,NUMBER and DECIMAL. it also changes the default of INT for boolean to a NUMBER(1) Test script: --------------- Changes in: /usr/share/php/MDB2/Driver/Datatype/oci8.php ------------------------------------------------------- --- oci8_orig.php 2006-03-17 11:24:18.000000000 +0100 +++ oci8.php 2006-03-17 11:43:38.000000000 +0100 @@ -123,9 +123,11 @@ case 'blob': return 'BLOB'; case 'integer': - return 'INT'; + $length = array_key_exists('length', $field) + ? $field['length'] : "*"; + return 'NUMBER('.$length.')'; case 'boolean': - return 'INT'; + return 'NUMBER(1)'; case 'date': case 'time': case 'timestamp': @@ -133,7 +135,9 @@ case 'float': return 'NUMBER'; case 'decimal': - return 'NUMBER(*,'.$db->options['decimal_places'].')'; + $length = array_key_exists('length', $field) + ? $field['length'] : "*"; + return 'NUMBER('.$length.','.$db->options['decimal_places'].')'; } } @@ -282,4 +286,4 @@ } } -?> \ Kein Zeilenumbruch am Dateiende. +?> -------------------------------------------------------

Comments

 [2006-03-21 10:29 UTC] lsmith (Lukas Smith)
fixed package name .. generally i need to revisit the entire topic of length (and scale for decimal) of numeric fields ..
 [2006-03-21 11:16 UTC] lsmith (Lukas Smith)
Ok, I fixed the boolean definition. The rest of the bug report is concerned with adding length/scale to numeric types, which is a generic topic so I am turning this into an MDB2 bug again.
 [2006-10-14 14:15 UTC] lsmith (Lukas Smith)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.