Obtaining an Editable Result Set

From RAD Studio
Jump to: navigation, search

Go Up to Using BDE-enabled datasets Index

Note: The Borland Database Engine (BDE) has been deprecated, so it will not be enhanced. For instance, BDE will never have Unicode support. You should not undertake new development with BDE. Consider migrating your existing database applications from BDE to dbExpress.

To request a result set that users can edit in data-aware controls, set a query component's RequestLive property to True. Setting RequestLive to True does not guarantee a live result set, but the BDE attempts to honor the request whenever possible. There are some restrictions on live result set requests, depending on whether the query uses the local SQL parser or a server's SQL parser.

Queries where table names are preceded by a BDE database alias (as in heterogeneous queries) and queries executed against Paradox or dBASE are parsed by the BDE using Local SQL. When queries use the local SQL parser, the BDE offers expanded support for updatable, live result sets in both single table and multi-table queries. When using Local SQL, a live result set for a query against a single table or view is returned if the query does not contain any of the following:

  • DISTINCT in the SELECT clause.
  • Joins (inner, outer, or UNION).
  • Aggregate functions with or without GROUP BY or HAVING clauses.
  • Base tables or views that are not updatable.
  • Subqueries.
  • ORDER BY clauses not based on an index.

Queries against a remote database server are parsed by the server. If the RequestLive property is set to True, the SQL statement must abide by Local SQL standards in addition to any server-imposed restrictions because the BDE needs to use it for conveying data changes to the table. A live result set for a query against a single table or view is returned if the query does not contain any of the following:

  • A DISTINCT clause in the SELECT statement.
  • Aggregate functions, with or without GROUP BY or HAVING clauses.
  • References to more than one base table or updatable views (joins).
  • Subqueries that reference the table in the FROM clause or other tables.

If an application requests and receives a live result set, the CanModify property of the query component is set to .True.. Even if the query returns a live result set, you may not be able to update the result set directly if it contains linked fields or you switch indexes before attempting an update. If these conditions exist, you should treat the result set as a read-only result set, and update it accordingly.

If an application requests a live result set, but the SELECT statement syntax does not allow it, the BDE returns either:

  • A read-only result set for queries made against Paradox or dBASE.
  • An error code for SQL queries made against a remote server.

See Also