mirror of
https://github.com/EiffelSoftware/eiffel-org.git
synced 2025-12-07 07:12:25 +01:00
Author:halw
Date:2008-12-07T17:38:05.000000Z git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@127 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
* Fixed missing detection of VREG and VRFT errors for labels of a named tuples which is used as an actual generic parameter of a type (fixes eweasel test#tuple012 and test#tuple013), thus some of your code might be broken since the compiler failed to check this before.
|
* Fixed missing detection of VREG and VRFT errors for labels of a named tuples which is used as an actual generic parameter of a type (fixes eweasel test#tuple012 and test#tuple013), thus some of your code might be broken since the compiler failed to check this before.
|
||||||
* Fixed eweasel test#valid222 where compiler properly detects VDRS-4 errors when you redefine a repeatedly inherited routine in at least one but not all branches, but fail to provide a local definition.
|
* Fixed eweasel test#valid222 where compiler properly detects VDRS-4 errors when you redefine a repeatedly inherited routine in at least one but not all branches, but fail to provide a local definition.
|
||||||
* Now a formal generic parameter only conforms to a formal generic parameter, that is to say assignment to a formal generic parameter where the source is of type NONE (i.e <eiffel>Void</eiffel>) will now be rejected by the compiler.
|
* Now a formal generic parameter only conforms to a formal generic parameter, that is to say assignment to a formal generic parameter where the source is of type NONE (i.e <eiffel>Void</eiffel>) will now be rejected by the compiler.
|
||||||
|
* Dropped support for older Microsoft C/C++ compilers on Windows platforms. We only support VS 2005 or greater.
|
||||||
|
|
||||||
==Bug fixes==
|
==Bug fixes==
|
||||||
|
|
||||||
|
|||||||
@@ -8,19 +8,23 @@ Use the [[ref:/libraries/store/reference/db_change_flatshort|DB_CHANGE]] class
|
|||||||
[[ref:/libraries/store/reference/db_change_flatshort|DB_CHANGE]] allows you to modify the database data using the SQL language:
|
[[ref:/libraries/store/reference/db_change_flatshort|DB_CHANGE]] allows you to modify the database data using the SQL language:
|
||||||
* Prepare your SQL query and use modify:
|
* Prepare your SQL query and use modify:
|
||||||
<code>
|
<code>
|
||||||
modification: DB_CHANGE
|
modification: DB_CHANGE
|
||||||
-- Modification tool.
|
-- Modification tool.
|
||||||
...
|
|
||||||
create modification.make
|
...
|
||||||
modification.modify ("Update CONTACTS set Firstname = ' John'")
|
|
||||||
|
create modification.make
|
||||||
|
modification.modify ("Update CONTACTS set Firstname = ' John'")
|
||||||
</code>
|
</code>
|
||||||
|
|
||||||
* Commit your changes with your session control:
|
* Commit your changes with your session control:
|
||||||
<code>
|
<code>
|
||||||
session_control: DB_CONTROL
|
session_control: DB_CONTROL
|
||||||
-- Session control.
|
-- Session control.
|
||||||
...
|
|
||||||
session_control.commit
|
...
|
||||||
|
|
||||||
|
session_control.commit
|
||||||
</code>
|
</code>
|
||||||
|
|
||||||
{{tip|It is always better to check the database status for errors before committing changes. }}
|
{{tip|It is always better to check the database status for errors before committing changes. }}
|
||||||
|
|||||||
@@ -8,11 +8,14 @@ Use the [[ref:/libraries/store/reference/db_selection_flatshort|DB_SELECTION]]
|
|||||||
[[ref:/libraries/store/reference/db_selection_flatshort|DB_SELECTION]] enables your application to get database content using SQL 'select' queries:
|
[[ref:/libraries/store/reference/db_selection_flatshort|DB_SELECTION]] enables your application to get database content using SQL 'select' queries:
|
||||||
* You can carry out 'select' queries in an intuitive way using directly the SQL language:
|
* You can carry out 'select' queries in an intuitive way using directly the SQL language:
|
||||||
<code>
|
<code>
|
||||||
selection: DB_SELECTION
|
selection: DB_SELECTION
|
||||||
...
|
-- Selection tool
|
||||||
create selection.make
|
|
||||||
selection.set_query ("select * from CONTACTS where firstname = 'John'")
|
...
|
||||||
selection.execute
|
|
||||||
|
create selection.make
|
||||||
|
selection.set_query ("select * from CONTACTS where firstname = 'John'")
|
||||||
|
selection.execute
|
||||||
</code>
|
</code>
|
||||||
|
|
||||||
{{tip|Always check the database status for errors after your 'select' query. }}
|
{{tip|Always check the database status for errors after your 'select' query. }}
|
||||||
|
|||||||
@@ -15,31 +15,36 @@ To use DB_RESULT, process in 2 steps:
|
|||||||
[[ref:/libraries/store/reference/db_selection_flatshort|DB_SELECTION]] class provides different ways to customize result loading:
|
[[ref:/libraries/store/reference/db_selection_flatshort|DB_SELECTION]] class provides different ways to customize result loading:
|
||||||
* You want to access an '''unique''' row: [[ref:/libraries/store/reference/db_result_flatshort|DB_RESULT]] object is accessible via cursor:
|
* You want to access an '''unique''' row: [[ref:/libraries/store/reference/db_result_flatshort|DB_RESULT]] object is accessible via cursor:
|
||||||
<code>
|
<code>
|
||||||
selection: DB_SELECTION
|
selection: DB_SELECTION
|
||||||
my_result: DB_RESULT
|
my_result: DB_RESULT
|
||||||
...
|
|
||||||
selection.query ("...")
|
...
|
||||||
if selection.is_ok then
|
|
||||||
selection.load_result
|
selection.query ("...")
|
||||||
my_result := selection.cursor
|
if selection.is_ok then
|
||||||
end
|
selection.load_result
|
||||||
|
my_result := selection.cursor
|
||||||
|
end
|
||||||
</code>
|
</code>
|
||||||
|
|
||||||
* You want to load a '''complete list''' of rows: [[ref:/libraries/store/reference/db_selection_flatshort|DB_SELECTION]] can store [[ref:/libraries/store/reference/db_result_flatshort|DB_RESULT]] objects in a list. To do this, you have mainly to provide a LIST object to DB_SELECTION with set_container:
|
* You want to load a '''complete list''' of rows: [[ref:/libraries/store/reference/db_selection_flatshort|DB_SELECTION]] can store [[ref:/libraries/store/reference/db_result_flatshort|DB_RESULT]] objects in a list. To do this, you have mainly to provide a LIST object to DB_SELECTION with set_container:
|
||||||
<code>
|
<code>
|
||||||
selection: DB_SELECTION
|
selection: DB_SELECTION
|
||||||
container: ARRAYED_LIST [DB_RESULT]
|
container: ARRAYED_LIST [DB_RESULT]
|
||||||
create container.make (Max_results)
|
|
||||||
...
|
...
|
||||||
selection.set_container (container)
|
|
||||||
...
|
create container.make (Max_results)
|
||||||
from
|
...
|
||||||
container.start
|
selection.set_container (container)
|
||||||
until
|
...
|
||||||
container.after
|
from
|
||||||
loop
|
container.start
|
||||||
...
|
until
|
||||||
end
|
container.after
|
||||||
|
loop
|
||||||
|
...
|
||||||
|
end
|
||||||
</code>
|
</code>
|
||||||
|
|
||||||
{{tip|Provide [[ref:/libraries/store/reference/db_selection_flatshort|DB_SELECTION]] with the LIST structure convenient for what you need to do with the results. }}
|
{{tip|Provide [[ref:/libraries/store/reference/db_selection_flatshort|DB_SELECTION]] with the LIST structure convenient for what you need to do with the results. }}
|
||||||
@@ -47,34 +52,40 @@ To use DB_RESULT, process in 2 steps:
|
|||||||
* You want to '''select part''' of the result set: you can set an action in [[ref:/libraries/store/reference/db_selection_flatshort|DB_SELECTION]] that will be executed each time a row is loaded. This action can for instance manipulate current row and define a stop condition.
|
* You want to '''select part''' of the result set: you can set an action in [[ref:/libraries/store/reference/db_selection_flatshort|DB_SELECTION]] that will be executed each time a row is loaded. This action can for instance manipulate current row and define a stop condition.
|
||||||
** You need to define a descendant of class ACTION and set it to [[ref:/libraries/store/reference/db_selection_flatshort|DB_SELECTION]] :
|
** You need to define a descendant of class ACTION and set it to [[ref:/libraries/store/reference/db_selection_flatshort|DB_SELECTION]] :
|
||||||
<code>
|
<code>
|
||||||
class
|
class
|
||||||
MY_ACTION
|
MY_ACTION
|
||||||
inherit
|
inherit
|
||||||
ACTION
|
ACTION
|
||||||
redefine
|
redefine
|
||||||
execute, found
|
execute, found
|
||||||
end
|
end
|
||||||
|
|
||||||
...
|
...
|
||||||
execute
|
|
||||||
do
|
execute
|
||||||
i := i + 1
|
do
|
||||||
end
|
i := i + 1
|
||||||
...
|
end
|
||||||
found: BOOLEAN
|
|
||||||
do
|
...
|
||||||
Result := i >= Max_result
|
|
||||||
end
|
found: BOOLEAN
|
||||||
|
do
|
||||||
|
Result := i >= Max_result
|
||||||
|
end
|
||||||
</code>
|
</code>
|
||||||
** Then set action to [[ref:/libraries/store/reference/db_selection_flatshort|DB_SELECTION]] :
|
** Then set action to [[ref:/libraries/store/reference/db_selection_flatshort|DB_SELECTION]] :
|
||||||
<code>
|
<code>
|
||||||
selection: DB_SELECTION
|
selection: DB_SELECTION
|
||||||
action: MY_ACTION
|
action: MY_ACTION
|
||||||
...
|
|
||||||
selection.set_action (action)
|
...
|
||||||
selection.query ("...")
|
|
||||||
if selection.is_ok then
|
selection.set_action (action)
|
||||||
selection.load_result
|
selection.query ("...")
|
||||||
end
|
if selection.is_ok then
|
||||||
|
selection.load_result
|
||||||
|
end
|
||||||
</code>
|
</code>
|
||||||
|
|
||||||
|
|
||||||
@@ -83,14 +94,16 @@ To use DB_RESULT, process in 2 steps:
|
|||||||
|
|
||||||
A DB_RESULT object merely carries data retrieved from the database. You have to convert it to a DB_TUPLE to access data within the retrieved row conveniently, i.e. mostly the column values:
|
A DB_RESULT object merely carries data retrieved from the database. You have to convert it to a DB_TUPLE to access data within the retrieved row conveniently, i.e. mostly the column values:
|
||||||
<code>
|
<code>
|
||||||
selection: DB_SELECTION
|
selection: DB_SELECTION
|
||||||
tuple: DB_TUPLE
|
tuple: DB_TUPLE
|
||||||
...
|
|
||||||
create tuple
|
...
|
||||||
tuple.copy (selection.cursor)
|
|
||||||
if tuple.count >= 2 and then tuple.column_name (2).is_equal ("Firstname") then
|
create tuple
|
||||||
io.putstring (tuple.item (2).out)
|
tuple.copy (selection.cursor)
|
||||||
end
|
if tuple.count >= 2 and then tuple.column_name (2).is_equal ("Firstname") then
|
||||||
|
io.putstring (tuple.item (2).out)
|
||||||
|
end
|
||||||
</code>
|
</code>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user