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

Request #3294 Better data type support.
Submitted: 2005-01-25 21:07 UTC
From: rolf at winmutt dot com Assigned:
Status: Closed Package: DB_DataObject
PHP Version: 5.0.3 OS: any
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 27 - 6 = ?

 
 [2005-01-25 21:07 UTC] rolf at winmutt dot com
Description: ------------ I would be nice if data such as length of varchar and default values would be accessable : x VARCHAR(32) DEFAULTS 'hello moto'; Particularly so maxlength and other validation could be handled at the DB::DataObject::FormBuilder level.

Comments

 [2005-01-26 15:28 UTC] rolf at winmutt dot com
Also in DB::DataObject::Generator, TEXT is treated as a STR not TXT : I've changed as follows : case 'TEXT': case 'MEDIUMTEXT': case 'LONGTEXT': $type = DB_DATAOBJECT_TXT; break;
 [2005-01-26 18:14 UTC] rolf at winmutt dot com
There is obviously no support for TXT in DO, I am currently working on providing diff's to resolve the TXT issue. I also have a suggestion with max length, storing it in the table do class vs schema ini.
 [2005-01-27 13:35 UTC] alan_k
It would probably be a short bit of code to call tableInfo if this was really required (eg. the varchar len). I'm not sure if TXT is a red herring, the change you made to the generator will prevent escaping/quoting of text fields.
 [2005-01-28 01:22 UTC] rolf at winmutt dot com
I have made some other additional changes in DB_DO for proper support of TXT. I will be more than happy to submit diffs if you want me to.
 [2005-01-31 02:11 UTC] rolf at winmutt dot com
Here is a diff from DB::DO to support this : winmutt@winmutt$ diff DataObject.php /usr/local/share/pear/DB/DataObject.php 216c216 < var $_DB_DataObject_version = "@version@"; --- > var $_DB_DataObject_version = "1.7.2"; 937c937 < if ($v & DB_DATAOBJECT_STR) { --- > if (($v & DB_DATAOBJECT_STR) || ($v & DB_DATAOBJECT_TXT)) { 1129c1129 < if ($v & DB_DATAOBJECT_STR) { --- > if (($v & DB_DATAOBJECT_STR) || ($v & DB_DATAOBJECT_TXT)) { 2169c2169 < if ($v & DB_DATAOBJECT_STR) { --- > if (($v & DB_DATAOBJECT_STR) || ($v & DB_DATAOBJECT_TXT)) { 2833c2833 < if ($v & DB_DATAOBJECT_STR) { --- > if (($v & DB_DATAOBJECT_STR) || ($v & DB_DATAOBJECT_TXT)) { 3033c3033 < case ($val & DB_DATAOBJECT_STR): --- > case (($val & DB_DATAOBJECT_STR) || ($val & DB_DATAOBJECT_TXT)): 3270c3270 < case ($cols[$col] & DB_DATAOBJECT_STR): --- > case (($cols[$col] & DB_DATAOBJECT_STR) || ($cols[$col] & DB_DATAOBJECT_TXT)):
 [2005-01-31 02:52 UTC] alan_k
why not make the text types case 'LONGTEXT': case '....': $type = DB_DATAOBJECT_TXT & DB_DATAOBJECT_STR; That way you get the quoting, and can recognize TXT types.?
 [2005-01-31 19:07 UTC] rolf at winmutt dot com
That is a great idea. Not to familiar with the code, so i just hacked in my own stuff. Can we change createTables handle test this way?
 [2005-01-31 23:24 UTC] alan_k
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.