ABL Application considerations
- Last Updated: July 22, 2014
- 3 minute read
- OpenEdge
- Version 13.0
- Documentation
Generally speaking, there are no requirements to change existing ABL applications when migrating to a table partitioned database. However, consider several issues when running an existing ABL application on a partitioned table:
-
The order in which records are returned may differ for a newly partitioned table.
A partitioned table must have at least one local index, which is based on the partition fields. When partitioning a table, you can make existing indexes local if they are aligned with the partition fields, but you may need or want to add a new index to satisfy the requirement for a local index. Anytime a new index is added to a table and you recompile, the new index may be used by queries that previously used a different index, and as a result, it is possible that the records will be returned in a different order than they were before.
-
Partition fields must be set before record creation.
By the time a physical record is created in the database, all of the partition fields must be set. A field is "set" either because the code explicitly assigns it a value or because the field has an initial value. The actual record creation does not happen on the
CREATEstatement. The creation often happens in the following cases:- The AVM is about to release the buffer, which can happen as a result of any
of the following:
- An explicit
RELEASEorVALIDATEstatement - The reading of a new record into the buffer
- The record going out of scope
- The end of the transaction
- An explicit
- You set a LOB field.
- You set a field that an index is based on.
The timing of the record creation is important in the case that the partition fields do not have initial values. If, for example, the AVM executes a
CREATEstatement and then immediately sets a field that an index is based on, an error occurs. This is because setting the field causes the underlying record creation to take effect, and at that point none of the partition fields have been set. An error also occurs at the end of aDO TRANSACTIONblock if there is aCREATEstatement inside the block but not all of the partition fields are set. - The AVM is about to release the buffer, which can happen as a result of any
of the following:
-
ROWIDvalues may change as a result of changes to a partition field.In the past, an update to a record would never cause the
ROWIDof the record to change. Now, if the value of a partition field changes such that a record now belongs in a different partition, the record'sROWIDwill change because theROWIDidentifies the location and partition of the record. If you store aROWIDvalue for some reason, the storedROWIDmay need to be updated in this scenario. -
ROWIDvalues encapsulate partition information, butRECIDvalues do not.You cannot use a
RECIDvalue to identify the partition of a record in a partitioned table. Using a storedRECIDvalue to retrieve a record in a partitioned table will not work unless the record is in the initial composite partition. However, theROWIDof a record in a partitioned table identifies the location and partition of the record. Applications that need to store and reuse record locations in partitioned tables should useROWIDinstead ofRECID.When changing
RECIDfunctions or attributes toROWIDin your application, you should keep the following differences in mind:- A
RECIDvalue is an integer, whereas aROWIDvalue is a variable-length set of bytes. - You can display a
RECIDdirectly to the screen or store it directly to a file, but you cannot do so with aROWID. You must first convert theROWIDvalue to a string (using theSTRINGfunction, for example). - Because
RECIDvalues are integers, you can compare them using greater than (with theGTor>operator) or less than (with theLTor<operator), but you cannot do the same withROWIDvalues. You can, however, checkROWIDvalues for equality.
- A
- To retrieve partition information, a new function,
BUFFER-PARTITION-ID, has been added. Two new attributes,BUFFER-PARTITION-IDandIS-PARTITIONED, have been added to the buffer object handle.