DATASET


 

The DATASET object is implemented as a key-value store that is a simple NoSQL in memory database. The data is stored in memory as a linked list of data items where each item requires a unique 'key'. The 'value' data for each item can be plain text, JSON, XML, binary data, HTML, etc... The DATASET object has properties and methods that allow a PL/B program to maintain and manage program data items as needed for the application. The declaration syntax of a DATASET is as follows:

 

(1)

[label]

DATASET

[%|^][(arraysize)]

(2)

[label]

DATASET

^,{target}

(3)

[label]

DATASET

^(arraysize),({target}),...,({target})

 

Where:

label

Optional. A Data Label.

%

Optional. Denotes the item as being GLOBAL.

arraysize

Required. An integer decimal constant, CONST variable, or EQUATEd value indicating the number of array items.

^

Optional. Denotes the item as being a POINTER.

target

Required. The name of a previously defined data item of the same type.

Flags Affected: NONE

 

Properties:

 

Properties are attributes of an object that define the object's characteristics or its behavior.

 

COUNT

Get the current number of data items.

DATAFILTER

Filter string.

DATATYPE

A type assigned to the items.

MAXITEMS

The maximum item count for the number of active items that can be added.

NULLSIZE

The text size to be used when an item is added with NULL input.

OBJECTID

The identification number associated with an object.

RUNNAME

The run-time name of the object.

USERDATA

Application specific data.

 

Methods:

 

Methods are encapsulated routines that act upon an object.

 

AddItem

Adds a data item.

DeleteAllItems

Deletes and frees memory for all data items.

DeleteItem

Finds and deletes a data item.

FindItem

Finds a data item using a key or index

GetItem

Finds a data item using a key or index and retrieves the associated data string.

Pop

Retrieves data items from a stack.

Push

Places data items onto a stack.

UpdateItem

Finds a data item using a key or index and updates the data for the data item.

Note the following:

  1. The DATASET is supported in CREATE, GETPROP, and SETPROP instructions.

  2. If the DATASET object is not created when a method is executed, it is implicitly created by the method. When the DATASET object is implicitly created, all of the properties for the object are set to their default states.

 

See Also: Object Definitions, Object I/O Instructions, Method Syntax

 



PL/B Language Reference