[comp.misc] variable length text

siva@bally.Bally.COM (Siva Chelliah) (06/28/91)

Hi,
   How would you implement variable length text in database applications ?
What comes to my mind is the following :
 A memo file (call it memo.txt) will have the following structure:

  ---------------------------------------------------------------------
 |#of bytes| .. bytes .. | link | # of bytes | .. bytes .. | link | ...
 ----------------------------------------------------------------------
|_______________________________|
        one record 

if link == -1 then no more text.

The data file will have the following structure :

  struct {
      field1;
	   field2;
      ...
      fieldn;
	   long memo;      /* offset into the memo file which will have 
                         the text */
  } something;

Just wondering if there is any better way. Problem with this method is 
that if you delete and add text , the disk space will be wasted.  

Thanks

Siva
-- 
/=*=*=*=*=*=*=*=*=*=*=*=*=*=*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\
| Siva@bally.bally.com     | He who asks is a fool for five minuites,|
| Bally Systems,           | but he who does not ask remains a fool  |
| Reno,  NV 89502          | forever      -Old Chinese saying        |