ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/doc/readme.example.html
Revision: 7
Committed: Sun Aug 5 18:28:19 2012 UTC (11 years, 8 months ago) by tony
Content type: text/html
File size: 7098 byte(s)
Log Message:
Committing updates for Release R1-0-0

File Contents

# Content
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html
3 PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml"><!--This file was converted to xhtml by OpenOffice.org - see http://xml.openoffice.org/odf2xhtml for more info.--><head profile="http://dublincore.org/documents/dcmi-terms/"><meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/><title xml:lang="en-US">- no title specified</title><meta name="DCTERMS.title" content="" xml:lang="en-US"/><meta name="DCTERMS.language" content="en-US" scheme="DCTERMS.RFC4646"/><meta name="DCTERMS.source" content="http://xml.openoffice.org/odf2xhtml"/><meta name="DCTERMS.creator" content="Tony Whyman"/><meta name="DCTERMS.issued" content="2011-05-05T14:46:30" scheme="DCTERMS.W3CDTF"/><meta name="DCTERMS.contributor" content="Tony Whyman"/><meta name="DCTERMS.modified" content="2011-05-06T11:03:57" scheme="DCTERMS.W3CDTF"/><meta name="DCTERMS.provenance" content="" xml:lang="en-US"/><meta name="DCTERMS.subject" content="," xml:lang="en-US"/><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" hreflang="en"/><link rel="schema.DCTERMS" href="http://purl.org/dc/terms/" hreflang="en"/><link rel="schema.DCTYPE" href="http://purl.org/dc/dcmitype/" hreflang="en"/><link rel="schema.DCAM" href="http://purl.org/dc/dcam/" hreflang="en"/><base href="."/><style type="text/css">
5 @page { }
6 table { border-collapse:collapse; border-spacing:0; empty-cells:show }
7 td, th { vertical-align:top; font-size:12pt;}
8 h1, h2, h3, h4, h5, h6 { clear:both }
9 ol, ul { margin:0; padding:0;}
10 li { list-style: none; margin:0; padding:0;}
11 <!-- "li span.odfLiEnd" - IE 7 issue-->
12 li span. { clear: both; line-height:0; width:0; height:0; margin:0; padding:0; }
13 span.footnodeNumber { padding-right:1em; }
14 span.annotation_style_by_filter { font-size:95%; font-family:Arial; background-color:#fff000; margin:0; border:0; padding:0; }
15 * { margin:0;}
16 .Heading_20_1 { font-size:115%; margin-bottom:0.0835in; margin-top:0.1665in; font-family:Arial; writing-mode:page; font-weight:bold; }
17 .P1 { font-size:12pt; margin-bottom:0.0835in; margin-top:0in; font-family:Times New Roman; writing-mode:page; margin-left:0.5in; margin-right:0in; text-indent:0in; }
18 .P2 { font-size:12pt; margin-bottom:0.0835in; margin-top:0in; font-family:Times New Roman; writing-mode:page; }
19 .P3 { font-size:12pt; margin-bottom:0.0835in; margin-top:0in; font-family:Times New Roman; writing-mode:page; }
20 .Text_20_body { font-size:12pt; font-family:Times New Roman; writing-mode:page; margin-top:0in; margin-bottom:0.0835in; }
21 .Bullet_20_Symbols { font-family:OpenSymbol; }
22 <!-- ODF styles with no properties representable as CSS -->
23 { }
24 </style></head><body dir="ltr" style="max-width:8.2681in;margin-top:0.7874in; margin-bottom:0.7874in; margin-left:0.7874in; margin-right:0.7874in; "><h1 class="Heading_20_1"><a id="a__Notes_on_the_IBX_“Employee”_Example"><span/></a>Notes on the IBX “Employee” Example</h1><p class="Text_20_body">The project in “examples/employee” is intended to provide a worked example showing several useful IBX techniques. The example uses the “employee” database that is distributed with the Firebird Database Engine and provides an example Firebird Database. As this database is intended to demonstrate Firebird features, it includes many Check constraints and triggers – so many that it is not easy to add/edit or delete entries in the Employee table without falling foul of a check constraint or data integrity trigger. It does, however, make it easy to demonstrate the error handling features of IBX...</p><p class="Text_20_body">The example comprises one main form and two dialogs. The main form includes a TIBDatabase component, that identifies the employee database, a default transaction and a TIBQuery that selects all members of the employee table sorted by their Last Name. The query results set is shown as the contents of a TDBGrid.</p><p class="Text_20_body">The TIBQuery has its active property set to true in the Form's OnShow event handler. This forces the database connection to be opened including the prompt for a user name and password. Note that for a newly installed Firebird database server, the only user defined is the System Administrator (SYSDBA) with the password 'masterkey'.</p><ul><li><p class="P2" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0cm">•.</span>A “Delete” button is provided to delete the currently selected row. The SQL statement to perform the delete is provided by a TIBUpdateSQL linked to the TIBQuery.<span class="odfLiEnd"/> </p></li><li><p class="P2" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0cm">•.</span>Double-clicking on a row or clicking on the Edit Button opens the TEditEmployeeDlg. This is a modal dialog box intended to edit a single row of the database. The primary key for this row is a parameter to its “ShowModal” function.<span class="odfLiEnd"/> </p></li></ul><p class="P1">A TIBDataset is used to provide the link to the “employee” table. This has a singleton select to select the row to be edited. The select query is parameterised and the required value of the primary key is set in the “BeforeOpen” event handler.</p><p class="P1">This query is supported by Update and Insert queries to allow the values to be edited. Two of the editable fields are implemented as Lookup Combo boxes. Each combo box has its own TIBQuery to select the lookup values.</p><p class="P1">The Date Picker is not a data aware control and is instead managed through TIBDataset event handlers. Any change to it forces the dataset into edit mode.</p><p class="P1">When the dialog closes any changes are “posted” and the TIBDataset closed.</p><ul><li><p class="P3" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0cm">•.</span>Clicking on the Add Button opens the TAddEmployeeDlg. This is sub-classed from the TEditEmployeeDlg, with the only variation being to open the select query with a “don't care” value of -1 and then immediately to create a new record with the “Append” method.<span class="odfLiEnd"/> </p></li></ul><p class="P1">Hint: Dept: Software Development and Country: USA are valid combinations for creating a new employee.</p><p class="Text_20_body">Explicit Transaction management is performed in this example. A transaction is started as soon as the database is opened in its “AfterConnect” event handler”. “Save” and “Cancel” buttons are enabled as soon as any changes are made to the dataset and these respectively Commit and Rollback the transaction.</p><p class="Text_20_body">Note that when the transaction ends, an asynchronous call is queued to restart the transaction and reopen the main dataset. </p><p class="Text_20_body">When the application terminates the default action is to commit the current transaction.</p></body></html>