[Gambas-devel] Support of LONG in database drivers
Benoit Minisini
gambas at ...1...
Wed Nov 16 00:10:17 CET 2005
On Tuesday 15 November 2005 15:27, Andrea Bortolan wrote:
> Hi Benoit,
> I'm working on it......just a question about the code you've posted:
> in the con_data function there is a duplicate case for the
> FIELD_TYPE_LONGLONG see the following :
>
>
>
> static void conv_data(char *data, GB_VARIANT_VALUE *val, int type, int
> len)
> {
> GB_VALUE conv;
> GB_DATE_SERIAL date;
> double sec;
>
> switch (type)
> {
> case FIELD_TYPE_TINY:
>
> if (len == 1)
> {
> val->_boolean.type = GB_T_BOOLEAN;
> /*GB.NumberFromString(GB_NB_READ_INTEGER, data, strlen(data),
> &conv);*/
> val->_boolean.value = atoi(data) != 0;
> }
> else
> {
> GB.NumberFromString(GB_NB_READ_INTEGER, data, strlen(data),
> &conv);
>
> val->_integer.type = GB_T_INTEGER;
> val->_integer.value = ((GB_INTEGER *)&conv)->value;
> }
>
> break;
>
> case FIELD_TYPE_INT24:
> case FIELD_TYPE_SHORT:
> case FIELD_TYPE_LONG:
> /*case FIELD_TYPE_TINY:*/
> case FIELD_TYPE_LONGLONG:
> case FIELD_TYPE_YEAR:
>
> GB.NumberFromString(GB_NB_READ_INTEGER, data, strlen(data),
> &conv);
>
> val->type = GB_T_INTEGER;
> val->_integer.value = ((GB_INTEGER *)&conv)->value;
>
> break;
>
> case FIELD_TYPE_LONGLONG:
>
> GB.NumberFromString(GB_NB_READ_LONG, data, strlen(data), &conv);
>
> val->type = GB_T_LONG;
> val->_long.value = ((GB_LONG *)&conv)->value;
>
> break;
>
> case FIELD_TYPE_FLOAT:
> case FIELD_TYPE_DOUBLE:
> case FIELD_TYPE_DECIMAL:
>
> GB.NumberFromString(GB_NB_READ_FLOAT, data, strlen(data), &conv);
>
> val->_float.type = GB_T_FLOAT;
> val->_float.value = ((GB_FLOAT *)&conv)->value;
>
> break;
>
A bug! I forgot to remove the first one of course...
> I think that I need also to add the new data type in the table_create
> function do you agree ?
Of course, you are right. I forgot to do that, whereas it is absolutely
logical (I mean, if I change a function that converts SQL datatype to gambas
datatype, I have to do the contrary somewhere else!)
>
> I hope to have enought time to starting the test on the new datatype
> tomorrow. Have a nice day, Andrea.
> Coai.
>
Regards,
--
Benoit Minisini
More information about the Devel
mailing list