IBX components

The following components are located on the InterBase tab of the component palette.

TIBQuery

TIBStoredProc

TIBDatabase

. Jj TIBTransaction

TIBDataSet

TIBSQL

TIBDatabaseInfo

IBSQLMonitor

TIBEvents

3"

TIBExtract

TIBClientDataSet

Though they are similar to BDE components in name, the IBX components are somewhat different. For each component with a BDE counterpart, the sections below give a discussion of these differences.

TIBQuery

TIBSQL

IBSQLMonitor

TIBEvents

There is no simple migration from BDE to IBX applications. Generally, you must replace BDE components with the comparable IBX components, and then recompile your applications. However, the speed you gain, along with the access you get to the powerful InterBase features make migration well worth your time.

IBDatabase

Use a IBDatabase component to establish connections to databases, which can involve one or more concurrent transactions. Unlike BDE, IBX has a separate transaction component, which allows you to separate transactions and database connections.

To set up a database connection:

  1. Drop an IBDatabase component onto a form or data module.
  2. Fill out the DatabaseName property. For a local connection, this is the drive, path, and filename of the database file. Set the Connected property to true.
  3. Enter a valid username and password and click OK to establish the database connection.

Warning: Tip: You can store the username and password in the IBDatabase component's Params property by setting the LoginPrompt property to false after logging in. For example, after logging in as the system administrator and setting the LoginPrompt property to false, you may see the following when editing the Params property:

user name=sysdba password=masterkey

IBTransaction

Unlike the Borland Database Engine, IBX controls transactions with a separate component, TIBTransaction. This powerful feature allows you to separate transactions and database connections, so you can take advantage of the InterBase two-phase commit functionality (transactions that span multiple connections) and multiple concurrent transactions using the same connection.

Use an IBTransaction component to handle transaction contexts, which might involve one or more database connections. In most cases, a simple one database/one transaction model will do.

To set up a transaction:

  1. Set up an IBDatabase connection as described above.
  2. Drop an IBTransaction component onto the form or data module
  3. Set the DefaultDatabase property to the name of your IBDatabase component.
  4. Set the Active property to true to start the transaction.

IBX dataset components

There are a variety of dataset components from which to choose with IBX, each having their own characteristics and task suitability:

IBTable

Use an IBTable component to set up a live dataset on a table or view without having to enter any SQL statements.

IBTable components are easy to configure:

  1. Add an IBTable component to your form or data module.
  2. Specify the associated database and transaction components.
  3. Specify the name of the relation from the TableName drop-down list.
  4. Set the Active property to true.

IBQuery

Use an IBQuery component to execute any InterBase DSQL statement, restrict your result set to only particular columns and rows, use aggregate functions, and join multiple tables.

IBQuery components provide a read-only dataset, and adapt well to the InterBase client/server environment. To set up an IBQuery component:

  1. Set up an IBDatabase connection as described above.
  2. Set up an IBTransaction connection as described above.
  3. Add an IBQuery component to your form or data module.
  4. Specify the associated database and transaction components.
  5. Enter a valid SQL statement for the IBQuery's SQL property in the String list editor.
  6. Set the Active property to true

IBDataSet

Use an IBDataSet component to execute any InterBase DSQL statement, restrict your result set to only particular columns and rows, use aggregate functions, and join multiple tables. IBDataSet components are similar to IBQuery components, except that they support live datasets without the need of an IBUpdateSQL component.

The following is an example that provides a live dataset for the COUNTRY table in employee.gdb:

  1. Set up an IBDatabase connection as described above.
  2. Specify the associated database and transaction components.
  3. Add an IBDataSet component to your form or data module.
  4. Enter SQL statements for the following properties:

Se|eCtSQL SELECT Country, Currency FROM Country

RefreShSQL SELECT Country, Currency FROM Country WHERE Country = :Country

M0difySQL UPDATE Country SET Country = :Country, Currency = :Currency WHERE

Country = :Old Country

De|eteSQL DELETE FROM Country WHERE Country = :Old_Country

|nSertSQL INSERT INTO Country (Country, Currency) VALUES (:

Country, :Currency)

1. Set the Active property to true.

Note: Note: Parameters and fields passed to functions are case-sensitive in dialect 3. For example,

FieldByName(EmpNo)

would return nothing in dialect 3 if the field was 'EMPNO'. IBStoredProc

Use IBStoredProc for InterBase executable procedures: procedures that return, at most, one row of information. For stored procedures that return more than one row of data, or "Select" procedures, use either IBQuery or IBDataSet components.

IBSQL

Use an IBSQL component for data operations that need to be fast and lightweight. Operations such as data definition and pumping data from one database to another are suitable for IBSQL components.

In the following example, an IBSQL component is used to return the next value from a generator:

  1. Set up an IBDatabase connection as described above.
  2. Put an IBSQL component on the form or data module and set its Database property to the name of the database.
  3. Add an SQL statement to the SQL property string list editor, for example:

SELECT GEN_ID(MyGenerator, 1) FROM RDB$DATABASE

IBUpdateSQL

Use an IBUpdateSQL component to update read-only datasets. You can update IBQuery output with an IBUpdateSQL component:

  1. Set up an IBQuery component as described above.
  2. Add an IBUpdateSQL component to your form or data module.
  3. Enter SQL statements for the following properties: DeleteSQL, InsertSQL, ModifySQL, and RefreshSQL.
  4. Set the IBQuery component's UpdateObject property to the name of the IBUpdateSQL component.
  5. Set the IBQuery component's Active property to true. IBSQLMonitor

Use an IBSQLMonitor component to develop diagnostic tools to monitor the communications between your application and the InterBase server. When the TraceFlags properties of an IBDatabase component are turned on, active IBSQLMonitor components can keep track of the connection's activity and send the output to a file or control.

A good example would be to create a separate application that has an IBSQLMonitor component and a Memo control. Run this secondary application, and on the primary application, activate the TraceFlags of the IBDatabase component. Interact with the primary application, and watch the second's memo control fill with data.

IBDatabaselnfo

Use an IBDatabaseInfo component to retrieve information about a particular database, such as the sweep interval, ODS version, and the user names of those currently attached to this database.

For example, to set up an IBDatabaseInfo component that displays the users currently connected to the database:

  1. Set up an IBDatabase connection as described above.
  2. Put an IBDatabaseInfo component on the form or data module and set its Database property to the name of the database.
  3. Put a Memo component on the form.
  4. Put a Timer component on the form and set its interval.
  5. Double click on the Timer's OnTimer event field and enter code similar to the following:
  6. Text := IBDatabaseInfo.UserNames.Text; // Delphi example Memo1->Text = IBDatabaseInfo->UserNames->Text; // C++ example

IBEvents

Use an IBEvents component to register interest in, and asynchronously handle, events posted by an InterBase server.

To set up an IBEvents component:

  1. Set up an IBDatabase connection as described above.
  2. Put an IBEvents component on the form or data module and set its Database property to the name of the database.
  3. Enter events in the Events property string list editor, for example:
  4. Events.Add('EVENT_NAME'); // Delphi example

IBEvents->Events->Add("EVENT_NAME"); // C++ Example

1. 4. Set the Registered property to true.

InterBase Administration Components

If you have InterBase 6 installed, you can use the InterBase 6 Administration components, which allow you to use access the powerful InterBase Services API calls.

The components are located on the InterBase Admin tab of the IDE and include:

. TIBConfigService

_,_-r%TIBBackupService

^-^TIBRestoreService —TIBValidationService . TIBStatisticalService : TIBLogService .^v-TIBSecurityService ■ - TIBLicensingService

^TIBServerProperties

IB- g t^--. TIBInstall , TIBUnInstall

Note: You must install InterBase 6 to use these features. IBConfigService

Use an TIBConfigService object to configure database parameters, including page buffers, async mode, reserve space, and sweep interval.

IBBackupService

Use an TIBBackupService object to back up your database. With IBBackupService, you can set such parameters as the blocking factor, backup file name, and database backup options.

IBRestoreService

Use an TIBRestoreService object to restore your database. With IBRestoreService, you can set such options as page buffers, page size, and database restore options.

IBValidationService

Use an TIBValidationService object to validate your database and reconcile your database transactions. With the IBValidationService, you can set the default transaction action, return limbo transaction information, and set other database validation options.

IBStatisticalService

Use an TIBStatisticalService object to view database statistics, such as data pages, database log, header pages, index pages, and system relations.

IBLogService

Use an TIBLogService object to create a log file. IBSecurityService

Use an TIBSecurityService object to manage user access to the InterBase server. With the IBSecurityService, you can create, delete, and modify user accounts, display all users, and set up work groups using SQL roles.

IBLicensingService

Use an TIBLicensingService component to add or remove InterBase software activation certificates. IBServerProperties

Use an TIBServerProperties component to return database server information, including configuration parameters, and version and license information.

IBInstall

Use an TIBInstall component to set up an InterBase installation component, including the installation source and destination directories, and the components to be installed.

IBUnInstall

Use an TIBUnInstall component to set up an uninstall component.

Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook


Responses

  • Indro
    What is the equivalent of TIBEvents in ADO?
    9 years ago
  • arabella galbassi
    How to install ibx components?
    4 months ago

Post a comment