At 9:03 PM -0700 9/10/06, Daniel L. Taylor wrote:
I have some questions regarding the RecordSet class that I hope somebody can
help me with.
1) You execute a query and have a RecordSet. Does the RecordSet maintain the
entire current record in memory, the entire collection of records, or does
it only read data from the database on demand, i.e. when you call
RecordSet.Field? (I'm *guessing* it holds the current record in memory,
which is why you can't move backwards with some databases.)
I think the Sybase ASE plugin brings back all the records into memory
to allow subqueries. It still doesn't allow you move the cursor
position backwards - only forwards is allowed.
2) Is there any penalty for keeping an open RecordSet around for a long
time? What if there are a lot of open RecordSets?
I wouldn't keep it longer than necessary.
Some dbs also need you to .close the recordset, as the act of getting
the recordset locks the db.
Sybase via ODBS used to do this as did ?? MySQL(??) I don't know
with the new and improved versions of both plugins.
Here's why I'm asking. I have a project with a lot of tables. For this
project, in some ways it would be beneficial to wrap records in classes, but
I'm not sure if it would be best to query, read RecordSet data into
properties, then close the RecordSet, re-opening it later and mapping
property-to-field for updates. OR if it would be better to keep the
RecordSet in a private property of the class, and have public properties
which actually just read from/write to the RecordSet in real time. I'm
tempted to do the last one in this case.
It depends on the likelehood of two people needing/editing the data
at the same time.
I wouldn't do it that way, but them I am old and stuck in my ways.
For single row of data in a recordset I have usually loaded the
recordset row into a class that mimics the table structure/recordset
fields.Then close the record set immediately after sucking out the
data.
This has good and bad points. You can implement a nice undo/Save or
Don't Save GUI/implement auditing/ while not locking the db during
the edit etc etc but you can run into a problem if two people open
the same recordset and suck out the same data at the same time. The
last person to push the copies of the data back from the object back
into the database is the winner. Not a great loss for the stuff I do
but something to think about.
Any thoughts on this?
Daniel L. Taylor
Taylor Design
Computer Consulting & Software Development
[EMAIL PROTECTED]
www.taylor-design.com
--
Cheers,
Dr Gerard Hammond
MacSOS Solutions
http://www.macsos.com.au
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>