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

Bug #10003 integer length problem
Submitted: 2007-02-01 06:25 UTC Modified: 2007-02-03 19:01 UTC
From: priyadi Assigned: quipo
Status: Closed Package: MDB2_Driver_oci8 (version 1.3.0)
PHP Version: Irrelevant OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2007-02-01 06:25 UTC] priyadi (Priyadi)
Description: ------------ in other drivers (pgsql and mysql at least), integer 'length' attribute refers to the length of the integer field in bytes. however, in current oci8 driver, it denotes the maximum number of digits. example: 'fieldname' => array ( 'type' => 'integer', 'length' => 8, ) the above field definition under mysql will create a 'bigint(20)'. but under oci8, it will only create 'number(8)'. assigning a value of 100000000 to the mysql field will definitely succeed, but it will fail under oci8 because the field do not have sufficient number of digits. proposed patch: --- oci8.php.orig 2007-02-01 15:59:08.000000000 +0700 +++ oci8.php 2007-02-01 18:13:13.000000000 +0700 @@ -125,7 +125,18 @@ return 'BLOB'; case 'integer': if (!empty($field['length'])) { - return 'NUMBER('.$field['length'].')'; + switch($field['length']) { + case 1: $digit = 3; break; + case 2: $digit = 5; break; + case 3: $digit = 8; break; + case 4: $digit = 10; break; + case 5: $digit = 13; break; + case 6: $digit = 15; break; + case 7: $digit = 17; break; + case 8: $digit = 20; break; + default: $digit = 10; + } + return 'NUMBER('.$digit.')'; } return 'INT'; case 'boolean': @@ -463,4 +474,4 @@ } } this patch will fix the problem for integers with at most 8 byte long. it defaults to 4 byte when unspecified (max 2147483648 signed, or 10 digits under oci8).

Comments

 [2007-02-03 19:01 UTC] quipo (Lorenzo Alberton)
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.