EPUB | CHM | PDF

TPSQLDataset.Properties.Options

Top Previous Next

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

Syntax:

TPSQLDatasetOption = (dsoByteaAsEscString, dsoOIDAsInt, dsoForceCreateFields, dsoTrimCharFields,
  dsoUseGUIDField, dsoPopulateFieldsOrigin, dsoEmptyCharAsNull, dsoUDTAsMaxString,
  dsoRefreshModifiedRecordOnly, dsoManageLOFields, dsoFetchOnDemand);
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:

dsoFetchOnDemand

Indicates whether to use asynchronous communicating with server.  The default TPSQLQuery's mode is suitable for submitting commands and getting result sets in normal, synchronous applications. However, there are few drawbacks, that may be of importance to developers:

 

      • TPSQLQuery.Open waits for the command to be completed. The application might have other work to do (such as maintaining a user interface), in which case it won’t be a good decision to block while waiting for a response.
      • Since the execution of the client application is suspended while it waits for the result, it is hard for the application to decide that it would like to try to cancel the ongoing command.
      • TPSQLQuery in default mode always collects a command's entire result, buffering it in a single place. While this behavior simplifies some internal logic, it can be impractical for results containing many rows.

 

To avoid such limitations developers now can use the brand new Fetch-On-Demand mode, which is turned on by dsoFetchOnDemand option in the TPSQLQuery.Options set. There are limitations of course:

      • To get advantages of the Fetch-On-Demand mode one should use read-only TPSQLQuery objects. This restriction will be removed with time probably.
      • Each read-only TPSQLQuery component must have its own TPSQLDatabase component since Fetch-On-Demand command flow will block a connection until getting the last row of the result set.

 

Applicable only to read-only TPSQLQuery for now!

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 Value

Description

Escaped Output Representation

Example

Output Result

92

backslash

\\

SELECT '\\134'::bytea;

\\

0 to 31 and 127 to 255

"non-printable" octets

\xxx (octal value)

SELECT '\\001'::bytea;

\001

32 to 126

"printable" octets

client character set representation

SELECT '\\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 careful 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 careful 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.