Persistence 
Author Message
 Persistence

Hello,

can someone post a litle example how to
use persistence in Eiffel.

thanks, MikeR



Sun, 28 Mar 2004 04:14:43 GMT  
 Persistence


Quote:
> Hello,

> can someone post a litle example how to
> use persistence in Eiffel.

You can utilise class STORABLE or you can in ISE Eiffel use EiffelStore e.g.
with Matisse (OODBMS) or you could use ECLI, an open source implementation
of the Call Level Interface (aka ODBC) or.....

Quote:

> thanks, MikeR

-- eirik


Sun, 28 Mar 2004 13:59:43 GMT  
 Persistence

Quote:

> Hello,

> can someone post a litle example how to
> use persistence in Eiffel.

Well it should work on any ELKS compliant compiler I'm not sure if
SmallEiffel provides a STORABLE class but here's an example using
ISE-Eiffel

class PERSISTENT_ARRAY[G]

inherit
    STORABLE
        undefine
            -- have used undefine freely here, may be not a good idea...
            consistent, is_equal, copy, setup
        end
    ARRAY[G]
        rename
            make as array_make
        end;

creation
    make

feature
    make (minindex, maxindex : INTEGER) is
        do
            array_make(minindex, maxindex);
        end;

end

class PERSISTENCE_TEST

creation
    make

feature
    file_name : STRING is "array_storage";

    a_arr : PERSISTENT_ARRAY[INTEGER] is
        once
            !!Result.make(1,3);
            Result.put(1,1);
            Result.put(2,2);
            Result.put(3,3);
        end;

    b_arr : PERSISTENT_ARRAY[INTEGER];

    make is
        do
            print ("a_arr = ")
            print (a_arr);

            print ("%Nb_arr = ")
            print (b_arr);
            -- now write a_arr to disk;

            a_arr.store_by_name(file_name);

            -- retrieve the persistent representaion from a file

            b_arr ?= a_arr.retrieve_by_name(file_name);
            if b_arr /= Void then

                print ("%Na_arr still = ");
                print (a_arr);
                print ("%Nb_arr now = ");
                print (b_arr);
                print ('%N');
            else
                io.put_string("Has not worked%N");
            end;

        end;

end -- class PERSITENZ_TEST;

I hope this helps a bit.
Friedrich



Sun, 28 Mar 2004 14:27:38 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Voss 3.0 - Persistence and Transaction Processing

2. Voss 3.0 - Persistence & Transactions - Free Evaluation

3. Object Persistence (OODBMS alike) for Smalltalk

4. Voss 3.0 - Persistence and Transaction Proceessing

5. Data persistence - JDO?

6. Persistence in Smalltalk

7. smalltalk or python for persistence-based app?

8. RFI on Tools for Persistence

9. VOSS object persistence

10. Basic database/object persistence needed (VW 2.0)

11. NYSTUG meeting 10/21 - Featuring: Persistence and Object Transactions + PocketST

12. Persistence Frameworks/mechanisms

 

 
Powered by phpBB® Forum Software