PostgresDAC

TPSQLDataset.Properties.Options

Previous Next

Specifies various behavioral properties of the TPSQLDataset and it's descendants.

Syntax:

TPSQLDatasetOption = (dsoByteaAsEscString, dsoOIDAsInt, dsoForceCreateFields, dsoTrimCharFields, 
		dsoUseGUIDField, dsoPopulateFieldsOrigin, dsoEmptyCharAsNull, dsoUDTAsMaxString, 
		dsoRefreshModifiedRecordOnly);
TPSQLDatasetOptions = set of TPSQLDatasetOption;
property Options: TPSQLDatasetOptions;

Description:

Set Options to include the desired properties for the TPSQLDataset behaviour. Options is a set drawn from the following values:

dsoByteaAsEscString

Indicates whether an BYTEA native Postgres field type will be treated as escaped sequence of characters (varchar) or like Delphi BLOB field. Include dsoByteaAsEscString option to enable BYTEA fields type casting to escaped string.

BYTEA octets are escaped in the output in such way. In general, each "non-printable" octet is converted into its equivalent three-digit octal value and preceded by one backslash. Most "printable" octets are represented by their standard representation in the client character set. The octet with decimal value 92 (backslash) has a special alternative output representation. See details in the table below.

Decimal Octet ValueDescriptionEscaped Output RepresentationExampleOutput Result
92backslash\\SELECT '\\134'::bytea;\\
0 to 31 and 127 to 255"non-printable" octets\xxx (octal value)SELECT '\\001'::bytea;\001
32 to 126"printable" octetsclient character set representationSELECT '\\176'::bytea;~

dsoOIDAsInt

Indicates whether an OID native Postgres field type will be treated as large integer field (TLargeInt) or as Delphi BLOB field. Include dsoOIDAsInt option to enable OID fields type casting to integer type.

Set OIDAsInt to True when you are using system tables, e.g. pg_class.
Since OID type is unsigned integer be carefull when mixing integer types in your application!
Since there is no standard TField descendant for unsigned integer in Delphi, the developer is responsible for correct type casting!

dsoForceCreateFields

Indicates whether a dataset's underlying field components are generated dynamically when the dataset is opened even if persistent field components are assigned to a dataset at design time using the Fields editor.

dsoTrimCharFields

Specifies whether to trim trailing spaces in character fields of the dataset.

dsoUseGUIDField

Specifies to use custom TPSQLGuidField from PostgresDAC sources instead of standard TGuidField.

dsoPopulateFieldsOrigin

Specifies to fill TField.Origin property to TPSQLQuery component

dsoManageLOFields

Specifies to use lo_unlink server function inside Post method whenever you delete or modify a value referencing a large object, only if large object is not referenced by any other value from this field.

dsoEmptyCharAsNull

Specifies to not distinguish NULL value from empty string value.

dsoUDTAsMaxString

Specifies to map user defined type as TStringField with maximum possible length of 8192 characters. If option not set, then field's length is set to the longest length of the field values.

Be carefull when dsoUDTAsMaxString is excluded from Options. You will not be capable to enter the string value longer then length of the longest field value already present in result set.

dsoRefreshModifiedRecordOnly

Specifies do not refresh result set after insert, update or delete operation. Only modified row is updated.

Using this option may cause result set is not up to date. Inserted records are added to the end of set ignoring server order. You may use local sorting functionality however, e.g. in TPSQLDataset.AfterPost event handler.