MakeRecord |
Databases | |
Aptilis 1 |
MakeRecord(Field1, Field2, Field3....)
MakeRecord allows you to create an individual database record,
and by storing several records sequentially in an array, you
can build up a database.
You need to use MakeRecord to create records in order to have them
in the Aptilis specific fashion, so that you can use
saveDatabase,
getField and
getAllFields.
Those functions implement and use the internal Aptilis
database format which speeds up field extraction.
Although they are printable as strings, database records
are not directly usable. The way they are stored internally will
vary from platform to platform, and you cannot safely
make assumptions about the way a record is stored. (For
example, integers may vary in size, as well as the way bits are
organized within them)
Return value:
A string where the record is stored in a special format.
Example:
// fields can be made up of strings db[0] = makeRecord("Orange", "Orange", "Sweet, acid") $ db[1] = makeRecord("Banana", "Yellow", "Sweet") $ db[2] = makeRecord("Strawberry", "Red", "Sweet, subtle") $ // They can be made up of a mix of local and global variables f1 = "Mango" $ _f2 = "Orange" $ f[2] = "Bitter" $ db[3] = makeRecord(f1$, _f2$, f[2]$) $ // They can also be made from an array... fields[0] = "Lemon" $ fields[1] = "Yellow" $ fields[2] = "Acid" $ db[4] = makeRecord(fields[]) $ // or any combination of different type of values. _nf[0] = "green" $ _nf[1] = "sweet, acid" $ db[5] = makeRecord("kiwi", _nf[]) $ //Finally, we save the file... saveDatabase("c:\\aptilis\\db3.txt", db[])The file db3.txt now contains:
"Orange","Orange","Sweet, acid" "Banana","Yellow","Sweet" "Strawberry","Red","Sweet, subtle" "Mango","Orange","Bitter" "Lemon","Yellow","Acid" "kiwi","green","sweet, acid" |