[DB-SIG] ADO

M.-A. Lemburg mal at egenix.com
Tue Nov 25 06:33:34 EST 2003


martin at sterling2000.co.uk wrote:
> I have been searching the net for two weeks now but can find nothing on disconnected recordsets.
> 
> I have been programming in VB6 for two years and have had quite a success with disconnected resordsets with the following code:-
> 
>     Dim acUpdateable As Connection
>     
>     Set acUpdateable = New Connection
>     acUpdateable.Open gBRDataBase
> 
>     Set rsUpdateable = New ADODB.Recordset
>     
>     rsUpdateable.CursorLocation = adUseClient
>     rsUpdateable.LockType = adLockBatchOptimistic
>     rsUpdateable.CursorType = adOpenForwardOnly
> 
>     rsUpdateable.Open sSQL, acUpdateable
>     
>     rsUpdateable.MarshalOptions = adMarshalModifiedOnly
>     Set rsUpdateable.ActiveConnection = Nothing
>     acUpdateable.Close
>     Set acUpdateable = Nothing
> 
> I can implement most of this within Python but not the bit after Marshalling.
> 
> I can read and write to the database but as soon as I try to disconnect the recordset Python cannot see the cursor.
> 
> Is it possible to use disconnected recordsets with Python and if so where can I find information on the subject.
> 
> Any help you can offer would be gratefully received.

Why not load the result set into memory and then use iterators to
read from it (without an active connection the result will have to
be copied into client memory anyway) ?

resultset = cursor.fetchall()

for row in resultset:
     ....

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Software directly from the Source  (#1, Nov 24 2003)
 >>> Python/Zope Products & Consulting ...         http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::




More information about the DB-SIG mailing list