Re: [PHP] PDO statement/resultset

2006-12-17 Thread Chris

David Duong wrote:

Hi everyone,

Let me know if there is a better place to post this.

I am playing with the idea of creating a true (KISS) abstraction layer 
that makes full use of PHP5's OOP support. So logically it would make 
sense to make use PDO wherever possible, however, one of PDO's design 
decisions was to make a prepared statement object also a result set 
(another question: ... why?) a script can not make use of the a 
statement more than once without completely fetching all the data it 
needs from the first query, before executing the next.


A likely scenario is that the prepared statement is executed and then 
before the script is done with processing the result, the same statement 
(with different binds) will need to be executed again, also using the 
result set from that statement.


Does PDO provide a method to deal with this problem? From what I 
understand the only solution would be to prepare a new statement for 
each query, even for queries with the same structure which defeats the 
purpose of a prepared statement(?) Is there a solution that is a bit 
better?


I don't think anyone understands exactly what you're trying to achieve.

Can you prepare 1 statement then use 2 different sets or parameters to 
call it?


Of course - but as you have noticed, the 1st result set has to be used 
before you can use the 2nd.


Why do you want to be able to do it another way? Are you trying to run 
queries in parallel (forking, whatever)? Are you trying to do things in 
a loop? Explain what you're trying to do and you might get a better 
response.


--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PDO statement/resultset

2006-12-14 Thread David Duong

Hi everyone,

Let me know if there is a better place to post this.

I am playing with the idea of creating a true (KISS) abstraction layer 
that makes full use of PHP5's OOP support. So logically it would make 
sense to make use PDO wherever possible, however, one of PDO's design 
decisions was to make a prepared statement object also a result set 
(another question: ... why?) a script can not make use of the a 
statement more than once without completely fetching all the data it 
needs from the first query, before executing the next.


A likely scenario is that the prepared statement is executed and then 
before the script is done with processing the result, the same statement 
(with different binds) will need to be executed again, also using the 
result set from that statement.


Does PDO provide a method to deal with this problem? From what I 
understand the only solution would be to prepare a new statement for 
each query, even for queries with the same structure which defeats the 
purpose of a prepared statement(?) Is there a solution that is a bit better?


Regards,

David

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php