metapear datatypes
| From: | Tomas V.V.Cox | Date: | Wed, 20 Mar 2002 18:43:13 +0000 |
| Subject: | metapear datatypes | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-5061@lists.php.net to get a copy of this message | ||
El mié, 20-03-2002 a las 19:21, Stig S. Bakken escribió:
> On Wed, 2002-03-20 at 18:00, Lukas Smith wrote:
> > > Aha! We're misunderstanding eachother, I'm talking about escaping
> > > special characters in data before embedding it in the query. As for
> > > types, yes you're right. Today PEAR's prepare emulation puts
> > ampersands
> > > and escapes only string data, so you have control over that by passing
> > > data with the right PHP types. Ideally we should have some knowledge
> > of
> > > the types in the database, but I'm not sure if that is realistic.
> >
> > Well metabase can do both.
> > Metabase has internal datatypes that it maps to RDBMS specific
> > datatypes.
> > These datatypes are used for prepared queries and can also be used for
> > normal queries. Metabase is also aware of the escape characters for each
> > RDBMS.
>
> Does Metabase have this information because of the XML table definition
> files, or does it retrieve it from the database?
>
AFAIK Metabase doesn't support place holders and doesn't retrieve the
info automatically, is the user the one how has to pass the correct
types. This is IMHO a little uncomfortable:
$sql = "INSERT INTO foo VALUES (". metabaseTypeXXX($var) . ", " . ...
Perhaps I'm wrong, please correct me if so.
I put some ideas on how to handle datatypes with placeholders in a more
easy way at php4/pear/DB/IDEAS. I guess is not possible to be able to
automatically do this stuff at least in prepare/exec. What perhaps could
be done is when you get the data back from a fetch action (doing
something like tableinfo($res) does) but it won't work in other backend
different than MySQL. In short, datatypes will be a manual thing that
should be though to be as easy as we can.
John, how do you do it for ADODB?
Tomas V.V.Cox