Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SEEK(),INDEXSEEK() or KeyMatch() or SELECT-SQL?
Message
From
11/04/2005 10:50:35
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01002645
Message ID:
01003365
Views:
28
>>>I have some ideas which I'm going to implement.
>>>
>>>Do you know if there is a way to determine inside the trigger when it's the last record to replace, if, say, we're using replace next 500 command?
>>>
>>
>>No, I do not.
>>
>>A trigger is fired on a record by record basis, just before the changes are actually committed. So, the trigger only knows about that one record.
>>In the example above, the trigger would be fired 500 times (or less)
>>
>>But I'm puzzled as to why you would need that info inside the trigger
>>[snip]
>
>The reason is that I want to open all needed tables once in the beginning and close them at the end. I suspected the answer you and Fabio gave me, so I guess I'm out of luck...
____________________
out of luck ? Not really

I would only open a table if you need it
a use of a table that is already open is fast

Two options
(1) for runtime, is to open all the tables at startup of the app in a private datasession

(2) in the trigger open them if you need them, then after rollback/end transaction only close them if it is the default datasession. That way forms will go faster and when you develop, the default datasession will be cleaner
#define PRIVATEDATASESSION ( set('DataSession') > 1 )
....
  if( _triggerlevel = 1 )
      if (   )
          rollback
      else
         end transaction
      endif


     if( PRIVATEDATASESSION )
        close all table opened by me
     endif
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform