此代码:
FDConnection.Open; // Design time TFDConnection; default settings
TabelGrid.Close; // TDFTable connected to TFDConnection; default settings
TabelGrid.TableName := 'TT_ACT';
TabelGrid.Open;
TabelGrid.Edit;
TabelGrid.FieldByName('TT_NAME').AsString := TabelGrid.FieldByName('TT_NAME').AsString + '*';
TabelGrid.Post;
失败
[FireDAC][Phys][IB]-312 Exact update affected [0] rows, while [1] was requested
在安装Firebird 2.5.7时,不是,在安装Firebird 2.5.3时。
调用堆栈:
条件:
TFDConnection
指向本地.GDB文件,驱动程序ID IB或FB,默认sysdba
密码以及所有默认设置。出现TFDPhysIBDriverLink
或TFDPhysFBDriverLink
。该表具有3个索引:
TT_I0_ACT TT_ACT_ID Primary
TT_I1_ACT TT_PARENT_ID
TT_I2_ACT TT_FROMDATE
我对设置感到困惑,特别是将默认的UpdateOptions.UpdateMode
从UpWhereKeyOnly
更改为UpWhereChanged
或UpWhereAll
,但到目前为止没有结果。
怎么回事?我还能调查什么?
我们通过应用程序分发了Firebird 2.5.3,但恐怕如果客户端已有更高版本(如我们的开发人员升级FB时发现的那样),它将失败。
其他研究:
在两个版本的TFDPhysCommandAsyncExecute.Execute
(FireDAC.Phys.pas
)中看到的查询是(使用默认的UpWhereKey
更新模式):
UPDATE TT_ACT SET TT_NAME = :NEW_TT_NAME WHERE RDB$DB_KEY = :OLD_DB_KEY
(实际上,所有FCommand
属性在检查器中都显示相同)。
我浏览了Firebird 2.5.x. release notes,发现2.5.6中只有一个与之相关:
我不确定这是否适用,因为它与视图有关。将UpdateOptions.CountUpdatedOptions
设置为false没什么区别。
2.5.8修复程序列表中没有任何内容指示2.5.4-2.5.7版本中引入了相关的错误。
我已将FireDAC代码跟踪到2.5.3和2.5.7中执行有所不同的地方,但以无法跟踪的接口方法结束:
TFDTable.InternalPost
TFDDataSet.InternalPost
TFDAdaptedDataSet.DoProcessUpdateRequest(arUpdate
TFDCustomTableAdapter.Update
TFDCustomTableAdapter.UpdateAdapterCmds(const ACmds: array of TFDActionRequest);
ACmds contains (arUpdate, arFetchRow)
back to TFDCustomTableAdapter.Update
TFDDAptTableAdapter.Update
TFDDAptTableAdapter.ProcessUpdate
In the 'build command if required' part
oCmd.SQLText := 'UPDATE TT_ACT'#$A'SET TT_NAME = ?'#$A'WHERE RDB$DB_KEY = ?'
ProcessRequest
in TFDDAptTableAdapter.ProcessRequest
SetParamsFromRow(ACommand.Params, ARow);
AParams.Count=2: NEW_TT_NAME and OLD_DB_KEY. OLD_DB_KEY value is 0 in both cases
then
ACommand.Execute;
TFDPhysCommand.Execute
ExecuteTask
TFDPhysCommand.ExecuteTask
FExecutor.Run
TFDStanAsyncExecutor.Run;
TFDStanAsyncExecutor.ExecuteOperation
FOperationIntf.Execute;
TFDPhysCommandAsyncExecute.Execute
TFDPhysCommand.ExecuteBase
FExecutor.Launched; -> Interface, cannot trace
Process_SingleRow
Process_HandleSystemFailure
InternalExecute -> Interface, cannot trace
最后一次调用返回var参数ACount(对于2.5.3)为1,对于2.5.7为0
GetRowCounts函数返回
FRowsUpdated,FRowsDeleted,FRowsSelected,FRowsInserted: 1 0 1 0 in 2.5.3
FRowsUpdated,FRowsDeleted,FRowsSelected,FRowsInserted: 0 0 0 0 in 2.5.7