Selector Sample
This sample creates a
Compiling
To compile the example:
- Launch EiffelStudio.
- Click Add project
- Browse to $ISE_EIFFEL\examples\store\select\.
- Clicking open loads the selected project
- Choose select.ecf
- Select the target according to the installed DBMS
- Choose the location where the project will be compiled, by default the same directory containing the configuration file.
- Click OK.
Running
In order to run this example, you must first create a file named data.sql
from one of the files in the select
example directory. You will see that the data.sql
files in the example directory have names which include the names of the available DBMS handles. This is because the SQL can differ from one DBMS to another. For example, you'll see data.sql.oracle
and data.sql.odbc
. If you are using the Oracle DBMS, you should rename or make a copy of data.sql.oracle
as data.sql
and make sure it's in your execution directory before running the example.
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
Then you can select rows from this table with author's name, for instance: Author? ('exit' to terminate):Bertrand Meyer
Seeking for books whose author's name match: Bertrand Meyer
Author:Bertrand Meyer
Title:Eiffel The Libraries
Quantity:11
Price:20
double_value:435.60000610351562
First publication:07/01/1994 12:00:00.0 AM
Author:Bertrand Meyer
Title:Eiffel The Language
Quantity:9
Price:51
double_value:775.22998046875
First publication:07/01/1992 12:00:00.0 AM
Author? ('exit' to terminate):
Under the Hood
This sample showcases the use of the DB_SELECTION class to perform smart select queries, using:
The whole sample code is contained in the root class:
- SELECTOR for Oracle.
- SELECTOR_ODBC for ODBC.