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
謝謝瓦爾。我忘了提及我已經閱讀過那篇文章。其實,它說,REMOVE fiMeta在FetchOptions.Items(它被選中)。然而,這並沒有區別,所以我想我是找錯了地方。 – oxydog
還沒有解決這個問題。背部疼痛。 – oxydog