DB abstraction and naming conventions
[email protected] (Thomas Fromm) Mon, 5 Mar 2001 12:59:39 +0100
| Newsgroups | php.pear |
|---|---|
| Message-ID | <01030512593900.12074@obelix> |
hi,
ive missing column-naming-conventions for the PEAR.
reason:
some databases have restrictions in lenght, form and upper/lowercase
is should be said, that the columns have max 32 characters, no special chars
(exept _ ) and must be uppercase and at least must be formed like
<columnname>_<tablename> and the SQL must be SQL92.
why uppercase? some databases also oracle return column names only uppercase.
that means, the fetched array key are uppercase, and so the most of the
db-using apps in PEAR wont work with oracle.
if you said lowercase, there must be added a strtolower() in the fetching
wrapper of the oracle and oci8 api.
why <columnname>_<tablename>?
because you must be sure that the used columnname is not an reserved
objctname of any database.
i saw the same problems implemented in PEAR DB as there were in the phplib
abstraction an example:
some databases can't insert strings with more than 4000 chars without
allocating memory. (oracle can't do it with more then 2000)
so placeholder have to be used. why not implementing that in PEAR DB?
e.g. something like that
$text="foo";
$db->prepare("insert into foo values (:placeholder)");
$db->bind(":placeholder", $text);
$db->execute();
and rest is simple...
in this case databases can handle this data in their own ways.
what is with LOBs?
i think its nessesary, that the developer of the abstractions must have a
look to all databases and their features or peculiarities to avoid producing
PEAR sourcecode what only works on mysql and postgres.
the fact that the current db-using tool (e.g. cache ) wont work with oracle
shows, that there exists definitly a problem.
without fixing this problems, the PEAR DB abstractions the half of the
databases, what it supports is useless.
whats your opinion?
regards,
tf
ps: whats with LOBs?
--
--------------------------------------------------------------------------
http://phporacleadmin.org http://tfromm.com http://www.inubit.com
"go away or I will replace You with a small PHP script!"