"D. Richard Hipp" <[EMAIL PROTECTED]> writes:
> [EMAIL PROTECTED] wrote:
>> "D. Richard Hipp" <[EMAIL PROTECTED]> writes:
>>> The show_datatypes PRAGMA is now locked on. Is this going to break
>>> anybody's code?
>> Yes, I think so, if I understand this change correctly. I don't use any
>> pragmas at all, and I always get the first row of my data beginning in the
>> second set of element of the returned values array (i.e. in the second element
>> if only one column is requested). The first element is the column name, and
>> I've never gotten datatypes.
>
> If you have (for example) 3 columns in the result set then
>
> columnName[0] = Name of the first column.
> columnName[1] = Name of the second column.
> columnName[2] = Name of the third column.
>
> This has been and will continue to be unchanged. The change
> in the pipeline for 2.8.13 is in the values for columnName[3]
> and following. Prior to 2.8.13, those values (if they even
> existed) would have been NULL. Now they contain information
> about datatypes. As long as you have never accessed
> columnName[3] or columnName[4], or any other columnName[]
> value other than 0 through 2 you should be fine.
>
> The details of the previous paragraph are for a 3-column
> result set. Make appropriate adjustments if your result
> set has a different number of columns.
>
> Please look again and tell me if you think this will break
> your code.
The sqlite_exec() function to which you are proposing making this change has
two separate pointers to arrays in its callback: "argv" and "columnNames".
The functions that I use, sqlite_get_table_*() have only one pointer to
pointer to array value, "result", which contains the column names in the first
nCol array elements. I don't know if your change would put the datatypes into
the next nCol array elements, but if it would, that would break my code.
Here's an example of how I access the data from a query. Maybe you can tell
me if your change would break it:
int numRows;
int numColumns;
char * pError;
char ** ppValues;
struct QueryData
{
char * a;
char * b;
char * c;
} * pQueryData;
ret = sqlite_get_table_printf(hDB,
"SELECT a, b, c FROM the_table;",
&ppValues,
&numRows,
&numColumns,
&pError);
if (numRows > 0)
{
/* View a row in structure format */
pQueryData = ((struct QueryData *) ppValues);
/* Increment past the column names */
++pQueryData;
/* Print each of the values */
while (numRows-- > 0)
{
printf("a=%s b=%s c=%s\n",
pQueryData->a, pQueryData->b, pQueryData->c);
}
}
Derrell
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]