I\'m creating application in C++ and found out that storing information in XML f
ID: 639687 • Letter: I
Question
I'm creating application in C++ and found out that storing information in XML file was very prodigally. Despite the possibility to read it without any specific application, random access via DOM or VTD library and possibility to backup by simple copying XML file, it's very RAM-expensive (even while using VTD it's necessary 17GB of RAM). Now, there are 12000 entries and I'm planning to store up to million ones. Each entry contains 37 fields (now, maybe more in future) with different types: string, double, float and 128-bit float. These fields are distributed into 5 groups (hierarchy which is possible by XML tags). I tried to find something more productive with the same benefits. Unfortunately, googling didn't help me because there are so many DBs and DBMSs that I'm totally confused.
The XML file structure:
<paient>
<analysis name="">
<result type="">some_data</result>
</analysis>
<diagnosis>
<preliminary></preliminary>
<final></final>
<diagnosis>
...
<patient>
So could advise me a solution for my problem?
Explanation / Answer
If your application is local (doesn't support remote access) you could use an embedded DB engine.
It gives you the easy installation and independence from other installed programs. So you need to choose the appropriate library. What to look for when choosing?
As I said, the library should be embedded. It lets you create the single executable file without any difficult configurations.
The library should support C/C++ to integrate with your existing code.
The library should be well-known and widely-used. It ensures the most terrible errors have been discovered and fixed already.
It's optional, but it would be cool if you could write SQL queries.
It's optional, but... open-source!
Well, what's the choice?
I propose to pay attention to SQLite and Berkeley DB. Both are embedded, both are open-source, both supports C/C++ (also Java, Python, etc.)
SQLite is a relational DB engine, since Berkeley DB is not. My opinion, SQLite is quite easier to learn, but I could be wrong.
Try both. Use the one that will work earlier.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.