0

I need to store and load some data in a C++ application. This data is basically going to end up as a set of tables as per a relational database.

I write the data to tables using something like csv format, then parse them myself and apply the database logic I need in my C++ code. But it seems stupid to reinvent the wheel with this and end up effectively writing my own database engine.

However, using something like a MySQL database seems like massive overkill for what is going to be a single user local system. I have tried setting up a MySQL daemon on my Windows system and I found it rather complex and possibly even impossible without admin privileges. It would be a serious obstacle to deployment as it would need each user's system to have MySQL set up and running.

Is there a reasonable middle ground solution? Something that can provide me with a simple database, accessible from C++, without all the complexities of setting up a full MySQL install?


NB. I have edited this question such that I hope it satisfies those who have voted to close the question. I am not asking for a recommendation for a tool, or someone's favourite tool or the best tools. That would be asking which database engine should I use. I am asking for what tools and design patterns are available to solve a specific programming problem - i.e. how can I get access to database like functionality from a C++ program, without writing my own database engine, nor setting up a full database server. This is conceptually no different to asking e.g. How do I print out the contents of a vector? - it's just a bigger problem. I have described the problem and what has been done so far to solve it. My understanding from the On Topic Page is that this is within scope.

Phil Rosenberg
  • 1,597
  • 1
  • 14
  • 22

1 Answers1

1

You can try sqlite.

Here are some simple code examples: https://www.tutorialspoint.com/sqlite/sqlite_c_cpp.htm

Boris Hu
  • 202
  • 1
  • 6
  • Tool etc suggestions are explicitly off-topic. [ask] [help] – philipxy Feb 15 '22 at 23:01
  • @philipxy I could not see anywhere in your links that tool suggestions are off topic. In fact [what topic can I ask about here?](https://stackoverflow.com/help/on-topic) states that "tools commonly used by programmers" is on topic. I asked a specific code design and data storage format question and got an excellent answer which addressed my needs. This was a "what tool would be suitable for this task" question, not a "what is your opinion on this tool" or "what is your favourite tool" question. – Phil Rosenberg Feb 16 '22 at 14:51
  • [help/on-topic] "Some questions that fit into one of the categories listed above may be closed by the community because they aren't generally a good fit here or need additional information:" "3. Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." You can google usage questions at [meta] & [meta.se] using 'site:' & read the help links including the [so] FAQ. – philipxy Feb 16 '22 at 21:50
  • I don't feel that this question falls into this category as I have "described the problem and what has been done so far to solve it". the problem being - I need a simple database system I can access from C++, and what has been done so far is to try and set up a full mySQL database server daemon on my system and found it to be way too complex for deployment. I've edited my question specifically to try and make this clearer and address your concerns. – Phil Rosenberg Feb 18 '22 at 13:01