Cannot populate database Connection.Name from ODBC driver.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Cannot populate database Connection.Name from ODBC driver.

zxMarce
This post has NOT been accepted by the mailing list yet.
Hi there. This is mainly intended to be tackled by Benoît, but anyone with the necessary knowledge (Toby?) please feel free to butt in.

The ODBC driver can use Connection Strings since some time now. I also have a patched up module that can run successfully non-data-producing queries (the SQL_NO_DATA return code is no longer treated as an error), thanks to a bug submitted by Piccoro.

Problem is in the open_database() function. When using connstrings, the database name is usually part of this string, and no .Name property is expected to be populated from the BASIC program, nor actually used.
So, I'm trying to populate the property from the ODBC backend. I can successfully fetch the DB Name from the lower level database driver in use (SQLite3 does not provide a name, tho, be warned).
What I cannot do, be it via copying char[] or Gambas String buffer pointers, is to get the .Name property populated back to the running BASIC program.

The open_database() call has two parameters: DB_DESC *desc and DB_DATABASE *db. My best guess is that I have to fiddle with desc, but not really sure if that's correct nor exactly how.

To further salt the issue, queries exist in big RDBMS that allow to hot-switch databases while connected to a server (example: USE <newDBName> in MSSQL). So, the connection's .Name property should also be "refetched" after a successful query is run.

Any suggestions?