Re: [DB] returning typed data when fetching rows

From: Date: Fri, 06 Aug 2004 15:08:12 +0000
Subject: Re: [DB] returning typed data when fetching rows
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-32485@lists.php.net to get a copy of this message
On Aug 6, 2004, at 9:33 AM, Daniel Convissor wrote:
As Lukas has mentioned elsewhere, MDB does some of the typing you're interested in. I believe DB_DataOjbect does similar things.
As Guillaume has noted, DB_Table recognizes the column types automatically (because they are embedded in the class). I'm not sure how difficult it would be to build an add-on method to select() that calls recast() on the returned data set. For those who don't know, the DB_Table::recast() method looks at the column definitions and forcibly recasts an array of values to the "proper" type. Guillaume, do you think an add-on to DB_Table would be useful in this case? If so, write up a patch and we can work on incorporating it. For more information about DB_Table, please see
    http://wiki.ciaweb.net/yawiki/index.php?area=DB_Table
Beside the array data type, I don't see much value in strongly typing the output because PHP isn't a strongly typed language.
Apparently Guillaume sees some value in it. ;-) But I must agree with regard to supporting the "array" data type; I don't think the PEAR abstraction libraries can reasonably be expected to handle them all. E.g., I think PG has a "geo" data type for latitude/longitude coordinates; in the same manner MySQL has its own special types (enum, set). -- Paul M. Jones Savant: the simple alternative to Smarty for PHP. http://phpsavant.com/ DB_Table: build RDBMS tables and XHTML forms in one PHP class. http://wiki.ciaweb.net/yawiki/index.php?area=DB_Table Yawiki: a collaborative online documentation system. http://yawiki.com/ Yawp: a single-file foundation for PHP applications. http://phpyawp.com/

« previous php.pear.dev (#32485) next »