On Mon, Mar 29, 2010 at 4:14 PM, Tim Romano <tim.romano...@gmail.com> wrote: > On Mon, Mar 29, 2010 at 4:19 PM, Kevin M. <athlo...@yahoo.com> wrote: > >> I have a C/C++ application in which I want to store data from a struct into >> a table (using SQLite 3.6.23) and later retrieve data from the table and >> store it back in the struct. But, I need a general interface for this as >> there are many types of structs used. > > > You could convert the structs to JSON format and store them in a TEXT > field. > There are a number of C++ JSON libraries listed here: http://www.json.org/ >
This is probably the best way forward, however, conceptually it is no different from just storing the struct as a blob, something that Igor already suggested. The OP won't be able to retrieve a specific member of the struct directly. He will have to retrieve the entire value, reconstruct the struct in his application, then retrieve the value that he wants. May as well store is as a blob and be done with it. I have done both -- stored a perl data structure as a JSON string, as well as a blob using Storable (a core perl module). Works very well. > Regards > Tim Romano > P.S. Apologies if this reply comes through twice -- I resubscribed under a > new email address but replied under the old address. > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- Puneet Kishor http://www.punkish.org Carbon Model http://carbonmodel.org Charter Member, Open Source Geospatial Foundation http://www.osgeo.org Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor Nelson Institute, UW-Madison http://www.nelson.wisc.edu ----------------------------------------------------------------------- Assertions are politics; backing up assertions with evidence is science ======================================================================= _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users