TpfgPalmLocalTable
The TpfgPalmLocalTable table is now deprecated. When I originally designed the library, I
designed a common ancestor class, TpfgPalmTable, with the view to create a generic base
for a variety of table types.
However, it has been pointed out that this doesn't work very well, since the
TpfgPalmLocalTable is chained to a BDE TTable component.
Per-Eric Larsson developed a synchronisation component which uses a
TpfgPalmRemoteTable at one end, and a TDataSet at the other. This should provide a more
flexible synchronization setup, making the local table component superflous.
|
The TpfgPalmLocalTable component allows access to tables located on the
the computer in a similar manner to that of the Palm. It takes care of
checking whether the table has certain "system" fields (such as for
storing the category of the record), and providing the data through
the relevant properties. It also simplies the process of doing batch
moves, since both descend from the common TpfgPalmTable component
Properties
Options: TpfgPalmLocalTableOptions
TpfgPalmLocalTableOptions = set of (opUseRecordID, opUseFlags, opUseCategory);
opUseRecorID | When creating a new table, insert a "RecorID" field |
opUseFlags | When creating a new table, insert a "Flags" field |
opUseCategory | When creating a new table, insert a "Category" field |
TpfgPalmTable
The TpfgPalmTable class is the base class for the Palm related table components.
It contains all the basic functionality, and is used by all the sub-object
properties as a common interface point. The individual descendant classes
thus simply override the appropriate methods in this class to define table
functionality, rather than needing to have descendant classes of the subclasses.
Properties
FieldDefs: TpfgPalmFieldDefs
Contains a list of the field definitions of the table. Whilst PC based tables can read
their field list from a table itself, for accessing tables on the Palm, you are expected
to specify a set of field definitions to map the record structure of the table.
Fields: TpfgPalmFields
Contains the data for the fields of the current record when the table is active. It is
slightly different from standard TFieldDefs in that field definitions cannot be set here -
the FieldDefs property must be used. There are also extra properties for the record
properties.
ReadOnly: Boolean
Specifies whether the table should be opened in readonly mode or not
TableName: string
Specifies the name of the table to be used when creating a new table
FieldCount: Integer [rt]
Specifies the number of fields in the table
Active: Boolean [rt]
Specifies whether the table is currently open
BOF: Boolean [rt]
Returns true if you are at the beginning of the table
EOF: Boolean [rt]
Returns true if you are at the end of the table
Methods
procedure Open;;
Opens the table for access. Equivalent to setting the Active property
to true.
procedure Close;
Closes the table. Equivalent to setting the Active property to false.
function FindField(FieldName: string): TpfgPalmField;
Searches for the specified field. Returns the field, or NULL if a
field with a matching name could not be found
function FieldByName(FieldName: string): TpfgPalmField;
Similar to FindField, except that an exception is generated if the
field cannot be found
procedure EmptyTable;
Empties the specified table
procedure CreateTable;
Creates the specified table. For Palm tables, remember to have filled
in the TableName, CreatorID, and TableType fields [and optionally
the Version field] before creating the table
procedure DeleteTable;
Deletes the specified table
procedure First;
Moves to the first record. Valid only when the table is open
procedure Last;
Moves to the end of the table. Valid only when the table is open
procedure Next;
Moves to the next record. Valid only when the table is open
procedure Prior;
Moves to the previous record. Valid only when the table is open
procedure Edit;
Puts the table into edit mode, where the fields of the current
record can be changed.
procedure Append;
Puts the table into append mode, where a new record will be saved
at the end of the table.
procedure Insert;
Conceptually, this method would insert a new record at the current
table position. Note that currently the the Palm CDK does not support
inserting records at arbitrary positions. This method currently only
maps to the Append method
procedure Post;
Posts the currently editted record into the database, either at the
end of the table, or replacing an existing record (depending on
whether Edit or Append was previously used
Events
OnBeforeClose: TNotifyEvent
Generated before the table is closed
OnAfterClose: TNotifyEvent
Generated after the table is closed
OnBeforeOpen: TNotifyEvent
Generated before the table is opened
OnAfterOpen: TNotifyEvent
Generated after the table is opened
OnBeforeRecChange: TNotifyEvent
Generated before the current record changes
OnAfterRecChange: TNotifyEvent
Generated after the current record changes
OnBeforeEdit: TNotifyEvent
Generated before edit mode is enetered
OnAfterEdit: TNotifyEvent
Generated after edit mode is enetered
OnBeforeInsert: TNotifyEvent
Generated before insert mode is enetered
OnAfterInsert: TNotifyEvent
Generated after insert mode is enetered
OnBeforePost: TNotifyEvent
Generated before a Post is performed
OnAfterPost: TNotifyEvent
Generated after a Post is performed
OnBeforeCancel: TNotifyEvent
Generated before a Cancel is performed
OnAfterCancel: TNotifyEvent
Generated after a Cancel is performed
|