The Selector Sample

This sample creates a DB_BOOK table in your database, enters sample data in it and lets you select rows from this table with author's name.

Compiling

To compile the example:

Running

Before running this sample, one must do link a specific file to data.sql as follows:

With Oracle:

ln data.sql.oracle data.sql

With ODBC:

ln data.sql.odbc data.sql

Caution: the data.sql file must be available in the sample application current directory. If you run the sample from EiffelStudio, this directory should be the EIFGEN/W_CODE/ directory of your project.

This sample lets you interact with your database through a console.

First you have to enter the database connection information:

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):

Note: enter exit to quit the application.

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: