Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Same SQL file multiple procedures
Message
 
 
To
16/03/2004 14:09:48
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00886412
Message ID:
00886962
Views:
11
Craig,

Ok I basically think you are asking for troubles on several fronts *g*

1) you should not use multiple timers, they really tend to collide with each other. You should consider using one timer and let it use a CASE statement to split out the calls. For example if you want Thing1 to happen every 5 seconds and Thing2 to happen every 30 seconds. Use one timer set to 5000 and call Thing1 every time and Thing2 every 6th time.

2) Can you give a better explanation of why this needs to be timer controlled?

3) This timer basically should be thought of as an interrupt handler. Interrupt handlers need to a) push the current state, b) alter the state to what they want to do and calculate their task and 3) restore the state.

What do your routes depend on? Is it a particular row in a table? If so perhaps you can use the PK for the row to drive your process and your interrupt handler looks like
lparameter pnKeyValue
local lnRecno, lcRetVal

lnRecNo = recno() && save state

seek pnKeyValue && alter state
lcRetVal = f() && calculate result

goto lnRecNo & restore state

return lcRetVal
Another possibility would be to use private datasession based forms or session objects where each of them has their own narrow view of the world ie the one row they are concerned with. Or perhaps a SCATTER NAME object could be used for each entity and achieve some of the same sort of functionality without the overhead of the data sessions.

How about giving us a couple of sentence big picture view of what you are doing? It'll help direct some solutions.

What's the difference between these various g_getrout* functions? I'm thinking you might be able to just make that a method of your entity that needs a route and you could get rid of the whole macro expansion.

If your entity is a robot that is trying to drive around a warehouse then that robot object could have a PK value that it uses to get/put it's data from/to the server and carry it's other data around in it's properties. You can use one timer and distribute calls out to a collection that holds all your robot objects. A good way to handle this is for the object to have a tNextTimeToExecute property and you set it to datetime() + 5. Then you can use code like:
if ( datetime() > this.tNextTimeToExecute )
   * do something ...
   this.tNextTimeToExecute = this.tNextTimeToExecute + this.nExecutionInterval
endif
>Sorry, the procedures that Im talking about are in my program. These procedures are called from a timer(s) on a form. Each timer calls a specific procedure like the one below. In this case, the procedure then calls a function based on which route information is passed. So, procedure l_Pgetrout3 could run a the same time as 2.
>
>
>PROCEDURE l_Pgetrout2
> PARAMETERS pc_cmdrout2,pc_rout2, pc_cartid2
> GC_GETROUT = 'g_getrout'+pc_cmdrout2+pc_rout2+[(pc_cmdrout2,pc_rout2,pc_cartid2)]
> =&gC_GETrout
> return ll_goodrout2
>
>ENDPROC
>
>This seems to work well for one route, but if I have several routes, that maybe running at that same time and accessing same file but different records/rows, will there be issues here? Also, it is highly unlikely that they will access the same row or record.
>
>Other then getting the record pointer, will there be some sort of issues in accessing my remote view SQL tables at the same time and updating them?
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform