PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB_DataObject » Bug #3294

Better data type support.

Details

Request #3294Better data type support.
Submitted2005-01-25 21:07 UTC
Fromrolf at winmutt dot com
StatusClosed
PackageDB_DataObject
PHP Version5.0.3
OSany
Roadmaps(Not assigned)

Comments

[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.

[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-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 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?