[Gambas-devel] Gambas & ODBC

Benoit Minisini gambas at ...1...
Thu Dec 30 15:00:51 CET 2004


On Wednesday 29 December 2004 12:03, Andrea Bortolan wrote:
>
> No problem for an iSeries ;-)
>
> You're right ! It is horrible ! But this happens only
> if the ODBC driver doesn't return the number of rows.
> This is the iSeries ODBC driver case but not the MySQL
> driver.The MySQL driver returns the rows as we expect
> (but this is not the ODBC standard).
> The Gambas DB allocates the memory for the results
> before starting fetching rows so if the rows number is
> not right I can face some problem (no rows showed).
>
> > But, the problem with ODBC is always there: how to
> > implement all the functions
> > that return the structure of the database ? I know
> > there are some special
> > queries in ODBC for that, named "catalog functions".
>
> The problem with the catalog ecc. is that the
> Databases behavior is different one from others, i.e.
> in the DB2/400 (iSeries ex AS/400) database you cannot
> create  a new database, you can create a new library
> where put the tables and this is referred as
> collection using the library.table or library/table
> schema to address them. So the driver cannot execute a
> "create new database" command, the same command can
> instead work i.e. in MySQL.

So the gb.db component should manage the case when a driver function cannot be 
implemented. At the moment, this is possible by raising an error inside 
driver functions that cannot be implemented.

We can decide that in the ODBC gambas driver, creating and destroying 
databases are impossible.

> The ODBC does not provide those functions, the way you
>  can implement those funcion in order to get the
> database structure is to  query the database catalog
> tables using the SQL but this is a common SQL query.
>
> > If you want to finish the implementation of the ODBC
> > driver, here is the only
> > information I have about catalog functions. I found
> > them on the ODBTP site:
> > http://odbtp.sourceforge.net.
>
> I started to use the unixODBC ODBC iplementation
> because many database drivers are available for this
> driver manager (included the iSeries ODBC driver).
> unixODBC is written using the Microsoft standard
> (Microsotf created the ODBC) and I looked at the
> Microsoft documentation
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/o
>dbcodbc_api_reference.asp
>
> .
> I also started to create a new Gambas modules "ODBC"
> that does not leverage on the Gambas DB class, but
> this seems to duplicate many things and I don't know
> which it the best way in order to have an ODBC
> connection...plese let me know your thought.
>

The big problem is that ODBC seems to be NOT database independant, contrary to 
the gb.db component that relies on its drivers. For example, dates in 
ODBC/SQLServer queries can be different from dates in ODBC/MySQL queries. Can 
you ensure that the same query syntax will work for every ODBC driver, at 
least for the values (dates, numbers and strings) ?

As for the catalog functions, do you plan to implement them as much as 
possible ? I found another link about them:

http://gsbwww.uchicago.edu/computing/research/SASManual/accdb/z0421269.htm


> I started to code ODBC because I'm an iSeries
> techincal pre sales and I think that many ISV can
> start to deveolop their application in Linux if they
> can try Gambas. But all those ISV have OS/400
> customers and the way to have Linux applications that
> uses the DB2/400 is  having ODBC. When this ODBC
> modules will be available I  cat start to create some
> seminars and documentation on how use Gambas to crate
> Linux application instead VB.

Cool :-)

Best regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the Devel mailing list