How get UpdatingTable?

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
sinys
Posts: 186
Joined: Tue 21 Feb 2012 03:44

How get UpdatingTable?

Post by sinys » Sat 19 May 2012 16:41

How I can get UpdatingTable which selected automatically?

Code: Select all

// SmartQuery1.UpdatingTable = '' by default
SmartQuery1.SQL.Text := 'select * from customers';
SmartQuery1.Open;
ShowMessage(SmartQuery1.UpdatingTable);  // return empty value
In DOA the same properties return table name (which selected automatically) for update if user not set value for UpdatingTable. How I can get table name for update from my query in ODAC?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: How get UpdatingTable?

Post by AlexP » Mon 21 May 2012 10:17

Hello,

The UpdatingTable property is set by a user for specifying the table, for which it is necessary to generate UPDATE/INSERT/DELETE/REFRESH SQL queries. If you haven't set this property to SQL, queries for these operations will be generated for the first table specified in the query. To retrieve this table name, you can use the TDBAccessUtils.GetTablesInfo method as follows:

SmartQuery1.SQL.Text := 'select * from customers';
SmartQuery1.Open;
ShowMessage(TDBAccessUtils.GetTablesInfo(TCustomDADataSet(SmartQuery1)).Items[0].TableName);

sinys
Posts: 186
Joined: Tue 21 Feb 2012 03:44

Re: How get UpdatingTable?

Post by sinys » Mon 21 May 2012 14:35

Thank you!

sinys
Posts: 186
Joined: Tue 21 Feb 2012 03:44

Re: How get UpdatingTable?

Post by sinys » Tue 21 Aug 2012 14:24

Can I know the name of the table without "SmartQuery1.Open;" ?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: How get UpdatingTable?

Post by AlexP » Tue 21 Aug 2012 14:53

hello,

Instead of opening the table, you can call the Prepare method:

Code: Select all

SmartQuery1.SQL.Text := 'select * from customers';
SmartQuery1.Prepare;
ShowMessage(TDBAccessUtils.GetTablesInfo(TCustomDADataSet(SmartQuery1)).Items[0].TableName);

Post Reply