[Gambas-user] Problem with data types
Benoît Minisini
gambas at ...1...
Sun Nov 14 12:05:08 CET 2010
> 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,
--
Benoît Minisini
More information about the User
mailing list