Transactions are an integral part of a client/server database. IBExpress provides the TIBTransaction component to manage transactions. Each TIBTransaction component handles one transaction on the database to which it is assigned.
A TIBTransaction component enables you to specify the properties of a transaction. These are stored in the Params property of the component. TIBTransaction has a built-in editor that enables you to use four predefined transaction settings. In Bug Tracker, we will use the Read Committed setting. InterBase and IBExpress both default to the transaction to Snapshot. Changing to Read Committed is a normal first step when dropping a new TIBTransaction onto a data module or form.
Most problems involving
This problem was because of a known logic bug in IBExpress wherein a dataset will commit a transaction that it autostarts if there are no other active datasets when it
If you run across a problem such as this, the TIBSQLMonitor component is invaluable for tracing the transaction events that are occurring.
IBExpress offers many different ways of working with the information in a database. These include TIBTable , TIBQuery , and TIBDataSet . If a TIBTable or TIBQuery is used, the TIBUpdateSQL component can also be used.
The TIBUpdateSQL component is designed for use with the TIBTable or TIBQuery component. It provides SQL statements to be executed to perform the actions needed for the four different operations you can perform on the database: deleting, inserting, updating, and refreshing.
The component has an editor (as seen in Figure 10.2) to supply the creation of these statements. The editor can only work when the component has been assigned to a
, and the
has been set up for a specific table or query. This is because
The editor will automatically create a base statement for each of the four operations, but it might be necessary to edit the automatically generated statements to take into account triggers, stored procedures, or other
Just like the standard C++Builder data access
attempts to return a live dataset, but because this is an actual client-server database rather than a desktop database, it might not be possible under certain conditions. This is
is rarely a good component for client/server
The use of the
is not recommended. Appending data to a specific position in a SQL backend has no real meaning. In a
TIBQuery returns a read-only dataset based on any InterBase SQL statement. TIBQuery offers a higher degree of control over what data is presented than TIBTable . By using joins, you can specify SQL queries that combine information in several different tables. TIBQuery should be used instead of TIBTable whenever possible.
needs to insert, edit, or delete information, a
component must be assigned to it. However, it is typically preferable to use a
, which combines the capabilities of a
, to accomplish these
combines the data-selection features of a
component with the data-editing features of a
component. One difference between
is that the
parameter type is required if you are using InterBase version 6.0 and need Int64 parameters. For the Bug Tracker application, we will make
component offers a fast, low-overhead means of executing InterBase data operations. Descended from the
component does not support any of the
TIBStoredProc can work with data-enabled objects, but a TIBQuery or TIBDataSet should be used for stored procedures that return multiple rows or components. Designed to simplify accessing stored procedures, TIBStoredProc enables you to specify the procedure to execute and the parameters for that procedure. Note that any values that are returned by the stored procedure will be accessible through the corresponding parameter.
Using InterBase and stored procedures or triggers, events can be set up to be generated by the server. An example of a generated event is the command
is the name of the event
The TIBEvent component allows the client application to tell the server what events it wants to be notified of, receive that notification, and generate an OnEventAlert() event. Bug Tracker executes a simple ShowMessage() when a bug record is deleted, but more complex functions could easily be included.
Events of this