mirror of
https://github.com/EiffelSoftware/eiffel-org.git
synced 2025-12-07 15:22:31 +01:00
Author:jfiat
Date:2008-12-09T09:52:15.000000Z git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@130 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
@@ -1,8 +1,7 @@
|
|||||||
[[Property:title|EiffelStudio Debugger]]
|
[[Property:title|Debugger]]
|
||||||
[[Property:link_title|Debugger]]
|
|
||||||
[[Property:weight|-8]]
|
[[Property:weight|-8]]
|
||||||
[[Property:uuid|31c4857e-f19e-e9e3-b7db-d6c30515277f]]
|
[[Property:uuid|31c4857e-f19e-e9e3-b7db-d6c30515277f]]
|
||||||
* [[Eiffel Debugger: Introduction|Introduction]]
|
* [[Debugger: Introduction|Introduction]]
|
||||||
* [[Execution commands|Execution commands]]
|
* [[Execution commands|Execution commands]]
|
||||||
* [[Breakpoints|Breakpoint management]]
|
* [[Breakpoints|Breakpoint management]]
|
||||||
* [[Call stack tool|Call stack information]]
|
* [[Call stack tool|Call stack information]]
|
||||||
|
|||||||
@@ -10,13 +10,15 @@ A smart way to work with relational databases is to have Eiffel objects directly
|
|||||||
|
|
||||||
A [[ref:/libraries/store/reference/db_repository_flatshort|DB_REPOSITORY]] object stores available information about a table. To access this information, you mainly have to give the table name and load the table description:
|
A [[ref:/libraries/store/reference/db_repository_flatshort|DB_REPOSITORY]] object stores available information about a table. To access this information, you mainly have to give the table name and load the table description:
|
||||||
<code>
|
<code>
|
||||||
repository: DB_REPOSITORY
|
repository: DB_REPOSITORY
|
||||||
...
|
|
||||||
create repository.make ("CONTACTS")
|
...
|
||||||
repository.load
|
|
||||||
if repository.exists then
|
create repository.make ("CONTACTS")
|
||||||
...
|
repository.load
|
||||||
end
|
if repository.exists then
|
||||||
|
...
|
||||||
|
end
|
||||||
</code>
|
</code>
|
||||||
|
|
||||||
|
|
||||||
@@ -26,20 +28,20 @@ A [[ref:/libraries/store/reference/db_repository_flatshort|DB_REPOSITORY]] obje
|
|||||||
Using the table information, [[ref:/libraries/store/reference/db_repository_flatshort|DB_REPOSITORY]] then helps generating Eiffel classes mapping relational tables:
|
Using the table information, [[ref:/libraries/store/reference/db_repository_flatshort|DB_REPOSITORY]] then helps generating Eiffel classes mapping relational tables:
|
||||||
* You can directly use {[[ref:/libraries/store/reference/db_repository_flatshort|DB_REPOSITORY]] }.generate_class. Generated class may look like:
|
* You can directly use {[[ref:/libraries/store/reference/db_repository_flatshort|DB_REPOSITORY]] }.generate_class. Generated class may look like:
|
||||||
<code>
|
<code>
|
||||||
class CONTACTS
|
class CONTACTS
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
id: INTEGER
|
id: INTEGER
|
||||||
...
|
...
|
||||||
feature -- Settings
|
feature -- Settings
|
||||||
|
|
||||||
set_id (an_id: INTEGER)
|
set_id (an_id: INTEGER)
|
||||||
-- Set an_id to id.
|
-- Set an_id to id.
|
||||||
do
|
do
|
||||||
id := an_id
|
id := an_id
|
||||||
end
|
end
|
||||||
...
|
...
|
||||||
</code>
|
</code>
|
||||||
|
|
||||||
|
|
||||||
@@ -53,33 +55,37 @@ Using the table information, [[ref:/libraries/store/reference/db_repository_flat
|
|||||||
* a class mapping the relational table.
|
* a class mapping the relational table.
|
||||||
This is straight-forward since you only have to give [[ref:/libraries/store/reference/db_store_flatshort|DB_STORE]] the object filled with the table values. Suppose you want to add a contact into your database:
|
This is straight-forward since you only have to give [[ref:/libraries/store/reference/db_store_flatshort|DB_STORE]] the object filled with the table values. Suppose you want to add a contact into your database:
|
||||||
<code>
|
<code>
|
||||||
storage: DB_STORE
|
storage: DB_STORE
|
||||||
contacts_rep: DB_REPOSITORY
|
contacts_rep: DB_REPOSITORY
|
||||||
a_contact: CONTACTS
|
a_contact: CONTACTS
|
||||||
...
|
|
||||||
create storage.make
|
...
|
||||||
-- contacts_rep is loaded and exists.
|
|
||||||
storage.set_repository (contacts_rep)
|
create storage.make
|
||||||
-- a_contact carries values to insert into the database.
|
-- contacts_rep is loaded and exists.
|
||||||
storage.put (a_contact)
|
storage.set_repository (contacts_rep)
|
||||||
|
-- a_contact carries values to insert into the database.
|
||||||
|
storage.put (a_contact)
|
||||||
</code>
|
</code>
|
||||||
|
|
||||||
==Accessing database content with Eiffel objects==
|
==Accessing database content with Eiffel objects==
|
||||||
|
|
||||||
[[ref:/libraries/store/reference/db_selection_flatshort|DB_SELECTION]] lets you map data retrieved from the database into Eiffel objects: Result column names must match object attributes names so you can use for instance classes created by [[ref:/libraries/store/reference/db_repository_flatshort|DB_REPOSITORY]] . Class <eiffel>DB_ACTION</eiffel> redefines ACTION and can be used to retrieve Eiffel objects directly into an ARRAYED_LIST:
|
[[ref:/libraries/store/reference/db_selection_flatshort|DB_SELECTION]] lets you map data retrieved from the database into Eiffel objects: Result column names must match object attributes names so you can use for instance classes created by [[ref:/libraries/store/reference/db_repository_flatshort|DB_REPOSITORY]] . Class <eiffel>DB_ACTION</eiffel> redefines ACTION and can be used to retrieve Eiffel objects directly into an ARRAYED_LIST:
|
||||||
<code>
|
<code>
|
||||||
selection: DB_SELECTION
|
selection: DB_SELECTION
|
||||||
list_filling: DB_ACTION [CONTACTS]
|
list_filling: DB_ACTION [CONTACTS]
|
||||||
contact: CONTACTS
|
contact: CONTACTS
|
||||||
...
|
|
||||||
selection.object_convert (contact)
|
...
|
||||||
create list_filling.make (selection, contact)
|
|
||||||
selection.set_action (list_filling)
|
selection.object_convert (contact)
|
||||||
...
|
create list_filling.make (selection, contact)
|
||||||
selection.load_result
|
selection.set_action (list_filling)
|
||||||
if selection.is_ok then
|
...
|
||||||
Result := list_filling.list
|
selection.load_result
|
||||||
end
|
if selection.is_ok then
|
||||||
|
Result := list_filling.list
|
||||||
|
end
|
||||||
</code>
|
</code>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user