Programming Tools
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingProgramming Tools

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 12th, 2003, 06:25 AM
benos benos is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 233 benos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Article Discussion: Developing a VBScript Class for an Extremely Lightweight Recordse

If you have any questions or comments about this article please post them here.

This forum post relates to this article

Reply With Quote
  #2  
Old April 7th, 2003, 11:53 AM
kreg kreg is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 1 kreg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
bug fix in LoadPersisted function

fantastic stuff!
having reviewed the code, i have 2 questions.
i e-mailed Tom and have posted his replies after each question:

QUESTION:
1) is there any specific reason why you chose to pass a recordset object to the Load function rather than create (and destroy) the recordset inside of the function itself?
i was thinking of this:
- passing the connection string and the SQL statement as parameters to the Load function
- create the recordset within the Load function
- read the data into the arrays
- destroy the recordset
it seems to me that this would better emulate the way a recordset is created and filled with data, and would eliminate the need for the user to create his own recordset and then remember to destroy it.

ANSWER:
Good point. Makes a lot of sense, really. I suppose I did it out of my own remaining "timidness" to move entirely away from ADO recordsets myself! That is, I can still see them being created, and still have the job of destroying them...rather than trust that the VBScript class is doing it for me (even though I wrote the darned thing!). Sure, it make perfect sense to make the break complete, and let the class do all the housekeeping. Go for it.

QUESTION:
2) When you load a persisted ArraySet object with the LoadPersisted function, it only reads in the arFieldNames array. the Fields function attempts to access the field names through ad hoc variables created with Execute in the Load function. therefore, the Fields function will fail to ever find any data because these variables are not created in the LoadPersisted function. wouldn't you need to recreate them using a loop on the arFieldNames array?

ANSWER:
Good point, you spotted a bug that I somehow didn't test for. So, looking the code over and following your lead, I see I *did* the following...

- Create the arFieldNames array
- Load it with values from the recordset
- Generate the ad hoc variables with Execute()
- Save the arFieldNames array when persisting
- Load the arFieldNames array when reloading persisted data

...but did NOT do the following...

- Perform the Execute() statement on the arFieldNames array
when reloading persisted data

So, because the internals rely on the ad hoc variables created
with Execute when stepping through the records, reloaded ArraySets fail because there are no field-name values to work with.

If I've followed you correctly, then yes, this is a bug and needs to be fixed! Feel free to make up a little For/Next loop on the LoadPersisted method to do the job for yourself -- and it should work fine.

Reply With Quote
  #3  
Old August 17th, 2004, 09:48 PM
space space is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 2 space User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up Where is the Download source link?

Great article. I had done something similar, just using arrays directly, but hadn't gone so far as to build an Arrayset class. Very straight-forward and very clean. I'm sure I'll be putting this to good use. I've looked all over for the source download you mentioned and could not find it, so I spent some time copying it out manually.

Anyway Thanks,

Space

Reply With Quote
  #4  
Old August 19th, 2004, 02:11 PM
space space is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 2 space User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Additional problem with persisted arrayset

I guess Tom doesn't follow this forum. Anyway, I just realized that
there is an additional problem with not being able to use multiple
Arraysets from the same or different tables on the same page, as
long as they have matching column names (like "ID").

It looks like the "strUniqueID" needs to be incorporated into the
ad-hoc variable names, otherwise you'll get an error attempting
to create two variables having the same name. This also must be
incorporated into the LoadPersist methods upon reloading.

I guess you could just get creative with the SQL "AS" statement ensuring the
columns never have the same names.

space

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingProgramming Tools > Article Discussion: Developing a VBScript Class for an Extremely Lightweight Recordse


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT