This article is the second one, in a series of several ones (). The first article is here.
Our first version will be very simple. Only one table will be used, to store our data:
table name: PAIRS
first column: wordLanguageA (varchar(128))
second column: wordLanguageB (varchar(128))
One index will be created, for each column, so that we can perform optimized searches on words in any language.
A primary key will include the two columns, so that pair of words are displayed in order.
The application allows the user to define a set of word pairs.
The Graphical User Interface will work as follows:
The Manage / Words windows is as follows:
| wordLanguageA | wordLanguageB | wordLanguageA [ ]
| | | wordLanguageB [ ]
| | |
| | | [ Add ]
| | | [ Edit ]
| | | [ Delete ]
| | |
| | |
| | |
| | | [ Validate ]
| | | [ Cancel ]
| | | [ Exit ]
When the window is displayed, only following elements are visible:
When Add button is clicked, the two worldLanguageA and worldLanguageB edit boxes are
displayed. The Add, Edit, Delete and Exit buttons are hidden, while the Validate and
Cancel buttons are displayed.
Working for edit operation is similar.
Table contents is refreshed after each modification.
Graphical elements are named according to the following rules:
Examples:
Following type acronyms are used:
At startup, autocommit is set to false. Thus, all methods modifying tables must perform a
commit (or a rollback) before returning to caller.
DataAccess class provides the interface to the database. Its methods return their result using
an ErrorInfo object, so that the caller can easily test the execution status of the operation,
and get, if needed, extended info about that status.
dataAccess field is created at startup time by Review, the main class. It is passed as a parameter to all
objects that require accessing database.
In query statements manipulating strings, those strings are enclosed between single quotes.
This requires to double every possibly existing single quotes in such strings. This is the
aim of the DataAccess.filterOutQuotes() method.
Next article: the code.