Field ROWID not found, when the table is set to read only

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
valentl
Posts: 16
Joined: Wed 22 May 2013 06:15

Field ROWID not found, when the table is set to read only

Post by valentl » Thu 02 May 2019 09:06

Hello,
We have encountered a problem.
Odac 10.3.9, Delphi 10.2
In some circumstances, we need to set the TOratable.Readonly to True on a certain table.

but, if the readonly is set, the table cannot be opened, because the rowid is not selected.
I made a small example, you can check it.

https://1drv.ms/u/s!AvgmO8OCn7_bgoIyyf3At70YQ8xJFA

Just create the sample table, open the delphi form, and try to set the table's active property to true.
No need to compile or run the application, the error appears at design time.
The SQL Monitor clearly shows, that only select t.* from limlom is queryed, insted of select t.rowid, t.* from limlom

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Field ROWID not found, when the table is set to read only

Post by MaximG » Wed 08 May 2019 15:08

Please create and send us a small test example without any third-party components (e.g, TcxGrid), so that we could reproduce the issue. You can send us the test data the via the e-support form: [url]https://www.devart.com/company/contactform.html[/url]

valentl
Posts: 16
Joined: Wed 22 May 2013 06:15

Re: Field ROWID not found, when the table is set to read only

Post by valentl » Thu 09 May 2019 06:09

I replaced the sample application in the first post, I removed any unnecessary unit names.
try to create the table named limlom, and try to open it.

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Field ROWID not found, when the table is set to read only

Post by MaximG » Fri 10 May 2019 11:15

The issue is caused by the persistent field RAEROWID in your example. To open the table RAE when RAE.ReadOnly=True, you need to either delete the field RAEROWID, or change the SQL statement:

Code: Select all

begin
  rae.SQL.Text := 'SELECT L.RowId, L.* FROM LIMLOM L';
  rae.open;
end;

valentl
Posts: 16
Joined: Wed 22 May 2013 06:15

Re: Field ROWID not found, when the table is set to read only

Post by valentl » Fri 10 May 2019 14:15

But, because I have no proper primary key in the table, I have to use the row id.
For other reasons, sometimes, the table must be set to read only.
Of course, I can do a workaround, but I think, it is a problem, becasue, if the oratable component is not readonly, the rowid field is fetched automatically, when I set readonly to true, the field not found error message appears immediately.

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Field ROWID not found, when the table is set to read only

Post by MaximG » Wed 15 May 2019 08:51

The pseudo-column RowID is created automatically depending on the operation mode of your dataset and the type of table that you specify in TOraTable. RowID serves in our components for internal purposes. You can change that behavior to match your task by changing the automatically generated statement in the TOraTable component or by using your own SQL query in the TOraQuery component.

valentl
Posts: 16
Joined: Wed 22 May 2013 06:15

Re: Field ROWID not found, when the table is set to read only

Post by valentl » Wed 15 May 2019 10:56

"depending on the operation mode"
This is what I didn't know.
I thought, that the rowid field is always in the field list, if the key field is set to the ROWID field.
Of course I don't need the rowid, if I don't use it as a key.
please add a feature, to always add the rowid field to the field list, when the key field is the ROWID.

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Field ROWID not found, when the table is set to read only

Post by MaximG » Wed 15 May 2019 15:18

As indicated ealier, current product behavior with the RowID field is intented for internal purposes only – we can’t change its behavior without impacting the work processes of other users of our product. You can implement functionality with RowID fields by yourself using one of the described methods.

Post Reply