Purpose
Defines a data server on a structured 2 dimensional array.
Class
bArrayServer
Properties
BoF | (Access) |
Children | (Access) |
Data | (Access) |
DBStruct | (Access / Assign) |
Deleted | (Access) |
DeletedScope | (Access / Assign) |
EoF | (Access) |
ErrInfo | (Access) |
Filter | (Access / Assign) |
LastRec | (Access) |
OrderBottomScope | (Access / Assign) |
OrderKeyNo | (Access / Assign) |
OrderKeyVal | (Access) |
OrderTopScope | (Access / Assign) |
ReadOnly | (Access / Assign) |
RecCount | (Access) |
RecNo | (Access / Assign) |
SuspendNotificationCount | (Access) |
Used | (Access) |
Methods
FieldSym()
Internal Methods
Inherits From
DataServer
Inherited By
<No descendants>
Description
With the class bArrayServer a 2 dimensional array can work like a database. The first dimension of the array represents the records and the second dimension the field values within a record.
auData[<Record>] [<Field>]
The count of the elements and their data types in the second dimension of the array must be equal.
The structure of the array is described by an array, similarly as by the class DBServer (see also bArrayServer:DBStruct). During create, an instance of the array must be passed as argument.
Arbitrary objects can be registered with the method DataServer:RegisterClient() as a client at the server. However, it is prerequisite for it, that the method Notify() is implemented in the object. This method is invoked automatically by the server at every change in the server (record movement, field change etc.) and informs the client about the change.
Before a registered client is destroyed, it must be unregistered from the server with the method DataServer:UnregisterClient().
Samples
The following sample creates an instance of the class bArrayServer with the four fields ID, LASTNAME, FIRSTNAME and AGE and implements some operations.
// define structure array
auStruct := {;
{"ID", "C", 5, 0},;
{"LASTNAME", "C", 20, 0},;
{"FIRSTNAME", "C", 15, 0},;
{"AGE", "N", 3, 0};
}
// define data array
auData := {;
{"00001", "Richards", "Denise", 24},;
{"00007", "Bond", "James", 37};
}
// create bArrayServer
oasServer := bArrayServer{auStruct, auData}
// append record and fill it with data
IF oasServer:Append()
oasServer:FieldPut(#ID, "00002")
oasServer:FieldPut(#LASTNAME, "Bear")
oasServer:FieldPut(#FIRSTNAME, "Pooh")
oasServer:FieldPut(#AGE, 4)
ENDIF
// delete all records
oasServer:GoTop()
DO WHILE !oasServer:EOF
oasServer:Delete()
oasServer:Skip(1)
ENDDO
See Also
Page url: http://www.YOURSERVER.com/index.html?barrayserver.htm