Actually Tim that is not what I was asking at all. This is converting an application from using MySQL to SQLite. All the tables are normalized already. But instead of rewriting a large chunk of the application, I'd rather use the implementation as is substituting only the code needed to use SQLite instead of MySQL.
The various structs are not intermingled and in fact many do not share data at all. My concern was being able to use existing code to iterate through the columns of each row and assign the values into a chunk of memory (representing a particular struct) while faithfully retaining the size of each variable in the struct. As such, the suggestion to use sqlite3_column_decltype seems most appropriate to accomplish the task. Because then I can check for SQLITE_INTEGER as the type and get the decltype to find out what size. Thus, the function called remains generic to any given struct, but still assigns values that are the correct size & type to the chunk of memory. ________________________________ From: Tim Romano <tim.romano...@gmail.com> To: General Discussion of SQLite Database <sqlite-users@sqlite.org> Sent: Tue, March 30, 2010 7:28:16 AM Subject: Re: [sqlite] Preserving column size On Tue, Mar 30, 2010 at 4:30 AM, Jean-Denis Muys <jdm...@kleegroup.com>wrote: > > <snip> > See http://www.boost.org and more specifically: > http://www.boost.org/doc/libs/1_42_0/libs/serialization/doc/index.html > <snip> > The OP's question is another form of this question: What's the best way to violate 1NF in SQLite, so that instead of defining multiple tables, a single table will contain multiple actual or virtual column sets where these column sets have different numbers of columns and different combinations of datatypes? And I must be able to query the store. We have three "conceptually similar" serialization approaches (BLOB, JSON, BOOST). But the OP could also store in the following manner and not violate 1NF: Table: STRUCT id INTEGER PRIMARY KEY structname TEXT [...any other attributes that need to be tracked] Table: STRUCTMEMBERS id INTEGER PRIMARY KEY structid INTEGER (FK references STRUCT) membername TEXT memberdatatype TEXT membervalue TEXT casting 'membervalue' as appropriate during the reconstitution phase. Regards Tim Romano _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users