On Sep 21, 2006, at 7:18 AM, Narendran wrote:
as far as my knowledge SQLITE allows me to declare the column types
suppoted by the programming languare or say i am using blob . My
requirement
is i wish to store a structure in the SQLite column.
Instead of storing the structure in a single column, create a
separate table to represent the structure, and then use a column to
reference a row in that table via a foreign key.
Given the extremely lightweight nature of the structure that you
later posted:
typedef struct ethernetcard1
{
char port[10];
char ipaddress[20];
char mask[20];
int bandwidth;
}
as well as the fact that sooner or later you're likely to want to
query on it, you may as well just store it as real data rather than
as a BLOB:
CREATE TABLE 'ETHERNETCARD' (
ID INTEGER PRIMARY KEY, -- SQLite does this implicitly as ROWID
PORT VARCHAR(10),
IPADDRESS VARCHAR(20),
MASK VARCHAR(20),
BANDWIDTH INTEGER
);
Of course, you might also want to encode your IP address and netmask
into network-byte-order integers rather than store them as strings,
but I think the above gives you an idea of what I mean. And if
"port" refers to a physical port name (such as "en1") you might even
want to have a separate table for ports, and have the port column
just contain a foreign key referencing that table...
If you start to decompose your use of SQLite in this fashion, you'll
actually be using the database *as* a database, and you'll be much
better able to leverage it to do new and interesting things in the
future.
-- Chris
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------