UpdatingTable and current/default schema

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Deeem2031
Posts: 6
Joined: Wed 08 Jun 2016 13:45

UpdatingTable and current/default schema

Post by Deeem2031 » Wed 15 Jun 2016 16:40

Hello,
'til now you answered my questions just fine so here's the next challenge :wink:

When setting the property UpdatingTable it seems that it has to match the way the table is declared in the query. This is rather unfortunate if you are using the current schema.

For example this works fine:

Code: Select all

qu.SQL.Text := 'SELECT * FROM DBO.[Table]';
qu.Open;
qu.UpdatingTable := 'dbo.Table';
just like this:

Code: Select all

qu.SQL.Text := 'SELECT * FROM [Table]';
qu.Open;
qu.UpdatingTable := 'Table';
But this fails with 'Wrong UpdatingTable value - table Table is unknown':

Code: Select all

qu.SQL.Text := 'SELECT * FROM DBO.[Table]';
qu.Open;
qu.UpdatingTable := 'Table';
With Ado we used the property 'Unique Table' for which UpdatingTable seems to be the replacement and it worked fine in all this situations.

Code: Select all

TAdoQuery.Recordset.Properties['Unique Table'].Value := UpdatingTable;
I also found a relatively easy fix by replacing the line MSClasses.GenerateTableName 660

Code: Select all

if SchemaName <> '' then
with

Code: Select all

if (SchemaName <> '') and not SameText(SchemaName, DefaultSDACSchema) then
Though this doesn't check for the DEFAULT_SCHEMA of the current user...

ViktorV
Devart Team
Posts: 2299
Joined: Wed 30 Jul 2014 07:16

Re: UpdatingTable and current/default schema

Post by ViktorV » Thu 16 Jun 2016 10:47

We will consider the possibility to change this behavior of SDAC in one of the next builds.

Post Reply