Re: MDB2 and Data Type Abstraction

From: Date: Wed, 05 May 2004 07:38:32 +0000
Subject: Re: MDB2 and Data Type Abstraction
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-28813@lists.php.net to get a copy of this message
Justin Patrin wrote:
Basically, I was looking for some kind of automatic datatype abstraction. In other words, I've created an XML schema for my DB, which creates it for me. I like that. But now that I want to query, that all seems to go away. To get the types back correctly (date conversions, etc) I have to specify the types in the call...even though I already specified it for the table in the XML file.
I dont have a solution for that ATM.
Basically what I'm looking for is to specify a table, give an assoc array of values, and have my record inserted or updated. This is part of what DB_DataObject does, but I'm looking for something a bit simpler.
Actually as you have seen on the list people are working on an MDB_DataObject. This is how I envision we will be able to cover that request. And without generating the SQL its kinda hard to know what you are inserting into your queries are fetching from your result sets. So you really need something like DB_DO for this kind of stuff (I think?).
Another question as well, as I'll probably have to implement some of this myself. Is there any way to tell MDB to read in the XML file into a useful format in PHP that I could use? (Akin to DB_DataObject's config array.)
Using the Manager you can read in an array representation of the schema file. Check out the example.php file in the docs/examples/ directory. At the very bottom I show how that can be done (in this case I load the schema via the reverse engineering code, but if you load the schema from an existing xml file it works just as well). regards, Lukas Smith smith@backendmedia.com _______________________________ BackendMedia www.backendmedia.com berlin@backendmedia.com Linn Zwoch Smith GbR Pariser Str. 44 D-10707 Berlin Tel +49 30 83 22 50 00 Fax +49 30 83 22 50 07

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