2015-06-13 34 views
0

我轉換一個Delphi 5/BDE應用到德爾福XE7/FireDAC。我的一個表格具有包含「GROUP BY」子句中的create語句TFDTable組件,它指向一個Oracle視圖。德爾福XE7 TFDTable查看行ID錯誤

這曾經在「老」的應用程序(BDE)做工精細,但FireDAC我得到這個錯誤:

「ORA-01446:不能選擇ROWID從,或樣品,具有鮮明的景色,GROUP BY等「。

我明白我在甲骨文發現了錯誤,但我沒有選擇的RowID,FireDAC是!有沒有辦法,我可以設置以防止它添加到行ID查詢的TFDTable組件上的財產?如果不是,我該如何使用這個視圖?

您的幫助表示讚賞 Ĵ

回答

0

納入FetchOptions.ItemsfiMeta

TFDQuery, TFDTable, TFDMemTable, and TFDCommand automatically retrieve the unique identifying columns (mkPrimaryKeyFields) for the main (first) table in the SELECT ... FROM ... statements, when fiMeta is included in FetchOptions.Items. Note:

mkPrimaryKeyFields querying may be time consuming; the application may need to explicitly specify unique identifying columns, when FireDAC fails to determine them correctly.

To explicitly specify columns, exclude fiMeta from FetchOptions.Items, and use one of the following options:

set UpdateOptions.KeyFields to a ';' separated list of column names; include pfInKey into the corresponding TField.ProviderFlags property.

When the application creates persistent fields, then initially TField.ProviderFlags will be set correctly. After that, automatic field setup will not happen, when the DB structure or query is changed. You should manually update ProviderFlags to adjust the column list. Also, if the primary key consists of several fields, then all of them must be included into persistent fields. Row Identifying Columns

Alternatively, a row identifying column may be included into the SELECT list. When FireDAC founds such columns, it will not retrieve mkPrimaryKeyFields metadata and it will use this column. The supported DBMSs are the following:

DBMS Row identifying column

Firebird DB_KEY

Informix ROWID

Interbase DB_KEY/RDB$DB_KEY

Oracle ROWID

PostgreSQL OID. The table must be created with OIDs.

SQLite ROWID

來源:http://docwiki.embarcadero.com/RADStudio/XE8/en/Unique_Identifying_Fields_%28FireDAC%29

+0

謝謝瓦爾。我忘了提及我已經閱讀過那篇文章。其實,它說,REMOVE fiMeta在FetchOptions.Items(它被選中)。然而,這並沒有區別,所以我想我是找錯了地方。 – oxydog

+0

還沒有解決這個問題。背部疼痛。 – oxydog