[Gambas-user] Problem with data types

Michael mdavies5 at ...169...
Mon Nov 15 05:31:01 CET 2010


Thanks Benoit,
The help page for gb.mysql says it is not available for Gambas2 but it 
doesn't matter as one of the beauties of Gambas, it is always possible 
to find a way  around problems.
When can we expect V3 generally available?
Regards
Mike

On 14/11/10 22:05, Benoît Minisini wrote:
>> I am porting all my vb.net apps to gambas and I am very happy with the
>> results, particularly the gb.db component. However it does have some
>> limitations:
>> 1. I need to determine the type of database columns using
>> irsData.Fields[intCounter].Type. This works fine for strings, floats,
>> integers and dates  but many MySql data types such as 'Decimal' are seen
>> as db.String(9).
>> 2. I thought I would test if it was really a string by using the
>> ResultField.Length property which should return zero for non-strings but
>> it returned 19 for a Decimal(18,0) field in my database.
>>
>> I overcame the problem by changing all my MySql decimal fields to floats
>> and it works fine. However there may be other MySql types which I have
>> not tested and which may have a similar problem. Are there any plans to
>> update gb.db to handle the many data types now available in most databases?
>>
>> Regards
>> Mike
>>
> Yes and no.
>
> SQL datatypes are mapped to Gambas datatypes, so you don't see them.
>
> Moreover, the gb.db component aims at being independent of the database
> backend. And as SQL is not really a standard, datatypes are different between
> MySQL, PostgreSQL, SQLite..., and so it is impossible to manage them in an
> independant way.
>
> You will get more information about datatype mapping there:
>
> 	http://gambasdoc.org/help/doc/db-type-mapping
>
> On the other hand, David Villalobos Cambronero has wrote a component named
> "gb.mysql" that allows you to access all specific MySQL features. But I have
> never used it, so he will help you better than me about that.
>
> Regards,
>




More information about the User mailing list