note description: "Description of class " author: "EiffelStore Wizard" date: "$Date$" revision: "$Revision$" class _DESCRIPTION inherit DB_TABLE_DESCRIPTION undefine Tables, is_valid_code end DB_SPECIFIC_TABLES_ACCESS_USE create {DB_SPECIFIC_TABLES_ACCESS} make feature -- Access Table_name: STRING = "" Table_code: INTEGER = Attribute_number: INTEGER = -- Number of attributes in the table. Id_code: INTEGER -- Table ID attribute code. do Result := end : INTEGER = attribute_code_list: ARRAYED_LIST [INTEGER] -- Feature code list once create Result.make (Attribute_number) Result.extend () end description_list: ARRAYED_LIST [STRING] -- Feature name list. Can be interpreted as a list -- or a hash-table. once create Result.make (Attribute_number) Result.extend ("") end type_list: ARRAYED_LIST [INTEGER] -- Feature type list. Can be interpreted as a list -- or a hash-table. once create Result.make (Attribute_number) Result.extend (_type) end to_delete_fkey_from_table: HASH_TABLE [INTEGER, INTEGER] -- List of tables depending on this one and their -- foreign key for this table. -- Deletion on this table may imply deletions on -- depending tables. --| Example: an A table is related to a B table (described by this class) --| with a b_id foreign key: --| Adding this relation to the hash-table will be: --| Result.extend (tables.a_description.B_id, tables.A) once end to_create_fkey_from_table: HASH_TABLE [INTEGER, INTEGER] -- List of associated necessary tables and the -- linking foreign keys. -- Creation on this table may imply creations on -- associated necessary tables. --| Example: an A table (described by this class) is related to a B table --| with a b_id foreign key: --| Adding this relation to the hash-table will be: --| Result.extend (B_id, tables.B) once end attribute (i: INTEGER): ANY -- Get feature value of feature whose code is 'i'. do inspect i when then Result := . end end set_attribute (i: INTEGER; value: ANY) -- Set feature value of feature whose code is `i' to `value'. -- `value' must be of type STRING, INTEGER, BOOLEAN, CHARACTER, -- DOUBLE or DATE_TIME. References are made automatically from -- expanded types. local integer_value: INTEGER_REF double_value: DOUBLE_REF boolean_value: BOOLEAN_REF character_value: CHARACTER_REF date_time_value: DATE_TIME string_value: STRING do inspect i when then string_value ?= value .set_ (string_value) when then double_value ?= value if double_value /= Void then .set_ (double_value.item) else .set_ (0.0) end when then integer_value ?= value if integer_value /= Void then .set_ (integer_value.item) else .set_ (0) end when then date_time_value ?= value .set_ (date_time_value) when then character_value ?= value if character_value /= Void then .set_ (character_value.item) else .set_ ('%U') end when then boolean_value ?= value if boolean_value /= Void then .set_ (boolean_value.item) else .set_ (False) end end end feature {} -- Basic operations set_ (a_: ) -- Associate the description to a piece of . require not_void: a_ /= Void do := a_ ensure = a_ end feature {NONE} -- Implementation : -- Piece of associated with the description end