Version
Esql Sample
This sample consists of a command line SQL parser. SQL statements are filtered through a monitor and sent to the RDBMS.
Compiling
To compile the example:
- Launch EiffelStudio.
- Click Add project
- Browse to $ISE_EIFFEL\examples\store\esql\.
- Choose esql.ecf
- Choose the location where the project will be compiled, by default the same directory containing the configuration file.
- Choose the targe according to the installed DBMS.
- Click OK.
Running
This sample lets you interact with your database through a console.
First you have to enter the database connection information:
- For ODBC:
Database user authentication:
Data Source Name: handson
Name: smith
Password: mypass
- For Oracle:
Database user authentication:
Name: smith@HANDSON
Password: mypass
SQL> select firstname, lastname from CONTACTS where lastname = 'Smith'
John Smith
SQL>
==Under the Hood==
This sample showcases the use of the 3 basic classes to interact with your database:
* DB_CONTROL to connect and disconnect to your database.
* DB_SELECTION to perform 'select' queries.
* DB_CHANGE to perform SQL queries that output no result.
The whole sample code is contained in the root class:
* ESQL for Oracle.
* ESQL_ODBC for ODBC.