Thread: Re: Php abstraction layers

Re: Php abstraction layers

From
Hannes Dorbath
Date:
> In this situation, what would be the advantage of using an abstraction layer?

NONE.

PEAR::DB is one of the worst classes in PEAR and has lots of ugly code
in it. AdoDB is IMHO a bit better, but as you said yourself, there is
not a single reason why you should go through all the trouble of using
DBMS abstraction layers, if you don't need them. The whole approche of
such things is quite daft, because they abstract your DBMS API, but
that's it. The different SQL implementations are not portable, not to
mention pl/xxx functions, triggers, rules etc. Such things are usually
advertised by users of stupid storage engines like MySQL, SqLite and
people with very little knowlege.

http://www.powerpostgresql.com/Downloads/database_depends_public.swf

Though it might be a good idea to write yourself a set of functions /
classes to handle escaping of data and make your DBMS work easier.

To prevent SQL injections in PHP5.1, take a look at pg_query_params().


Best regards,
Hannes Dorbath

Re: Php abstraction layers

From
Hannes Dorbath
Date:
> Would it be a good decision to use PDO instead of pg_ functions?

I don't see much benefits in using it, it just provides a common API
naming scheme. It's maybe easier in case you work with a gazillion
different DBMS and have trouble remembering function names, but that's
it. On the other hand it locks you out from special API features /
functions of PG. I wouldn't bother with it, especially not in your case.


Best regards,
Hannes Dorbath

Re: Php abstraction layers

From
"Antimon"
Date:
Thanks for the reply.
I checked new 5.1 pg_ functions and i wanna ask something else. What do
you think about PDO? It is not an abstraction layer, just something
like wrapper. I thought as it supports both widely used dbmss, php
developers would focus on it more than pg or mysqli functions and that
can make it powerful.
Would it be a good decision to use PDO instead of pg_ functions?


Re: Php abstraction layers

From
Greg Stark
Date:
"Antimon" <antimon@gmail.com> writes:

> Thanks for the reply.
> I checked new 5.1 pg_ functions and i wanna ask something else. What do
> you think about PDO? It is not an abstraction layer, just something
> like wrapper. I thought as it supports both widely used dbmss, php
> developers would focus on it more than pg or mysqli functions and that
> can make it powerful.
> Would it be a good decision to use PDO instead of pg_ functions?

My understanding is that PDO is the way and the light. Use PDO.

Unfortunately my project began before PDO saw the light of day, but I plan to
migrate to it eventually.

--
greg

Re: Php abstraction layers

From
"Gavin M. Roy"
Date:
IMO I think it really depends on what you want to do.  The
pg_functions are the *most* robust and full featured.  There are
problems with PDO (mostly function related at this point).  That
being said, PDO is great to work with when you get into it, and learn
your way around it.   If your project is pgsql only and will only be
pgsql only, I'd suggest using the pg_ functions.  I use both
extensively, but only use PDO on projects where I want other
programmers to be able to extend my work with other dbms support.  If
you're new to PHP db programming, PDO might not be the easiest way to
go, it's still a little rough around the edges.  Good luck and let me
know if you need any help with either.  There's also a pgsql+php list
you might want to jump on: http://www.postgresql.org/community/lists/
subscribe and http://archives.postgresql.org/pgsql-php/

Regards,

Gavin



On Aug 30, 2005, at 8:00 PM, Greg Stark wrote:

> "Antimon" <antimon@gmail.com> writes:
>
>
>> Thanks for the reply.
>> I checked new 5.1 pg_ functions and i wanna ask something else.
>> What do
>> you think about PDO? It is not an abstraction layer, just something
>> like wrapper. I thought as it supports both widely used dbmss, php
>> developers would focus on it more than pg or mysqli functions and
>> that
>> can make it powerful.
>> Would it be a good decision to use PDO instead of pg_ functions?
>>
>
> My understanding is that PDO is the way and the light. Use PDO.
>
> Unfortunately my project began before PDO saw the light of day, but
> I plan to
> migrate to it eventually.
>
> --
> greg
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>

Gavin M. Roy
800 Pound Gorilla
gmr@ehpg.net



Re: Php abstraction layers

From
Hannes Dorbath
Date:
On 31.08.2005 05:00, Greg Stark wrote:
  > My understanding is that PDO is the way and the light. Use PDO.

Maybe you could provide some arguments on why it should be that?