Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Working with recordsets

Reply
Thread Tools

Working with recordsets

 
 
chema.rey@gmail.com
Guest
Posts: n/a
 
      01-07-2005
Hi.

I have one recorset that I would like to pass to 2 functions, one is
for create an CSV file and the other one is to create a HTML file. The
problem is that the recordset is totally read in the first function,
and then when I pass it to the second funtion the recordset is in the
last record.

I've read docs, but I think that one cursor doesn't have something
like movefirst() method. Anybody have an idea to solve this?

Thank's.

 
Reply With Quote
 
 
 
 
AdSR
Guest
Posts: n/a
 
      01-07-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Hi.
>
> I have one recorset that I would like to pass to 2 functions, one is
> for create an CSV file and the other one is to create a HTML file. The
> problem is that the recordset is totally read in the first function,
> and then when I pass it to the second funtion the recordset is in the
> last record.
>
> I've read docs, but I think that one cursor doesn't have something
> like movefirst() method. Anybody have an idea to solve this?
>
> Thank's.
>


Try loading the whole recordset with the fetchall() method and use the
resulting sequence in your functions. It won't be memory-efficient but
it will be easy to do.

AdSR
 
Reply With Quote
 
 
 
 
Steve Holden
Guest
Posts: n/a
 
      01-08-2005
AdSR wrote:

> (E-Mail Removed) wrote:
>
>> Hi.
>>
>> I have one recorset that I would like to pass to 2 functions, one is
>> for create an CSV file and the other one is to create a HTML file. The
>> problem is that the recordset is totally read in the first function,
>> and then when I pass it to the second funtion the recordset is in the
>> last record.
>>
>> I've read docs, but I think that one cursor doesn't have something
>> like movefirst() method. Anybody have an idea to solve this?
>>
>> Thank's.
>>

>
> Try loading the whole recordset with the fetchall() method and use the
> resulting sequence in your functions. It won't be memory-efficient but
> it will be easy to do.
>
> AdSR


Or, if this doesn't suit, try creating two separate cursors from the
same connection and execute the same query on each. There's some chance
that your database driver/backend combination will optimize the queries
then.

regards
Steve
--
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/
Holden Web LLC +1 703 861 4237 +1 800 494 3119
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Several Recordsets...Close the Connection Each Time? Bob ASP .Net 3 02-22-2007 12:25 PM
Several Recordsets...Close the Connection Each Time? Bob ASP .Net 0 02-22-2007 05:30 AM
ADO+RECORDSETS Guy Cohen ASP .Net 2 01-19-2007 06:52 PM
Q: About how/where to store RecordSets in UserControls? Sky ASP .Net 2 03-04-2004 10:13 AM
how to mix 2 recordsets into one result table? AFN ASP .Net 5 02-11-2004 11:38 PM



Advertisments