Try OpenEdge Now
skip to main content
ABL Reference
Handle Attributes and Methods Reference : BUFFER-COMPARE( ) method
 

BUFFER-COMPARE( ) method

This method does a rough compare of any common fields, determined by name, data type, and extent-matching, between the source buffer and the target buffer. The resulting logical value is either TRUE or FALSE as a whole. A single field that does not compare causes the entire buffer to return FALSE. If there are fields in one buffer that do not exist in the other, they are ignored.
Return type: LOGICAL
Applies to: Buffer object handle

Syntax

BUFFER-COMPARE ( source-buffer-handle[ , mode-exp [ , except-list
  [ , pairs-list[ , no-lobs ]]]] )
source-buffer-handle
An expression that evaluates to a buffer handle.
mode-exp
If mode-exp is given, it must evaluate to either "binary" or "case-sensitive" to provide that type of comparison.BUFFER-COMPARE( ) method supports binary and case-sensitive comparisons between CLOB as well as CHARACTER fields.
except-list
A character expression that evaluates to a comma-separated list of field names to be excluded from the compare.
pairs-list
A character expression that evaluates to a comma-delimited list of field-name pairs to be compared.
You can specify an array element as one or both of the fields. This lets you compare a field or array element in one buffer to a field or array element in the other buffer, when the two fields do not have the same name. The order within each field-name pair does not matter; each pair must contain one field name from the source and one field name from the target.
You can also compare one entire array to another by specifying its name without a subscript.
no-lobs
A logical expression indicating whether to ignore BLOB and CLOB fields in the compare. If TRUE, BLOB and CLOB fields are ignored during the compare. If FALSE, BLOB and CLOB fields are compared along with the other fields. The default value is FALSE (that is, BLOB and CLOB fields are included in the compare).
Note: You cannot use the BUFFER-COMPARE( ) method to compare records that contain CLOB fields, unless one or both of the corresponding fields contain the Unknown value (?); the AVM generates a run-time error. However, you can convert CLOB fields to LONGCHAR values and use the EQ, GE, GT, LE, LT, and NE comparison operators, or the COMPARE function, to compare the LONGCHAR values.
If you want to compare BLOB fields only, you can set this option to FALSE and use the except-list option to exclude CLOB fields from the compare.
Caution: When using this option, you get no warning if a LOB field has changed. This can lead to inappropriate results. Therefore, before using this option, you must understand the nature of your data and be sure that logic using this option will not result in inconsistent or out-of-date data in the database.
When comparing buffers in a ProDataSet object, the AVM checks as to whether the BUFFER-COMPARE( ) method satisfies the following two requirements:
*The compare is between a buffer on a data-source object table and the corresponding ProDataSet temp-table buffer. This means the operation can use any buffer for the data source database table, but only the default buffer for the ProDataSet temp-table.
*There are no except-list or pairs-list arguments for the BUFFER-COMPARE( ) method.
If these two requirements are satisfied, the BUFFER-COMPARE( ) method identifies the fields to compare based on the pairs-list argument specified in the ATTACH-DATA-SOURCE( ) method for the data-source object, if any, along with either the except-list or include-list arguments, if any. Because the ATTACH-DATA-SOURCE( ) method already allows you to define a field mapping between a data-source object buffer and a ProDataSet temp-table buffer, as well as a list of fields to include or exclude from the operation, you do not need to specify these in the BUFFER-COMPARE( ) method.
When comparing records that contain BLOB fields, the AVM performs a binary comparison on the BLOB data associated with the source and target records.
Use the no-lobs option with the BUFFER-COMPARE( ) method to ignore large object data when comparing records that contain BLOB or CLOB fields. You can also use the except-list option to exclude BLOB and CLOB fields from the compare.
The following example fragment performs a binary compare of all fields in the buffers, except for the two specified fields:
BUFFER-COMPARE(bh2, "binary", "cust-sales-rep,SalesRep").