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

Reply via email to