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] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-03-21 11:16 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-10-14 14:15 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!