> Do you expect sqlite3_get_table to look at char*** pointer and somehow
> guess that it's a structure, and figure out types of individual
> fields? How would you go about implementing something like that?

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];

Then when each row is parsed each column is populated into the associated structure element based on the field type of the column. sqlite ought to know that as it's likely an internal value.

I've already written a function like this that works with sqlite_exec to a callback. Packaging it in sqlite3_get_table would simplify some tasks but clearly wouldn't offer a generic solution (you'd have to create a structure for each table you want to get, and make sure that your SELECT statement will generate the columns in the order of your structure).

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

--

I'll have a look at sqlite3_prepare, sqlite3_step and sqlite3_column_


/m




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

Reply via email to