On 07.10.2009, at 15:49, Matteo Beccati wrote:
Pierre Joye ha scritto:
On Wed, Oct 7, 2009 at 1:27 PM, Samuel ROZE
<samuel.r...@aliceadsl.fr> wrote:
This is a bit complicated and very different ! Actually, each
database
works as it want and it may be better to use different functions for
each driver.
That defeats the whole purpose of PDO. The meaning of each message
will indeed different, but if one needs to call different APIs for
each driver, I doubt anyone will ever use them.
Quoting my chat with Rasmus in Verona earlier this year: "PDO is a
database driver abstraction layer, not a database abstraction
layer", or
something along the lines, but I see your point ;)
However, I've been thinking about this a bit more and I think that the
different "message" meanings can be summarised like this:
* MySQL raises warnings, esp. when not running in strict mode
* Oracle uses them as a custom way to deliver messages/data
* PostgreSQL being a bit of both worlds: informational + custom
By all means, I like the idea of a unified "message" API, but do we
really need the syntactic sugar (and development effort)? MySQL and
Oracle drivers can already access them with a standard PDO::query()
call. Only PgSQL notices require a special treatment because they are
currently discarded.
I guess this is becoming more philosophical question: is the base PDO
class intended to only have common and portable functionalities and
leve
everything else to the drivers or should it also try and group other
similar features to be more consistent even though not likely to be
portable?
Also I guess that mixing and matching names could be confusing: an
experienced Oracle developer using "dbms_output" would hardly imagine
that they can be fetched by calling getMessages() just by taking a
quick
look to the documentation. Same goes for a Postgres developer who can
easily understand what pg_last_notice() does and would probably not
associate the familiar notice concept with getMessages.
yeah .. its certainly a valid question.
we have stuff like lastInsertId(), which depending on the driver
either gets the current value of a sequence or the last id generated
for the connection.
so going by that example unifying things under a common API makes
sense if that means that it makes writing portable code easier.
so if pgsql and mysql both give warnings that "paranoid" developers
might want to interpret as an error whatever, then it seems to make
sense to unify this under a common API .. so the key test is not to
unify messaging API's but more unify things that are semantically
similar.
regards,
Lukas Kahwe Smith
m...@pooteeweet.org
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php