IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
Paradox
Search Paradox Group:

Advanced
-Collapse +Expand Paradox To/From
To/FromCODEGuides
-Collapse +Expand Paradox Store
PRESTWOODSTORE

Prestwood eMagazine

December Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyCorel Paradox / ObjectPAL Coding BoardObjectPAL Topic   Print This     

TCursor Closing Automation

TCursor Closing Automation in ObjectPAL topic (part of our Corel Paradox / ObjectPAL Coding group).

Quick Search: TCursor   Closing   Automation   TCursor Closing   TCursor Closing Automation  
abp
Altamonte Springs, Florida, USA

I know many others are in the same boat as we are....closing TCursors over and over again. We have been experimenting to create a proc or custom method that will close any open Tcursors when an error has been encountered. However, early on, we have found that Tcursors loose their assignment when you leave the method that opened them. Is there any way to get around this problem? We are hoping to alleviate having to manually type in all of the Tcursor closing methods lines. Currently our code is looking like this:

if not dbTC.open("DBList.db") then
msgStop("CRITICAL ERROR","CALL PROGRAMMER cannot open dbTC...")
return
endif

if not aTC.open(":c_reports:salesOverAll.db") then
msgStop("CRITICAL ERROR","CALL PROGRAMMER cannot open oaTC...")
dbTC.close()
return
endif

if not pdTC.open(":s_luBig Grin! ollDate.db") then
msgStop("CRITICAL ERROR","CALL PROGRAMMER cannot open pdTC...")
dbTC.close()
oaTC.close()
return
endif

if not snTC.open(":s_lu:siteName.db") then
msgStop("CRITICAL ERROR","CALL PROGRAMMER cannot open snTC...")
dbTC.close()
oaTC.close()
pdTC.close()
return
endif

if not tdTC.open(":c_reports:tourDeposit.db") then
msgStop("CRITICAL ERROR","CALL PROGRAMMER cannot open tdTC...")
dbTC.close()
oaTC.close()
pdTC.close()
snTC.close()
return
endif

if not psTC.open(":c_reports:salesPOS.db") then
msgStop("CRITICAL ERROR","CALL PROGRAMMER cannot open psTC...")
dbTC.close()
oaTC.close()
pdTC.close()
snTC.close()
tdTC.close()
return
endif

if not gsTC.open(":c_reports:salesGiftroom.db") then
msgStop("CRITICAL ERROR","CALL PROGRAMMER cannot open gsTC...")
dbTC.close()
oaTC.close()
pdTC.close()
snTC.close()
tdTC.close()
psTC.close()
return
endif

and so on.......

Any ideas out there of how to get away from this redundant process?

 Posted 20 years ago (Thread Starter)
Comment Quote
About abp -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #3510, 4 replies
Thread Started 8/27/2001 7:03:00 AM
View Counter=2443
Last Reply Posted 7/5/2017 11:19:34 PM)
Location=Altamonte Springs, Florida, USA  
Joined=20 years ago   MB Posts=88  
Most Recent Post
Rick Carter
Cincinnati OH USA
I'm surprised nobody has mentioned that you'll be able to get more informative messages on the errors that occurred by using:
if not dbTC.open("DBList.db") then
errorShow("CRITICAL ERROR","CALL PROGRAMMER cannot open dbTC...")
CLOSEALLTC()
return
endif


TCursors - how much memory do they use? Is it relative to the size of the database that they are linked to?


Well, it's basically a table in memory, so I would assume so. Why not run a check yourself, and report your results?

Databases - is there a maximum size or record number of a Paradox 9 database?

Paradox tables can get pretty large -- the key is to create a table with a larger "block size." For existing tables, you may need to create a new table with the larger "block size" and move the data over. You're likely to find more info at
Old UBB Archived Link: [URL=http://www.ParadoxCommunity.com]http://www.ParadoxCommunity.com[/URL]
and/or
Old UBB Archived Link: [URL=http://www.borland.com/devsupport/bde]http://www.borland.com/devsupport/bde[/URL]
Rick Carter
Chair, Delphi/Paradox SIG
Cincinnati PC Users Group
 Posted 20 years ago
Comment Quote
About Rick Carter -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #3522 (Level 1.1)  Reply to 3510
Thread Started 8/28/2001 11:45:00 AM
View Counter=2
Location=Cincinnati OH USA  
Joined=20 years ago   MB Posts=518  
AIBreveleri
Declare the tcursors globally in the form's 'var' block so they can be seen by the 'CLOSEALLTC' proc:

var
dbTC tcursor
oaTC tcursor
pdTC tcursor
snTC tcursor
tdTC tcursor
psTC tcursor
gsTC tcursor
...etc.
endvar

Code a proc in the forms 'proc' method to close any tcursors that are open. If you put the close method call in a try block (as here) or check for tcursor'isassigned() before closing, the code will not fail when any tcursor is already closed. If you add or remove tcursors from your form, you will need to modify the 'var' block and the 'CLOSEALLTC' proc.

proc CLOSEALLTC()
try dbTC'close() onfail endtry
try oaTC'close() onfail endtry
try pdTC'close() onfail endtry
try snTC'close() onfail endtry
try tdTC'close() onfail endtry
try psTC'close() onfail endtry
try gsTC'close() onfail endtry
...etc.
endproc

In your form code you can open the tcursors like this:

   ...
if not dbTC.open("DBList.db") then
msgStop("CRITICAL ERROR","CALL PROGRAMMER cannot open dbTC...")
CLOSEALLTC()
return
endif
if not aTC.open(":c_reports:salesOverAll.db") then
msgStop("CRITICAL ERROR","CALL PROGRAMMER cannot open oaTC...")
CLOSEALLTC()
return
endif
if not pdTC.open(":s_lu ollDate.db") then
msgStop("CRITICAL ERROR","CALL PROGRAMMER cannot open pdTC...")
CLOSEALLTC()
return
endif
if not snTC.open(":s_lu:siteName.db") then
msgStop("CRITICAL ERROR","CALL PROGRAMMER cannot open snTC...")
CLOSEALLTC()
return
endif
if not tdTC.open(":c_reports:tourDeposit.db") then
msgStop("CRITICAL ERROR","CALL PROGRAMMER cannot open tdTC...")
CLOSEALLTC()
return
endif
if not psTC.open(":c_reports:salesPOS.db") then
msgStop("CRITICAL ERROR","CALL PROGRAMMER cannot open psTC...")
CLOSEALLTC()
return
endif
if not gsTC.open(":c_reports:salesGiftroom.db") then
msgStop("CRITICAL ERROR","CALL PROGRAMMER cannot open gsTC...")
CLOSEALLTC()
return
endif
...

Now you have a repeating code fragment pattern that you can probably factor into a proc or method.

-Al.
 Posted 20 years ago
Comment Quote
About AIBreveleri -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #3516 (Level 1.2)  Reply to 3510
Reply Posted 8/27/2001 12:01:00 PM
Location= 
Joined=20 years ago   MB Posts=286   KB Comments=8  
abp
Altamonte Springs, Florida, USA
Many thanks to both of you for the speedy responses. I am going to test these ideas in a few, but in the meanwhile, I thought I might pick your brains a little more, if you don't mind.

TCursors - how much memory do they use? Is it relative to the size of the database that they are linked to?

Databases - is there a maximum size or record number of a Paradox 9 database?

Once again, thanks! I'll let you know how the tests go too.
 Posted 20 years ago (Thread Starter)
Comment Quote
About abp -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #3519 (Level 1.3)  Reply to 3510
Reply Posted 8/28/2001 11:08:00 AM
Location=Altamonte Springs, Florida, USA  
Joined=20 years ago   MB Posts=88  
abp
Altamonte Springs, Florida, USA
Terrific! Al, I tried your CLOSEALLTC proc and it worked! I feel liberated!

I hope others will benefit too! Big Grin!
 Posted 20 years ago (Thread Starter)
Comment Quote
About abp -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #3520 (Level 1.4)  Reply to 3510
Reply Posted 8/28/2001 11:37:00 AM
Location=Altamonte Springs, Florida, USA  
Joined=20 years ago   MB Posts=88  

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P147A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #3510 Counter
2443
Since 4/2/2008

Regarding...

Linked Knowledge Base Article.

This thread is linked to the following KB article.


Mike Prestwood
1. Using ObjectPAL's TCursor Object Type

Exploring ObjectPAL's TCursor object type.

Posted to KB Topic: OPAL: Language Details
13 years ago, and updated 12 years ago
(2 KB Comments)

KB Post
Nothing New Since Your Last Visit
41017
Hits

Corel Paradox / ObjectPAL Coding

Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2021 Prestwood IT Solutions.   [Security & Privacy]