4. SQ-HAL Implementation

SQ-HAL is programmed in Perl.  Perl is chosen as the preferred programming language because of its simple and powerful string manipulation capabilities.  Since SQ-HAL relies much on string manipulation tasks, this is the major factor of considering the implementing language.  Furthermore Perl already has many useful modules written by other people, which can be used in SQ-HAL.  In particular the use of a parser module will simplify the process of coding, as I do not have to spend time on writing my own code.  Also there are many different modules for database communications and implementing user interfaces in Perl.  Perl can also write platform independent program and this is suited for the purpose of SQ-HAL.  Considering all the above factors, Perl is the best candidate for writing SQ-HAL.

Implementation of SQ-HAL is discussed in more details in the following sections.

4.1 Implementing database functionalities

DBI module is used to implement the required database functions.  DBI is chosen as it can be used to write database independent code without repeating similar code to different types of databases.  In order for DBI module to work, the corresponding DBD module is required to be installed in the system.  These DBD modules have the database specific code, which is encapsulated by the DBI module.  If the appropriate database driver (or DBD module) is not installed in the user system, the program cannot progress any further.  If the user does not know the type of database, SQ-HAL can then try all the available database types until a valid connection is established.

Table names can be accessed using the DBI:table_info() method.  However for DBD::ADO module, table_info() method is not yet implemented.  Therefore SQ-HAL cannot access table names from ADO type (e.g. Microsoft Access) databases and does not currently support them.

There is no direct method of retrieving column names.  The only way is to execute SQL statement for each table to receive information from all columns and look up the returned structure.  This structure contains column names, their type and other information, which are not relevant for the purpose of SQ-HAL.

Implementation - Natural Language Translation