Re: [Gambas-devel] Cannot populate database Connection.Name from ODBC driver.
Brought to you by:
gambas
From: ML <d4t...@gm...> - 2017-08-18 11:22:53
|
Benoît, Thanks a ton. It looks way easier than I tried/thought... As usual. Piccoro, First off, I always default my examples to MSSQL because I work with them, for good or bad. That's mainly what I have to try/test things from Gambas. But a single MySQL server -which is mostly free ($$$) IIRC- can also be home to more than one DB/Catalog. Others may or may not follow suit. Never tried Sybase, DB/2, or Oracle because I don't have access to either. I rely on users to report inconsistencies like I had for Firebird regarding RecordCount. Never mind RDBMS that don't have a DB Name. The interface should be as wide/general as possible, and if at least one of them uses or can switch DB/Catalog names, then I think it should be supported. Actually, SQLite3 (the one I do have at home, with your supplied example of "CREATE IF NOT EXIST Tabla1...") fails to retrieve at least the DB filename (test.sq3) as the Database/Catalog name. That particular DB is a file, so I guess the driver should retrieve *something* as DB Name but it does not, confusing everybody into thinking it's an in-memory DB. On the other hand, connstrings handle instances -at least with MSSQL- transparently by specifying the instance in the server name, and this is separate from the DB name. So you can have any mix-n-match of servers, instances, and DBs, given every server/instance has its own connection object. Then you can switch DBs/Catalogs inside each Connection by running MSSQL's USE (or the applicable RDBMS-specific) query command. Regards, zxMarce. On 18/08/17 04:37, PICCORO McKAY Lenz wrote: > hi zxMarce and other, i want to mark a WARNING here.. as i can see too > many experience with mososoft SQL and must be some notes about some > other scalar HIGH DBMS.. > sybase DOES NOT NEED A DB NAME TO HAVE A CONNECTION ! > be warning: its not like sqlite that a db "in memory" are present at > least, here theres no connection, in same way db2 and oracle... > > 2017-08-17 21:25 GMT-04:00 Benoît Minisini via Gambas-devel > <gam...@li...>: >> const char *new_value; >> GB.FreeString(&desc->name); // Free the Gambas string containing the >> old database name >> desc->name = GB.NewZeroString(new_value); // Create a new Gambas >> string from the zero-terminated string new_value, and store it. > its great that can be changed the connection db on the fly for the > module.. its mandatory.. > ok ODBC need! a connection db name when Established, but its only with > UnixODBC.. there's more "special behaviours" in same "host connection > name" there are also "same many db names" that its not the same as "in > same host are many db names served" > that strange behaviour are applied to oralce and sybase, that runs "a > instance" of the software for "one or more than" databases... in the > same host.. > due that PROPIETARY ODBC SOFTWARE CAN OFFERS A CONNECTION TO GAMBAS > WITHOUT A DATABASE VALID STRUCTURE, or a "empty valid connection" in > conclusion.. or more rare as succed to me, a connection but the db are > not the spected (due UnixODBC freedts can connect to a one db per host > at same time, as all here knowed. but it not limited to in real ysbae > or oracle) >> That's it. >> -- >> Benoît Minisini |