Here is a simple technique for changing 2 structures into a list of change 
instructions.

 

Let’s just say that your original structure is table A and the new structure is 
table B.

 

Add a field to table A called status and initialize it to D for all records. 
(D- delete)

 

Loop through table B and lookup each field in table A.

 

1)      If it is found then test whether it is the same as the record looked up.

2)          if it is then change the status to ‘U’ (U- unchanged)

3)          if not then change status to ‘C’ (C- change)

4)      If not found then change status to I (I- insert)

 

You can change the structure now by using the status field you have created.

 

D- delete the row

C- change means copy the new field

I- Insert means add the new field

U- leave it alone

 

You can make a copy structure by adding making a table, one row for each field 
from the new structure.

    Name, offset, offset2

 

Add the offset of this variable in the record from table B (number of bytes 
from the start of the record)

Lookup that field in table A and add the offset of that variable in the record 
(offset2)

 

Loop through the data and move the data from the old record buffer (offset2) to 
the new record buffer (offset) based on their offset.

 

David

 

From: David Clark [mailto:[email protected]] 
Sent: September-16-13 8:05 AM
To: AGI
Subject: RE: [agi] Module re-definitions

 

Wouldn’t that depend on how the table is referred to?

 

For instance, if a table is referred to by name rather than a memory location 
then creating a new version and copying all that stays the same works fine.

 

I created just such code and it worked for more than 30,000 customers.

 

I currently am creating exactly this kind of code. Even in memory, I make no 
references that are just a pointer for exactly the reason you suggest. The 
references I create can change physical location in memory without breaking any 
code.

 

David

 

From: Russell Wallace [mailto:[email protected]] 
Sent: September-11-13 8:12 PM
To: AGI
Subject: Re: [agi] Module re-definitions

 

If ( exists(table(A))) then drop table A ;

Create table A as blah blah blah...

 

ee? no! that would break everything that refers to table A. modify it in place 
instead. 




-------------------------------------------
AGI
Archives: https://www.listbox.com/member/archive/303/=now
RSS Feed: https://www.listbox.com/member/archive/rss/303/21088071-f452e424
Modify Your Subscription: 
https://www.listbox.com/member/?member_id=21088071&id_secret=21088071-58d57657
Powered by Listbox: http://www.listbox.com

Reply via email to