Thread: Database Classes and prepared statements

Database Classes and prepared statements

From
"G. J. Walsh"
Date:
I have (finally) had considerable success in establishing initialized
tables for my research work in psychometrics. As a next step in my
learning curve, I introduced a class with functions sufficient to
connect to the data base and successfully run select queries and display
the resulting rows.

(I used "Beginning PHP and PostgreSQL 8 - Chapter 31 - as my starting
point.)

This will allow me to move on, but I was wondering about the use of
prepared statements. Can this functionality be included in the class -
that is I need a bit of a boost to incorporate the requisite pg_prepare
and pg_execute functions.

Assuming this is possible, could someone kindly show me some sample code
to make it happen?

George


Re: Database Classes and prepared statements

From
John DeSoi
Date:
On Mar 18, 2008, at 6:25 PM, G. J. Walsh wrote:

> This will allow me to move on, but I was wondering about the use of
> prepared statements. Can this functionality be included in the class -
> that is I need a bit of a boost to incorporate the requisite
> pg_prepare
> and pg_execute functions.
>
> Assuming this is possible, could someone kindly show me some sample
> code
> to make it happen?


There is an example here on using a PHP class to call PostgreSQL
functions using prepared statements:

http://pgedit.com/resource/php/pgfuncall




John DeSoi, Ph.D.





Re: Database Classes and prepared statements

From
"G. J. Walsh"
Date:
My thanks for the reference, John.

Given the fact that there will be no direct access to our databases, I
have decided it would be more practical to complete the full beta
testing of the site first, and then introduce either pgsql classes or
PDO later if that need is indicated. Until norm gathering has been
completed, I won't have sufficient data available to properly consider
efficiency and maintenance factors anyway. None of us has extensive
experience with object coding and that is probably still another
'abstraction' layer we don't need to introduce at the moment. It has
been challenging enough converting everything from 'C' code and c-isam
to PHP and PostgreSQL while designing the site itself. Maybe we are
better off continuing on our present path. It may not be super
sophisticated, but it works. In these days of constant change, that
counts for something.

Thanks again for your referral.

George





On Wed, 2008-03-19 at 00:36 -0400, John DeSoi wrote:
> On Mar 18, 2008, at 6:25 PM, G. J. Walsh wrote:
>
> > This will allow me to move on, but I was wondering about the use of
> > prepared statements. Can this functionality be included in the class -
> > that is I need a bit of a boost to incorporate the requisite
> > pg_prepare
> > and pg_execute functions.
> >
> > Assuming this is possible, could someone kindly show me some sample
> > code
> > to make it happen?
>
>
> There is an example here on using a PHP class to call PostgreSQL
> functions using prepared statements:
>
> http://pgedit.com/resource/php/pgfuncall
>
>
>
>
> John DeSoi, Ph.D.
>
>
>