Thread overview | |||||
---|---|---|---|---|---|
|
September 22, 2002 Persisten Associative Arrays | ||||
---|---|---|---|---|
| ||||
Hi, I really like the associative arrays of D. IMO a very useable addition. I wouldl like to use this method for database applications. For this I have some questions: 1. Does anybody know how to serialize such an array to harddisk, so that I can later load it again? Any ideas how this could be done? 2. As long as I can have everything in memory using the associative arrays is not problem. But how could a system look like that needs to read, update, delete data from a file? Any information is welcome. -- Robert M. Münch IT & Management Freelancer Mobile: +49 (0)177 2452 802 Fax : +49 (0)721 8408 9112 Web : http://www.robertmuench.de |
September 26, 2002 Re: Persisten Associative Arrays | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robert M. Münch | "Robert M. Münch" <robert.muench@robertmuench.de> wrote in message news:amkmhq$1vod$1@digitaldaemon.com... > Hi, I really like the associative arrays of D. IMO a very useable addition. > I wouldl like to use this method for database applications. For this I have > some questions: > > 1. Does anybody know how to serialize such an array to harddisk, so that I can later load it again? Any ideas how this could be done? The only way at the moment would be to convert it to an array and then loop through the array, see the wc.d example for how to do this. > 2. As long as I can have everything in memory using the associative arrays is not problem. But how could a system look like that needs to read, update, > delete data from a file? The current design isn't set up for that, and it would be a hard problem to transform it to. The best way at the moment is just serialize it as an array for transfer to/from the disk. |
September 30, 2002 Re: Persisten Associative Arrays | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | Maintain an index in memory, and use that to access disk locations on demand. The memory footprint of the index will be much smaller than the actual data. All you need as entries are begin/end file offsets associated with the data on disk. The index can be implemented as an associative array.
If you are into really heavy-duty requirements then use Postgresql and interface it to D.
Mark
>> 2. As long as I can have everything in memory using the associative arrays is not problem. But how could a system look like that needs to read,
>update,
>> delete data from a file?
>
>The current design isn't set up for that, and it would be a hard problem to transform it to. The best way at the moment is just serialize it as an array for transfer to/from the disk.
>
>
|
Copyright © 1999-2021 by the D Language Foundation