VirtualLife
Posts: 13
Joined: Mon Apr 29, 2013 11:38 pm

Data Manipulation on the Pi in c++

Sat Aug 10, 2013 8:28 pm

Building a fairly complex project and debating on a couple options. I'm from a .net background, so don't know many of the limitations the RaPi and c++ will have.

I need to store and manipulate fairly small sets of data (~20k rows) and am debating between XML and MySql.

MySql will have a lot more disk IO than xml and being a SSD that concerns me considering I am planning on making this into a commercial product.

Xml, what library should I use? Can it do averages and other aggregate functions like what can be done in .net? I haven't been able to find any examples of anything more than just reading a node.

Thanx ahead of time.

ejames
Posts: 15
Joined: Thu Feb 02, 2012 1:19 pm

Re: Data Manipulation on the Pi in c++

Wed Aug 14, 2013 2:47 pm

Do you really need a fully fledged sql database ? If it's meant to be a commercial product that means that people will have to install mysql as well. Is it meant to be a client-server application ?
Why not just use a vector of a class you define which has the required fields ? You can then use the boost serilaization library for persistence. You will also be able to use the stl algorithms to calculate averages, standard deviations etc.
XML is pretty much dead anyway...everyone is using json these days.

OtherCrashOverride
Posts: 582
Joined: Sat Feb 02, 2013 3:25 am

Re: Data Manipulation on the Pi in c++

Wed Aug 14, 2013 4:41 pm

I would recommend Sqlite. You can create in-memory databases (http://www.sqlite.org/inmemorydb.html) that cause no disk I/O. The database can then be saved and loaded from sd-card (http://www.sqlite.org/backup.html). Additionally, you have the SQL aggregate functions available (http://www.sqlite.org/lang_aggfunc.html).

VirtualLife
Posts: 13
Joined: Mon Apr 29, 2013 11:38 pm

Re: Data Manipulation on the Pi in c++

Fri Aug 16, 2013 1:10 am

Thanx OtherCrashOverride, that's exactly what I need. Surprised I haven't heard of it before.

@ejames XML is far from dead, I unfortunately have to deal with it regularly.

Return to “C/C++”