How to delete a record: flyers and junk


? select remove_record(-214)
4

This function takes care of cleaning the base (more precisely the symbol table) from occurences of the deleted record, replacing them by 0. It only accepts valid record ids (identification numbers) and returns the number of nodes deleted (not the number of nodes modified).

Flyers and junks

The record contains symbols that describe properties of the thing the record is about. But, as neither symbols, nor records do contain positive data, the various cleaning actions we can execute without corrupting the base – like removing a record – generate two types of remains: flyers and junk. Flyers are valid symbols not contained anymore by any record. Junks are data entries not contained anymore in any symbol.

Recycling

As each Unidatab entry has a field for the modification date and another for the user id, the way we remove records and symbols yields a kind of lacunary interaction history that can help some higher level applications. The administrator of the database has the ability to purge it, removing flyers or junks or both. Though very high on a 64bits machine, the amount of available identification numbers (ids) must keep matching the real amount of nodes (negative numbers) and data entries (positive numbers). Thus the deletion functions handle a precise recycling of the unused ids. A table called ‘stock’ collects deleted ids and makes them available again at node creation.

? select * from flyers
 i    typ    a    pro    n    d    t    u        :
-218    undefined type    73    another property    72    0    1479498961    admin    
-216    unidatab objects    70    A shorter property    71    0    1479498961    admin    
-206        -116        -195    0    1479497934    admin    
-205    symbol    61        0    1    1479316224    admin    
-117    #Unid data structures    36        0    1    1479316216    admin    
-97        3        0    1    1479316216    admin    
-5    #Unid table    5        0    1    1479316214    admin    
-1    unid    1    unid    1    1    1479316205    -1        
? select remove_flyer(-218)
 1    
? select count(*) from flyers
 7   
? select * from junks
 i jnk t u :
72 another property 1479498961 admin 
73 undefined type 1479498961 admin 
? select count(*) from junks
 2    
? select remove_junk(72)
 1    
? select recycle_flyers(1); -- recycling flyers creates junks:
 6  
? select count(*) from junks 
 3          
? select recycle_junks(1) 
 3    

[2018 edit]

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s