Pg module and several result objects
Pg module and several result objects
От:
"Timur V. Irmatov" <itvthor@sdf.lonestar.org>
Дата:
Hello, People! I'm using Pg module to access PostgreSQL from my perl scripts. I have a question which is not clarified by reading man page.. Suppose I have one query: my $res = $conn->exec(...); and then I perfrom seconf one: my $res2 = $conn->exec(...); Thus, I use two different result objects and perform fetchrow on them in turn. I think it is OK, and I have checked that on practice. But to be sure, I'd like to hear it from people who know the truth ;-) Sincerely Yours, Timur mailto:itvthor@sdf.lonestar.org
Re: Pg module and several result objects
От:
Martijn van Oosterhout <kleptog@svana.org>
Дата:
On Fri, Oct 11, 2002 at 05:10:28PM +0500, Timur V. Irmatov wrote: > Hello, People! > > I'm using Pg module to access PostgreSQL from my perl scripts. I have > a question which is not clarified by reading man page.. > > Suppose I have one query: > my $res = $conn->exec(...); > and then I perfrom seconf one: > my $res2 = $conn->exec(...); > > Thus, I use two different result objects and perform fetchrow on them > in turn. I think it is OK, and I have checked that on practice. But > to be sure, I'd like to hear it from people who know the truth ;-) Yes, you can do this. When you do the query, the entire result is shipped to the client before it returns. So it works. It also means that if you have a really large resultset, you'll need to use cursors to manage it. -- Martijn van Oosterhout http://svana.org/kleptog/ > There are 10 kinds of people in the world, those that can do binary > arithmetic and those that can't.