Link to home
Start Free TrialLog in
Avatar of manjucee
manjucee

asked on

System Trap

Hi,
   I am currently involved in the developing a Y2K tool .The one of important feature of this tool is it wont use any of the source code. It will use the data to give remedation and aging in runtime. So I would like to know whether we can trap a system calls like if(date1 > date2) or reading from a database in C. if yes please with example
ASKER CERTIFIED SOLUTION
Avatar of braveheart
braveheart

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Unfortunately, no.
You see, you can trap a system (API) call at runtime but "if(date1 > date2)" and similar are implemented using inline code and not function calls.  Reading a DB is too general.  How would you know what constitutes a DB read?  There are hundreds of DB systems, each with it's oun I/O routines.
Avatar of manjucee
manjucee

ASKER

Hi Braveheart
                     It would be better if you give more information .
Say you are using a DB routine called db_getdate(). You could write your own version of db_getdate() which would call the original routine but would adjust the year appropriately.

Assuming that the data in your database never refers to a date prior to 1960, say, then your version of db_getdate would add
100 to any year less than 60 but returns the original value if the year was greater than or equal to 60.

This approach assumes that you treat the year as an integer rather than a two character string internally. If you use the string approach then the only way you can do a conversion is if all date manipulations are performed by functions which you can over-ride in the same way as the above example. It's an aspect of object oriented programming ;-).

This technique puts off the evil day when you need to rewrite your application and the contents of your database for another 60 years.