DataStore Library: 2 Creating a DataStore

Up: GEOS SDK TechDocs| Up | Down | Prev: 1 Introduction | Next: 3 Deleting a DataStore
DataStoreCreate()

To create a new datastore, specify its attributes in a DataStoreCreateParams structure and call DataStoreCreate() .

typedef struct {
	TCHAR	*DSCP_name;
	DataStoreFlags	DSCP_flags;
	FieldDescriptor	*DSCP_keyList;
	word 	DSCP_keyCount;
	optr	DSCP_notifObject;
	DataStoreOpenFlags	DSCP_openFlags;
} DataStoreCreateParams;
DSCP _name
Name of the datastore. Used when opening, deleting or renaming a datastore. Any legal filename is acceptable.
DSCP _flags
Only the following flags may be passed:
DSCP _keyList
Pointer to an array of fields that make up the key. The term "key field" is not used in the relational database sense. In a datastore, the key field does not uniquely identify a record; it simply determines storage order of the records if no callback is passed in DataStoreSaveRecord() (see "Adding Records," Adding Records for a complete discussion of storage order).
	typedef struct {
		FieldData		FD_data;
		TCHAR		*FD_name;
	} FieldDescriptor;
	typedef struct {
		FieldType			FD_type;
		FieldCategory			FD_category;
		FieldFlags			CFD_flags;
	} FieldData;
Fields of FieldType DSFT_TIMESTAMP and DSFT_BINARY may not be part of the key and the only FieldFlag which may be passed is FF_DESCENDING (default sort order is ascending).
Once you create a datastore, you cannot redefine the key later (by adding, deleting or changing the key field(s)) nor can you add a key to a datastore that was created without one.
DSCP _keyCount
Number of fields that make up the primary key.If you pass zero, then you must pass DSF_NO_PRIMARY_KEY in DSCP_flags .
DSCP _notifyObject
Object to be notified when changes to the datastore occur. This object will receive MSG_META_NOTIFY_WITH_DATA_BLOCK which will pass a DataStoreChangeNotification structure. See the GCN chapter.

Passing NullOptr means no object will receive notification.
DSCP _openFlags
Passing zero allows multiple applications to open the datastore simultaneously. Passing DSOF_EXCLUSIVE gives exclusive access to the calling application.

Up: GEOS SDK TechDocs| Up | Down | Prev: 1 Introduction | Next: 3 Deleting a DataStore