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.
To compile the example:
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:
Database user authentication: Data Source Name: handson Name: smith Password: mypass
Note: Name and Password are no required with ODBC. If you don't need Name and Password, you can simply hit Return when prompted.
Database user authentication: Name: smith@HANDSON Password: mypass
Note: you have to specify the Oracle User Name and Net Service Name with the syntax <user>@<service> where <user> stands for the User Name and <service> stands for the Net Service Name.
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.
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: