Delphi(BCDField)Oracle FireDac主数据详细信息引发字段

时间:2017-08-27 20:34:24

标签: delphi firedac delphi-10.2-tokyo

这里是我的oracle表

CREATE TABLE TMASTER (
    ID NUMBER(10,0) NOT NULL,  -- DELPHI BCD with precision 10 sz 0
    PARENT NUMBER(10,0) NOT NULL,  -- DELPHI BCD with precision 10 sz 0
    NAME VARCHAR2(100) NOT NULL
);
CREATE UNIQUE INDEX TMASTER_ID ON TMASTER(ID);
ALTER TABLE TMASTER ADD CONSTRAINT TMASTER_ID PRIMARY KEY(ID);

CREATE TABLE TDETAIL (
    ID RAW(16) DEFAULT SYS_GUID() NOT NULL,
    MASTERID NUMBER(10,0),    -- DELPHI BCD with precision 10 sz 0
    SORTID NUMBER(10,0),  -- DELPHI BCD with precision 10 sz 0
    NAME VARCHAR2(100),
    QTY NUMBER(5,0), -- DELPHI BCD with precision 5 sz 0
    FOREIGN KEY (MASTERID) REFERENCES TMASTER(ID)
);
CREATE UNIQUE INDEX TDETAIL_ID ON TDETAIL(ID);
ALTER TABLE TDETAIL ADD CONSTRAINT TDETAIL_ID PRIMARY KEY(ID);

当打开详细信息时表异常引发,BCDField作为主要详细信息,因为o​​racle类型号与标量(10,0)被检测为BCDField。 我的delphi示例,当我使用int32

将NUMBER(10,0)更改为NUMBER(8,0)< - 时,MapRules不起作用
type 
  TDetailHelper = class(TComponent)
  private
    FMaster: TFDTable;
    FMasterSource: TDataSource;
    FDetail: TFDTable;
  protected
    procedure DoInternalOpen;
end; 

procedure TDetailHelper.DoInternalOpen;
begin
  if not FMaster.Active then
  begin
    FMaster.TableName := 'TMASTER';
    FMaster.IndexName := 'TMASTER_ID';
  end;

  FDetail.TableName := 'TDETAIL';
  FDetail.MasterSource := FMasterSource;
  FDetail.IndexName    := 'TDETAIL_ID';
  FDetail.MasterFields := 'ID';
  FDetail.DetailFields := 'MASTERID';

  {Open ALL}
  FMaster.DisableControls;
  FDetail.DisableControls;
  try
    FMaster.Open; { <-- Open OK}
    FDetail.Open; { <-- Raise Exception}
  finally
    FMaster.EnableControls;
    FDetail.EnableControls;
  end;
end;

我得到此例外&#34;为字段“ID&#39;&#34;提高无效的变体类型或大小 有人可以解释为什么这个异常会引发。

0 个答案:

没有答案