ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/examples/arrays/readme.txt
Revision: 45
Committed: Tue Dec 6 10:33:46 2016 UTC (7 years, 3 months ago) by tony
Content type: text/plain
File size: 2940 byte(s)
Log Message:
Committing updates for Release R2-0-0

File Contents

# Content
1 For a more detail version of this text see docs/readme.firebirdarrays.html
2
3 Example applications are provided for both one and two dimensional arrays. In each case,
4 the example applications create their own database and populate it with test data when
5 first run. Note that you will typically need to run the application before accessing
6 database properties in the IDE. This is in order to create the database referenced by the IDE.
7
8 Database Creation
9 -----------------
10
11 The IBDatabase property “CreateIfNotExists” is set to true in both examples. This
12 means that if the database does not exist when an attempt is made to connect to
13 it then the database is created. After it is created, the “OnCreateDatabase”
14 event handler is used to add a table to the newly created database and to
15 populate it with test data. The application then continues as if the database already existed.
16
17 By default, the database is created in the defined temporary directory. This
18 behaviour can be overridden by editing the example's “unit1” unit to remove
19 the “{$DEFINE LOCALDATABASE}” directive and setting the const “sDatabaseName”
20 to the required path e.g.
21
22 const
23 sDatabaseName = 'myserver:/databases/test.fdb';
24
25 1D Array Example
26 ----------------
27
28 In this case, the test data table is defined as
29
30 Create Table TestData (
31 RowID Integer not null,
32 Title VarChar(32) Character Set UTF8,
33 MyArray Double Precision [1:12],
34 Primary Key(RowID)
35 );
36
37 Each row includes a floating point array with twelve elements. In the
38 example application, the table is displayed and edited using a DBControlGrid.
39 The title field is interpreted as a “Department” and displayed using a
40 TDBEdit control. The array field is interpreted as sales by month and
41 displayed as a one dimensional TIBArrayGrid with column labels. The
42 example allows both the Departname Name and monthly sales values
43 to be updated and changes saved. New rows can be inserted and
44 existing rows deleted.
45
46 Note: there is an LCL bug (http://bugs.freepascal.org/view.php?id=30892) which
47 will cause the 1D array example to render incorrectly. That is only the
48 focused row will show the array. The bug report includes an LCL
49 patch to fix this problem.
50
51 2D Array Example
52 ----------------
53
54 In this case, the test data table is defined as
55
56 Create Table TestData (
57 RowID Integer not null,
58 Title VarChar(32) Character Set UTF8,
59 MyArray VarChar(16) [0:16, -1:7] Character Set UTF8,
60 Primary Key(RowID)
61 );
62
63 Each row includes a two dimensional string array with indices 0..16 and -1 to 7.
64 The grid interprets the first index as a column index and the second as a row
65 index (i.e. x,y Cartesian co-ordinates).
66
67 The example program displays a row at a time with a navigation bar
68 providing the means to scroll through the dataset, as well as saving
69 or cancelling changes, inserting and deleting rows.
70
71 This example illustrates the use of both column and row labels.
72
73