Databases - Delphi/Firebird - SQL

Various notes on using SQL that are specific to Delphi and Firebird.

Why parameters are good | SQL query components | Example Code for IBQuery | Example Code for IBDataSet
Examples of different types of SQL statements

Why parameters are good

With all queries, Delphi automatically "prepares" them before sending them to the Firebird server.


SQL query components

Delphi 5 provides the following SQL query components on the Interbase tab. There is no real guidance on which component to use ... or why.

Example Code for IBQuery

My datamodules contain a basic IBQuery component that I use for quick queries. This is the code used to execute queries.

Example Code for IBDataSet

The Delphi 5 documentation for IBDataSet is less than poor. This example is based on several hours of trial and error.

For test purposes, I have a form with 2 Memo fields and 2 buttons. In general

Apparently, simply toggling active causes the select query to be executed again.

Examples of different types of SQL statements

For many queries, I place the final semicolon (;) on a separate line. In Delphi, it is never required - it is required as a command delimiter in ISQL and SQL file parsers.

Author: Robert Clemenzi -
URL: http:// / user / clemenzi / technical / Databases / Delphi / Firebird / SQL.html