Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Same named databases
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Same named databases
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01465100
Message ID:
01465100
Views:
117
All,

I have a situation with two same named databases

\data\samename.dbc
and
\data\archive\samename.dbc

An archiving routine moves deleted records from \data\sametable.dbf to \data\archive\sametable.dbf

This routine selects the deleted records from \data\sametable.dbc into a cursor, then scans the cursor, scattering to memvar, uses the \data\archive\sametable.dbf,
appends a blank and gathers the menvars.

Adding the blank fires a trigger for a stored procedure newid() from a table (also same named, of course) that holds the next pk for every table.

The problem appears to be that the stored procedure newid() in the \data\samename.dbc fires, and draws the new id.

What SHOULD happen is for the stored procedure newid() in \data\archive\samename.dbc fires to get a new id from \data\archive\keylist.dbc

There is no SET DATABASE TO samename anywhere. The stored procedure will fire in the SET DATABASE ??????.dbc

Of course, every so often a duplicate pk from \data\keylist hits in the \data\archive\sametable.dbc and blows out several other things.

There is a lot of code to change, and the error handling consists of a cascade of ON ERROR thiserror = .T. style code which is very convoluted.

Is there any way to handle a 'SET DATABASE TO samename' with something like an alias to be sure the correct stored procdure is being called?

TIA for ideas.

Al Allison
Reply
Map
View

Click here to load this message in the networking platform