Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- SIx Driver RDD v3.00 - Reference Guide - <b>varifield coding caveats:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  VariField Coding Caveats:

  SIx 3.0's "V" fields represent a completely new technology in efficient
  data storage.  With this new technology comes some new coding practices
  that should be followed for best results.


  For @...SAY...GET screens, use a SCATTER/GATHER routine, padding
  your SCATTER values:

  Instead of doing a GET directly into the field itself, you should use
  the SCATTER/GATHER technique of reading all field values into temporary
  field variables.  After the user finishes editing these temporary field
  variables in the GETs, the temp variables are stored back to the
  original database fields.

  When using this technique, make sure to PAD() your SCATTER values to the
  desired length when reading them from the database.  This will insure a
  consistent length for values within the same field throughout the database
  file.

    NOTE: See the VFDEMO.PRG sample program for an example of this.


  Beware of existing code that relies on fixed field lengths!:

  If you convert an existing application's data files to use weakly-typed
  "V" fields, make sure that none of your code depends on each field
  (for different records) to be the same length.  Remember, the whole purpose
  of "V" fields is to save space by storing the data more efficiently.  This
  cuts out all of the fluff at the end of a character entry.

  For example, if your database previously had a 50 byte CHARACTER field
  called CODE, and now the CODE field is a "V" field of 0 significant bytes.
  The following old code would no longer work as expected:

    // Process the CODE field (all 50 bytes of it) with Encode() UDF
    DO WHILE !eof()
      FOR x := 1 TO 50
        Encode( SubStr( CODE, x, 1 ))
      NEXT x
      SKIP
    ENDDO

  The code could no longer assume that the field was 50 characters
  long.  It would instead need to

    // Process the CODE field (however long it is) with Encode() UDF
    DO WHILE !eof()
      FOR x := 1 TO Len(CODE)
        Encode( SubStr( CODE, x, 1 ))
      NEXT x
      SKIP
    ENDDO



See Also: The OTTO Utility

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson