docs

Home Getting Started Browse by Category Class Methods Low-Level API

Store Structured Clarion Data in One Field

A strong ProTOML use case is storing several related structures in one field that already belongs to a record.

For example, one document can contain application settings, a current customer snapshot, and a variable-length contact QUEUE.

Build the document

Toml.StartDocument()
Toml.WriteGroup('settings',AppSettings)
Toml.WriteRecord('customer',CustomerFile:Record)
Toml.WriteQueue('contacts',ContactQueue)

Store it in a MEMO

IF Toml.SaveMemo(SettingsFile,STO:TomlMemoIndex) = ProTOML:OK
  PUT(SettingsFile)
END

Or store it in a BLOB

IF Toml.SaveBlob(SettingsFile,STO:TomlBlobIndex) = ProTOML:OK
  PUT(SettingsFile)
END

Restore it later

STO:RecordId = 1
GET(SettingsFile,STO:StorageKey)

Toml.LoadMemo(SettingsFile,STO:TomlMemoIndex)
Toml.ReadGroup('settings',AppSettings)
Toml.ReadRecord('customer',CustomerFile:Record)
Toml.ReadQueue('contacts',ContactQueue)

This gives you a simple way to keep related settings, record data, and repeating QUEUE data together in one field.

The BLOB method stores the exact TOML document bytes. That storage encoding does not add application-wide Unicode support to ordinary Clarion controls, strings, or database drivers.

Home Getting Started Browse by Category Class Methods Low-Level API