> So my question is : how to create a table in which rows (keywords)
> could contain variable type and number of data ?

You cannot create table containing variable number of data values - it
contradicts relational data model. You can either create 2 tables -
one containing keywords, another all values for them (one value per
row) or if you know maximum amount of values for each keyword you can
create table with this maximum amount of values in it and treat for
example NULL values as no value.

SQLite will be happy to get any data type from you to insert into the
table - it doesn't impose any restrictions on that although you
declare some "type" in table definition. But this "type" defines only
affinity of the column which defines what automatic type conversions
SQLite will try to make. In case of failed automatic conversion or in
case of no affinity of the column (that can be made if column has no
"type" or "type" string contains word "blob") SQLite will store your
data type as is. You need just not to fall in the trap when you
retrieve this data and be careful to retrieve exactly the type stored.


Pavel

On Thu, Jan 21, 2010 at 10:55 AM, newlog <[email protected]> wrote:
>
> Hi ,
>
> I'm planning to use SQLite as a replacement of an home made data
> storage file format.
>
> In the current home made format, I use keywords followed by strings or
> floats .
> The issue is that number and type of data vary from one keyword to the
> other:
>
> Example :
>
> Keyword-01    Foo  12.007   Bar  24.9682
> Keyword-02    64738 65535 12.12   3.1415   2.71    0.007
> Keyword-03    SingleString
> ...
>
> So my question is : how to create a table in which rows (keywords)
> could contain variable type and number of data ?
>
> Thanx for your help !
>
> Olivier
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to