Mark Richards <[EMAIL PROTECTED]>
wrote:
Ha!  Good question.  I suppose this has already been broached when the
design of sqlite3_get_table was addressed.  My first thought would be
to pass sqlite3_get_table a structure that represents the table in
field-order.  ie:

CREATE TABLE sequence (seq_nr INTEGER NOT NULL PRIMARY KEY, seq_family
INTEGER, enable INTEGER, verb TEXT(80));

typedef struct _sequence
{
    int seq_nr;
    int seq_family;
    int enable;
    char text[16];
} sequence[10];

That woudn't work too well with SQLite's manifest typing. I can't help but notice that verb field is declared as TEXT(80) in the database, but char[16] in your structure. But recall that SQLite ignores these length restrictions and allows any field to hold an arbitrarily long string (and indeed a value of any other type).

I also wonder how you plan to represent NULL values.

You are trying to design an object-relational mapping (ORM). There are quite a few ORM products around, you don't need to reinvent one.

In C is there such a thing as a structure created dynamically (at
runtime)?

If you mean structure the type, then no - C is a statically typed language. If you mean an instance of a structure, then of course you can allocate one on the heap.

Igor Tandetnik

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to