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

Request #1523 extent native datatype support for type "text"
Submitted: 2004-05-28 11:53 UTC
From: senbei at terra dot es Assigned:
Status: Closed Package: MDB2
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2004-05-28 11:53 UTC] senbei at terra dot es
Description: ------------ MDB assumes that any text type field with a length defined must be of type Char. Since some RDBMS support longer sized text fields, the text type should be customized for every RDBMS supported. The following modification takes the assumption that sized text fields smaller than 64 should be stored as CHAR (no dynamic allocation) and longer as VARCHAR or TEXT if they are bigger. Here is the code for MySQL: function getTextDeclaration($name, $field) { $qry = $name; if ($field['length']>0 && $field['length']<64) $qry .= " CHAR({$field['length']})"; else if ($field['length']>=64 && $field['length']<=256) $qry .= " VARCHAR({$field['length']})"; else $qry .= " TEXT"; $qry .= (isset($field['default'])?' DEFAULT'.$this->getTextValue($field['default']):'').(isset($field['notnull'])?' NOT NULL':''); return $qry; } For Oracle 8+ it should look like this (I haven't tested it): function getTextDeclaration($name, $field) { $qry = $name; if ($field['length']>0 && $field['length']<64) $qry .= " CHAR({$field['length']})"; else if ($field['length']>=64 && $field['length']<=4000) $qry .= " VARCHAR2({$field['length']})"; else $qry .= " CLOB"; $qry .= (isset($field['default'])?' DEFAULT'.$this->getTextValue($field['default']):'').(isset($field['notnull'])?' NOT NULL':''); return $qry; } PGSQL and FrontBase do handle CHAR and VARCHAR as a CLOB (1gb+) so a simple VARCHAR($field['length']) will do for it. FireBird supports upto 64Kb CHAR and VARCHAR types. MsSQL says in it's documentation that the maximum size is 8000 for CHAR and VARCHAR fields. ciao, ivan

Comments

 [2004-06-04 11:14 UTC] smith at backendmedia dot com
Well the main reason why things are the way they are is that there is datatype "clob". However I guess it doesnt hurt to allow the maximum supported field type which does not require any special fetching methods. I actually dont know if you have to use the LOB API to fetch a clob from oracle.
 [2006-03-11 10:38 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-05-02 20:11 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!