Status: Closed (View Workflow)
Resolution: Not a Bug
i have CONNECT table created table "company__contract" in MariaDB database "myproject", by command below. This table is connected to MSSQL schema "externaldatabase" on server "mydsn" (defined properly by FreeTDS + UnixODBC).
Select and insert into table works properly, but UPDATE or DELETE queries produced by CONNECT/ODBC engine generates unwanted "myproject" prefix into MSSQL queries. String "myproject" is name of MariaDB database, not MSSQL database. Proper name of MSSQL database/schema is "externaldatabase" defined by DATABASE in CONNECTION.
Here are queries recorded by tracing in FreeTDS/UnixODBC:
SELECT (OK): SELECT id, note FROM dbo.contract
INSERT (OK): INSERT INTO dbo.contract(id, note) VALUES (?,?)
UPDATE (ERROR): UPDATE myproject . dbo.contract SET note = 'abc' WHERE (id= 2)
DELETE (ERROR): DELETE FROM myproject . dbo.contract WHERE id = 217 AND note = 'xyz'
UPDATE or DELETE of course ends by an error Invalid object name 'myproject.dbo.contract'.
I tried any "hacks" with DBNAME, DATABASE, SCHEMA, CATALOG, but i don't know, how to remove unwanted "myproject" from MSSQL query. I read whole documentation about ODBC and CONNECT engine, but nothing helps.
Is there any option or workaround how to disable this invalid "prefixing", or override it to proper name "externaldatabase"?
CREATE TABLE `company__contract`