indexing
	description: "Specification of the database. Generic parameter"
	legal: "See notice at end of class."
	status: "See notice at end of class."
	date: "$Date: 2006-01-22 18:25:44 -0800 (Sun, 22 Jan 2006) $"
	revision: "$Revision: 56675 $"

deferred class interface
	DATABASE

feature -- Access

	generating_type: STRING_8
			-- Name of current object's generating type
			-- (type of which it is a direct instance)
			-- (from ANY)

	generator: STRING_8
			-- Name of current object's generating class
			-- (base class of the type of which it is a direct instance)
			-- (from ANY)
	
feature -- Comparison

	frozen deep_equal (some: ANY; other: like arg #1): BOOLEAN
			-- Are `some' and `other' either both void
			-- or attached to isomorphic object structures?
			-- (from ANY)
		ensure -- from ANY
			shallow_implies_deep: standard_equal (some, other) implies Result
			both_or_none_void: (some = Void) implies (Result = (other = Void))
			same_type: (Result and (some /= Void)) implies some.same_type (other)
			symmetric: Result implies deep_equal (other, some)

	frozen equal (some: ANY; other: like arg #1): BOOLEAN
			-- Are `some' and `other' either both void or attached
			-- to objects considered equal?
			-- (from ANY)
		ensure -- from ANY
			definition: Result = (some = Void and other = Void) or else ((some /= Void and other /= Void) and then some.is_equal (other))

	is_equal (other: like Current): BOOLEAN
			-- Is `other' attached to an object considered
			-- equal to current object?
			-- (from ANY)
		require -- from ANY
			other_not_void: other /= Void
		ensure -- from ANY
			symmetric: Result implies other.is_equal (Current)
			consistent: standard_is_equal (other) implies Result

	frozen standard_equal (some: ANY; other: like arg #1): BOOLEAN
			-- Are `some' and `other' either both void or attached to
			-- field-by-field identical objects of the same type?
			-- Always uses default object comparison criterion.
			-- (from ANY)
		ensure -- from ANY
			definition: Result = (some = Void and other = Void) or else ((some /= Void and other /= Void) and then some.standard_is_equal (other))

	frozen standard_is_equal (other: like Current): BOOLEAN
			-- Is `other' attached to an object of the same type
			-- as current object, and field-by-field identical to it?
			-- (from ANY)
		require -- from ANY
			other_not_void: other /= Void
		ensure -- from ANY
			same_type: Result implies same_type (other)
			symmetric: Result implies other.standard_is_equal (Current)
	
feature -- Status report

	conforms_to (other: ANY): BOOLEAN
			-- Does type of current object conform to type
			-- of `other' (as per Eiffel: The Language, chapter 13)?
			-- (from ANY)
		require -- from ANY
			other_not_void: other /= Void

	same_type (other: ANY): BOOLEAN
			-- Is type of current object identical to type of `other'?
			-- (from ANY)
		require -- from ANY
			other_not_void: other /= Void
		ensure -- from ANY
			definition: Result = (conforms_to (other) and other.conforms_to (Current))
	
feature -- Duplication

	copy (other: like Current)
			-- Update current object using fields of object attached
			-- to `other', so as to yield equal objects.
			-- (from ANY)
		require -- from ANY
			other_not_void: other /= Void
			type_identity: same_type (other)
		ensure -- from ANY
			is_equal: is_equal (other)

	frozen deep_copy (other: like Current)
			-- Effect equivalent to that of:
			--		copy (`other' . deep_twin)
			-- (from ANY)
		require -- from ANY
			other_not_void: other /= Void
		ensure -- from ANY
			deep_equal: deep_equal (Current, other)

	frozen deep_twin: like Current
			-- New object structure recursively duplicated from Current.
			-- (from ANY)
		ensure -- from ANY
			deep_equal: deep_equal (Current, Result)

	frozen standard_copy (other: like Current)
			-- Copy every field of `other' onto corresponding field
			-- of current object.
			-- (from ANY)
		require -- from ANY
			other_not_void: other /= Void
			type_identity: same_type (other)
		ensure -- from ANY
			is_standard_equal: standard_is_equal (other)

	frozen standard_twin: like Current
			-- New object field-by-field identical to `other'.
			-- Always uses default copying semantics.
			-- (from ANY)
		ensure -- from ANY
			standard_twin_not_void: Result /= Void
			equal: standard_equal (Result, Current)

	frozen twin: like Current
			-- New object equal to `Current'
			-- twin calls copy; to change copying/twining semantics, redefine copy.
			-- (from ANY)
		ensure -- from ANY
			twin_not_void: Result /= Void
			is_equal: Result.is_equal (Current)
	
feature -- Basic operations

	frozen default: like Current
			-- Default value of object's type
			-- (from ANY)

	frozen default_pointer: POINTER
			-- Default value of type `POINTER'
			-- (Avoid the need to write `p'.default for
			-- some `p' of type `POINTER'.)
			-- (from ANY)

	default_rescue
			-- Process exception for routines with no Rescue clause.
			-- (Default: do nothing.)
			-- (from ANY)

	frozen do_nothing
			-- Execute a null action.
			-- (from ANY)
	
feature 

	database_handle_name: STRING_8
			-- Database handle name.
	
feature -- DATABASE_BOOLEAN

	sql_name_boolean: STRING_8
			-- SQL type name for boolean
	
feature -- DATABASE_CHARACTER

	sql_name_character: STRING_8
			-- SQL type name for character
	
feature -- DATABASE_DATETIME

	sql_name_datetime: STRING_8
			-- SQL type name for datetime
	
feature -- DATABASE_DOUBLE

	sql_name_double: STRING_8
			-- SQL type name for double
	
feature -- DATABASE_INTEGER

	sql_name_integer: STRING_8
			-- SQL type name for integer
	
feature -- DATABASE_REAL

	sql_name_real: STRING_8
			-- SQL type name for real
	
feature -- DATABASE_STRING

	sql_name_string: STRING_8
			-- SQL type name of string
	
feature -- External features

	begin
			-- Begin a data base transaction

	c_boolean_type: INTEGER_32
			-- Boolean Eiffel type

	c_character_type: INTEGER_32
			-- Character Eiffel type

	c_date_type: INTEGER_32
			-- Datetime Eiffel type

	c_float_type: INTEGER_32
			-- Float Eiffel type

	c_integer_type: INTEGER_32
			-- Integer Eiffel type

	c_real_type: INTEGER_32
			-- Real Eiffel type

	c_string_type: INTEGER_32
			-- String Eiffel type

	close_cursor (no_descriptor: INTEGER_32)
			-- A SQL has been performed in DYNAMIC EXECUTION mode,
			-- Then if the DYNAMICALLY EXECUTED SQL statement is a SELECT
			-- statement, then the cursor is closed.
			-- Then one can do an other selection on the previous cursor.

	commit
			-- Commit the current transaction

	connect (user_name, user_passwd, data_source, application, hostname, roleid, rolepasswd, groupid: STRING_8)
			-- Connect to an ODBC database

	conv_type (indicator: INTEGER_32; index: INTEGER_32): INTEGER_32
			-- Function used to get data from structure SQLDA filled  by FETCH clause.

	database_make (i: INTEGER_32)
			-- Initialize database c-module

	disconnect
			-- Disconnect the current connection with an database

	exec_immediate (no_descriptor: INTEGER_32; command: STRING_8)
			-- In IMMEDIATE EXECUTE mode perform the SQL statement,
			-- and then check if there is warning message for the execution,

	get_boolean_data (no_descriptor: INTEGER_32; ind: INTEGER_32): BOOLEAN
			-- Function used to get data from structure SQLDA filled  by FETCH clause.

	get_col_len (no_descriptor: INTEGER_32; ind: INTEGER_32): INTEGER_32
			-- Function used to get data from structure SQLDA filled  by FETCH clause.

	get_col_type (no_descriptor: INTEGER_32; ind: INTEGER_32): INTEGER_32
			-- Function used to get data from structure SQLDA filled  by FETCH clause.

	get_count (no_descriptor: INTEGER_32): INTEGER_32
			-- Function used to get data from structure SQLDA filled  by FETCH clause.

	get_data_len (no_descriptor: INTEGER_32; ind: INTEGER_32): INTEGER_32
			-- Function used to get data from structure SQLDA filled  by FETCH clause.

	get_date_data (no_descriptor: INTEGER_32; ind: INTEGER_32): INTEGER_32
			-- Function used to get data from structure SQLDA filled  by FETCH clause.

	get_day (no_descriptor: INTEGER_32; ind: INTEGER_32): INTEGER_32
			-- Function used to get data from structure SQLDA filled  by FETCH clause.

	get_error_code: INTEGER_32
			-- Function related with the error processing

	get_error_message: POINTER
			-- Function related with the error processing

	get_float_data (no_descriptor: INTEGER_32; ind: INTEGER_32): REAL_64
			-- Function used to get data from structure SQLDA filled  by FETCH clause.

	get_hour (no_descriptor: INTEGER_32; ind: INTEGER_32): INTEGER_32
			-- Function used to get data from structure SQLDA filled  by FETCH clause.

	get_integer_data (no_descriptor: INTEGER_32; ind: INTEGER_32): INTEGER_32
			-- Function used to get data from structure SQLDA filled  by FETCH clause.

	get_min (no_descriptor: INTEGER_32; ind: INTEGER_32): INTEGER_32
			-- Function used to get data from structure SQLDA filled  by FETCH clause.

	get_month (no_descriptor: INTEGER_32; ind: INTEGER_32): INTEGER_32
			-- Function used to get data from structure SQLDA filled  by FETCH clause.

	get_real_data (no_descriptor: INTEGER_32; ind: INTEGER_32): REAL_32
			-- Function used to get data from structure SQLDA filled  by FETCH clause.

	get_sec (no_descriptor: INTEGER_32; ind: INTEGER_32): INTEGER_32
			-- Function used to get data from structure SQLDA filled  by FETCH clause.

	get_warn_message: POINTER
			-- Function related with the error processing

	get_year (no_descriptor: INTEGER_32; ind: INTEGER_32): INTEGER_32
			-- Function used to get data from structure SQLDA filled  by FETCH clause.

	identifier_quoter: STRING_8
			-- Return the string used to quote identifiers in SQL command,
			-- for example, if the quoter is `, and we want to select on
			-- table "my table", we should express the query as:
			-- select * from `My table`
			-- Only for ODBC

	init_order (no_descriptor: INTEGER_32; command: STRING_8)
			-- In DYNAMICALLY EXECUTE mode perform the SQL statement
			-- But this routine only get things ready for dynamic execution:
			-- 1. get the SQL statement PREPAREd; and check if there are
			-- warning message for the SQL statement;
			-- 2. DESCRIBE the SQL statement and get enough information to
			-- allocate enough memory space for the corresponding descriptor.

	is_null_data (no_descriptor: INTEGER_32; ind: INTEGER_32): BOOLEAN
			-- Is last retrieved data null?

	new_descriptor: INTEGER_32
			-- A descriptor is used to store a row fetched by FETCH command
			-- Whenever perform a SELECT statement, allocate a new descriptor
			-- by int_new_descriptor(), the descriptor is freed
			-- when the SELECT statement terminates.

	next_row (no_descriptor: INTEGER_32)
			-- A SELECT statement is now being executed in DYNAMIC EXECUTION mode,
			-- the  routine is to FETCH a new tuple from database
			-- and if a new tuple is fetched, return 1 otherwise return 0.

	put_col_name (no_descriptor: INTEGER_32; index: INTEGER_32; ar: STRING_8; max_len: INTEGER_32): INTEGER_32
			-- Function used to get data from structure SQLDA filled  by FETCH clause.

	put_data (no_descriptor: INTEGER_32; index: INTEGER_32; ar: STRING_8; max_len: INTEGER_32): INTEGER_32
			-- Function used to get data from structure SQLDA filled  by FETCH clause.

	qualifier_seperator: STRING_8
			-- When "qualifier" and "owner" are used to identifier
			-- a database object, they should be seperated by a string called
			-- "qualifier seperator"
			-- Only for ODBC

	rollback
			-- Commit the current transaction

	sensitive_mixed: BOOLEAN
			-- Is the database sensitive to lower or
			-- upper case?
			-- Only for ODBC, Ingres

	start_order (no_descriptor: INTEGER_32)
			-- Finish execution of a SQL statement in DYNAMICLLY EXECUTION mode:                                                         */
			-- 1. if the PREPAREd SQL statement is a NON_SELECT statement,
			-- just EXECUTE it; otherwise, DEFINE a CURSOR for it and
			-- OPEN the CURSOR. In the process, if error occurs, do some
			-- clearence;

	terminate_order (no_descriptor: INTEGER_32)
			-- A SQL has been performed in DYNAMIC EXECUTION mode,
			-- so the routine is to do some clearence:
			-- 1. if the DYNAMICALLY EXECUTED SQL statement is a NON_SELECT
			-- statement, just free the memory for ODBCSQLDA and clear
			-- the cell in 'descriptor' to NULL; otherwise, CLOSE the CURSOR
			-- and then do the same clearence.
			-- 2. return error number.

	trancount: INTEGER_32
			-- Return the number of transactions now active
	
feature -- For DATABASE_CHANGE

	descriptor_is_available: BOOLEAN
			-- Is a new descritor available?

	hide_qualifier (c_temp: STRING_8): POINTER
			-- When "qualifier" is used to identify an database object,
			-- we have to hide ":" in the qualifier first, otherwise, it
			-- will be misinterpreted by feature SQL_SCAN::parse
			-- Only for ODBC

	pre_immediate (descriptor, i: INTEGER_32)
			-- In IMMEDIATE EXECUTE mode, if the performed SQL statement is
			-- a call to a stored procedure, allocate some area used by the
			-- stored procedure
			-- Only for ODBC

	results_order (no_descriptor: INTEGER_32): INTEGER_32
			-- Fetch all the rows resulting from the sql query
			-- Default value zero
			-- Only for Sybase
	
feature -- For DATABASE_DYN_STORE

	unset_catalog_flag (desc: INTEGER_32)
			-- Default value zero
			-- Only for ODBC.
	
feature -- For DATABASE_FORMAT

	date_to_str (object: DATE_TIME): STRING_8
			-- String representation in SQL of `object'
			-- For ODBC, ORACLE

	false_representation: STRING_8
			-- Database representation of the boolean False

	string_format (object: STRING_8): STRING_8
			-- String representation in SQL of `object'

	true_representation: STRING_8
			-- Database representation of the boolean True
	
feature -- For DATABASE_PROC

	drop_proc_not_supported
			-- Display the text saying that the database
			-- does not support stored procedure dropping
			-- Redefined for ODBC

	exec_proc_not_supported
			-- Display the text saying that the database
			-- does not support stored procedure executing
			-- Redefined for ODBC

	has_row_number: BOOLEAN
			-- May the database store the text of a stored procedure in more than one
			-- row?
			-- Default value False
			-- Redefined for Ingres

	map_var_after: STRING_8
			-- Redefined for Sybase

	map_var_before: STRING_8
			-- Redefined for Sybase

	map_var_between: STRING_8
			-- @ symbol for ODBC and Sybase

	map_var_between_2: STRING_8
			-- Equal type
			-- Only for Ingres

	map_var_name (par_name: STRING_8): STRING_8
			-- Redefined for Sybase

	name_proc_lower: BOOLEAN
			-- Has the name of the stored procedure to be in lower case?

	proc_args: BOOLEAN
			-- True if the execution of the stored procedure is
			-- "execute procedure_name (argument1='sireude')"
			-- False if "execute procedure_name ('sireude')"
			-- Default value False
			-- True for Sybase

	select_exists (name: STRING_8): STRING_8
			-- SQL query to test stored procedure existing

	select_text (proc_name: STRING_8): STRING_8
			-- SQL query to get stored procedure text

	sql_adapt_db (sql: STRING_8): STRING_8
			-- Adapt the SQL string for the database
			-- Only for Sybase and ODBC

	sql_after_exec: STRING_8
			-- End of the stored procedure execution string.

	sql_as: STRING_8
			-- Creating a stored procedure "as"...

	sql_creation: STRING_8
			-- Begining of the stored procedure creation string.

	sql_end: STRING_8
			-- End of the stored procedure creation string.

	sql_execution: STRING_8
			-- Begining of the stored procedure execution string.

	store_proc_not_supported
			-- Display the text saying that the database
			-- does not support stored procedure creating
			-- Redefined for ODBC

	support_drop_proc: BOOLEAN
			-- Does the database support stored procedure dropping from server?

	support_proc: INTEGER_32
			-- Does the database support stored procedure?
			-- 1 if True, 0 if False
			-- Redefined for ODBC

	support_sql_of_proc: BOOLEAN
			-- Does the database support SQL attachment to the stored procedure?

	support_stored_proc: BOOLEAN
			-- Does the database support creating a stored procedure?

	text_not_supported: STRING_8
			-- Display the text saying that the database
			-- does not support stored procedure text retrieving
			-- Redefined for ODBC
	
feature -- For DATABASE_REPOSITORY

	max_char_size: INTEGER_32
			-- Limit size before being a text
			-- Except for ODBC

	selection_string (rep_qualifier, rep_owner, repository_name: STRING_8): STRING_8
			-- String to select the table needed

	sql_string: STRING_8
			-- Database type of a string
			-- with a size less than Max_char_size

	sql_string2 (int: INTEGER_32): STRING_8
			-- Database type of a string
			-- with a size more than Max_char_size
	
feature -- For DATABASE_SELECTION, DATABASE_CHANGE

	normal_parse: BOOLEAN
			-- Should the SQL string be normal parsed,
			-- using SQL_SCAN?

	parse (descriptor: INTEGER_32; uht: HASH_TABLE [ANY, STRING_8]; ht_order: ARRAYED_LIST [STRING_8]; uhandle: HANDLE; sql: STRING_8): BOOLEAN
			-- Prepare string `sql' by appending map
			-- variables name from to `sql'. Map variables are used
			-- for set input arguments
			-- For ODBC

	result_order (descriptor: INTEGER_32)
			-- Fetch one row resulting from the sql query
			-- Default value zero
			-- For Sybase
	
feature -- For DATABASE_STATUS

	clear_error
			-- Reset database error status.

	found: BOOLEAN
			-- Is there any record matching the last
			-- selection condition used ?

	insert_auto_identity_column: BOOLEAN
			-- For INSERTs and UPDATEs should table auto-increment identity columns be explicitly included in the statement?

	is_error_updated: BOOLEAN
			-- Has a database function been called since last update which may have
			-- updated error code, error message or warning message?
	
feature -- For DATABASE_STORE

	dim_rep_diff (repository_dimension, db_field_count: INTEGER_32): BOOLEAN
			-- Is the dimension of the repository different to the field count of the object to insert?
			-- If yes, make a default map_table
			-- Default value False
			-- Only for Sybase

	put_column_name (repository: DATABASE_REPOSITORY [like Current]; map_table: ARRAY [INTEGER_32]; obj: ANY): STRING_8
			-- Add the columns names to sql_string in the feature put
			-- Redefined for ODBC

	update_map_table_error (db_handle: HANDLE; map_table: ARRAY [INTEGER_32]; ind: INTEGER_32)
			-- Set error number as 200
			-- Except for ODBC and for Oracle
	
feature -- For database types

	convert_string_type (r_any: ANY; field_name, class_name: STRING_8): ANY
			-- Convert `r_any' to the expected object.
			-- By default returns `r_any', redefined in ORACLE to return
			-- an INTEGER_REF when `field_name' is "data_type".
		require
			r_any_not_void: r_any /= Void
			field_name_not_void: field_name /= Void
			class_name_not_void: class_name /= Void
		ensure
			valid_result: Result /= Void
	
feature -- LOGIN and DATABASE_APPL only for password_ok

	password_ensure (name, passwd, uname, upasswd: STRING_8): BOOLEAN
			-- Is name equal to uname and passwd equal to upasswd?

	password_ok (upasswd: STRING_8): BOOLEAN
			-- Can the user password be Void?

	user_name_ok (uname: STRING_8): BOOLEAN
			-- Can the user name be Void?
			-- Yes only for ODBC
	
feature -- Output

	io: STD_FILES
			-- Handle to standard file setup
			-- (from ANY)

	out: STRING_8
			-- New string containing terse printable representation
			-- of current object
			-- Was declared in ANY as synonym of tagged_out.
			-- (from ANY)

	print (some: ANY)
			-- Write terse external representation of `some'
			-- on standard output.
			-- (from ANY)

	frozen tagged_out: STRING_8
			-- New string containing terse printable representation
			-- of current object
			-- Was declared in ANY as synonym of out.
			-- (from ANY)
	
feature -- Platform

	operating_environment: OPERATING_ENVIRONMENT
			-- Objects available from the operating system
			-- (from ANY)
	
invariant
		-- from ANY
	reflexive_equality: standard_is_equal (Current)
	reflexive_conformance: conforms_to (Current)

indexing
	copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
	license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
	source: "[
		Eiffel Software
		356 Storke Road, Goleta, CA 93117 USA
		Telephone 805-685-1006, Fax 805-685-6869
		Website http://www.eiffel.com
		Customer support http://support.eiffel.com
	]"

end -- class DATABASE