Question
· 22 hr ago

Impact of SQL-Mapped Class Indexes on Legacy Programs with Direct Global Access

Hello,

I am currently maintaining a legacy application that was developed in ObjectScript and accesses data by working directly with globals.
For a new program, however, I plan to access the same global data through SQL-mapped classes.

I have two questions regarding this approach:

  1. If I define indexes in the SQL-mapped class, what potential impact (if any) could this have on the existing legacy application that directly accesses the globals?
  2. I’ve read that when an index is defined in an SQL class, it will not be automatically updated if data is modified directly in the global (outside of SQL operations). Is this correct?
    • If so, what are the common or recommended solutions to ensure index consistency in such cases?

Thank you for your guidance.

Product version: Caché 2018.1
Discussion (1)3
Log in or sign up to continue

Answers to your questions

1. Think of the classes that describe the globals as being a meta data layer to the globals.  The existing application will continue to run and you will now have classes that expose the data so that you can write Object and SQL code.  If you create new indices in the SQL mapped classes the global representing the new indices would only be updated if something calls the Object.%Save/Delete or SQL Insert/Update/Delete or the legacy filers are updated to manage the new indices.  The legacy application might be unlikely to do this so it would mean your new indices will never be populated which would be bad as the SQL engine would not "know" this and would attempt to read data from the new index and there would be no data.

2. You are correct... if you add new indices to the class and the legacy application is not maintaining the index then it would cause issues.

Hopefully you have a common filer for the legacy application, meaning you have one common filer to save a subject area(global).  If this is the case then it's a matter of updating the common filer.  If the legacy application has a number of places where the data is updated then all of those places would need to be updated or consider adopting an approach of a common filer.

On projects I have been involved in where we have created classes to map the existing globals to enable Object and SQL access we have added to the class

Parameter READONLY=1 

so as to ensure no one could accidentially perform an Object Save/Delete or SQL Insert/Update/Delete operation.