Andreas Volz wrote:
Hello,
It's simple to the the maximum number of rows in a table with
SELECT count(*) FROM table
But how to find out the number of columns for a query like:
SELECT * FROM table
My practical problem is the read callback function:
int readCallback (void *data, int argc, char **argv,
char **azColName)
{
int i;
for(i=0; i<argc; i++)
{
printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
}
printf("\n");
return 0;
}
What if I like e.g. to write each table row into a file in one line? I
need to know when a row is finished and the next begins. I could
compare azColName, but I hope there is a better way.
Andreas,
Your readCallback function will be called once for each row in the
result of your query.
The argc value tells you how many fields there are in the row.
The argv array contains pointers to the string representation of each
filed in the row, there is one string for each of the argc fields. If a
field is null then its string pointer (in argv) will be NULL).
HTH
Dennis Cote
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------