Try OpenEdge Now
skip to main content
Programming Interfaces
Data Management : ABL API for Multi-tenant and Table Partition Management : Maintaining multi-tenant and table partition entities : Schema (reading, loading, and updating)
 
Schema (reading, loading, and updating)
The GetSchema( ) method reads the current schema from the database, returning it as an ISchema object. It has no key parameter because the API supports only the PUB-owned schema. (For more information on schema ownership, see OpenEdge Data Management: Database Administration.) Therefore, the returned ISchema object has collections of PUB-owned tables and sequences. This method is primarily supported for use by OpenEdge database tools. In your application code, you typically do not need to use this method because you can directly access all ITable and ISequence collections loaded from the database using the corresponding Get*( ) and Update*( ) service methods.
The GetSchemaChanges( ) method returns an ISchema object containing data definitions loaded from a specified .df file. You can then set load options using the LoadOptions property on ISchema and pass the ISchema object to the UpdateSchemaChanges( ) method to load the new or modified data definitions into the database. After loading the schema you can then access the schema partition collection using the Partitions property on ISchema to allocate or check the allocation status of the loaded schema partitions.
The following code shows how to use the API service to read schema definitions from a .df file and load them into the database using the resulting ISchema object:
define variable definitions as ISchema no-undo.

definitions = service:GetSchemaChanges("myschema.df").
definitions:LoadOptions:ForceIndexDeactivation = true.
service:UpdateSchemaChanges(definitions).
/* Allocate new partitions */
. . .
service:UpdateSchema(definitions).
The service can only work on one instance of an ISchema retrieved with GetSchemaChanges( ) until the instance has been loaded with UpdateSchemaChanges( ), which also creates new partitions for the loaded schema. An optional call to UpdateSchema( ) loads any updates that you make to these partitions. The service also has a CancelSchemaChanges( ) method that cancels the current schema changes and allows a new call to GetSchemaChanges( ).
The service also has a logical LoadSchemaChanges( ) method that loads data definitions directly into the database from the data definitions (.df) file specified in its character parameter.
For more information on the LoadOptions and Partitions properties, see IPartitionOwnerinterface and IPartitionCollectioninterface.