www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - persistence, serialization, history (run-to-run) in small

reply dan <dan.hitt gmail.com> writes:
I'm writing a small program (compiled with gdc on xubuntu 16.04).

I would like it to remember a little data (a few kilobytes maybe).

It looks like d comes with standard support for both sqlite3 and 
json --- is there any particular reason to prefer one over the 
other?   Or maybe something else entirely? (In each case, i would 
store the data in some file, and on second and subsequent runs of 
the program attempt to recover the data from that file if 
possible.)

My main concern is minimizing program complexity.

TIA for any advice.

dan
Jul 13 2016
next sibling parent rikki cattermole <rikki cattermole.co.nz> writes:
On 14/07/2016 5:18 PM, dan wrote:
 I'm writing a small program (compiled with gdc on xubuntu 16.04).

 I would like it to remember a little data (a few kilobytes maybe).

 It looks like d comes with standard support for both sqlite3 and json
 --- is there any particular reason to prefer one over the other?   Or
 maybe something else entirely? (In each case, i would store the data in
 some file, and on second and subsequent runs of the program attempt to
 recover the data from that file if possible.)

 My main concern is minimizing program complexity.

 TIA for any advice.

 dan
Well both are fairly complex formats, so really depends on what you need to store.
Jul 13 2016
prev sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2016-07-14 07:18, dan wrote:
 I'm writing a small program (compiled with gdc on xubuntu 16.04).

 I would like it to remember a little data (a few kilobytes maybe).

 It looks like d comes with standard support for both sqlite3 and json
 --- is there any particular reason to prefer one over the other?   Or
 maybe something else entirely? (In each case, i would store the data in
 some file, and on second and subsequent runs of the program attempt to
 recover the data from that file if possible.)

 My main concern is minimizing program complexity.
There's Orange [1]. It's a serialization library that serializes to XML. [1] https://github.com/jacob-carlborg/orange -- /Jacob Carlborg
Jul 14 2016
parent reply dan <dan.hitt gmail.com> writes:
On Thursday, 14 July 2016 at 08:28:56 UTC, Jacob Carlborg wrote:
 On 2016-07-14 07:18, dan wrote:
 I'm writing a small program (compiled with gdc on xubuntu 
 16.04).

 I would like it to remember a little data (a few kilobytes 
 maybe).
.....
 My main concern is minimizing program complexity.
There's Orange [1]. It's a serialization library that serializes to XML. [1] https://github.com/jacob-carlborg/orange
Thanks Jacob! I was unaware of Orange. rikki --- Thanks also for your remarks. Although in principle both sql and json are complex, they are familiar, so if they work as in other languages i'm hoping (knock on wood) they won't seem complex. As to what i'm storing, it's a little indefinite now, but will include strings and times.
Jul 14 2016
parent Jacob Carlborg <doob me.com> writes:
On 2016-07-15 04:17, dan wrote:

 Thanks Jacob!

 I was unaware of Orange.
Available on Dub now as well: https://code.dlang.org/packages/orange -- /Jacob Carlborg
Jul 15 2016