秋·风

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

unidac和EHLib在lazarus +fpc 3.3.1安装时会遇到以下提示:

问题原因:

fpc 3.3.1比3.2.2,字段类型增加了7种字段类型(红字部分):

  TFieldType = (ftUnknown, ftString, ftSmallint, ftInteger, ftWord,
    ftBoolean, ftFloat, ftCurrency, ftBCD, ftDate,  ftTime, ftDateTime,
    ftBytes, ftVarBytes, ftAutoInc, ftBlob, ftMemo, ftGraphic, ftFmtMemo,
    ftParadoxOle, ftDBaseOle, ftTypedBinary, ftCursor, ftFixedChar,
    ftWideString, ftLargeint, ftADT, ftArray, ftReference,
    ftDataSet, ftOraBlob, ftOraClob, ftVariant, ftInterface,
    ftIDispatch, ftGuid, ftTimeStamp, ftFMTBcd, ftFixedWideChar, ftWideMemo,
    ftOraTimeStamp, ftOraInterval, ftLongWord, ftShortint, ftByte, ftExtended,
    ftSingle);

解决方法:
unidac的MemDS.pasOraServicesUni、VirtualQuery.pas、DAParamsFrame.pas对应也要增加7种字段类型(新增类型定义不一定准确,但使用实测暂时没发现问题)。
1、MemDS.pas:

const
  DataTypeMap: array [TFieldType] of word = (
    // ftUnknown, ftString, ftSmallint, ftInteger, ftWord
    dtUnknown, dtString, dtInt16, dtInteger, dtUInt16,
    // ftBoolean, ftFloat, ftCurrency, ftBCD, ftDate, ftTime, ftDateTime,
    dtBoolean, dtFloat, dtCurrency, dtBCD, dtDate, dtTime, dtDateTime,
    // ftBytes, ftVarBytes, ftAutoInc, ftBlob, ftMemo, ftGraphic, ftFmtMemo,
    dtBytes, dtVarBytes, dtInteger, dtBlob, dtMemo, dtBlob, dtMemo,
    // ftParadoxOle, ftDBaseOle, ftTypedBinary, ftCursor, ftFixedChar, ftWideString,
    0, 0, 0, dtCursor, dtString, dtWideString,
    // ftLargeint, ftADT, ftArray, ftReference, ftDataSet, ftOraBlob, ftOraClob,
    dtInt64, dtObject, dtArray, dtReference, dtTable, 0, 0,
    // ftVariant, ftInterface, ftIDispatch, ftGuid
    dtVariant, 0, 0, dtGuid
    // ftTimeStamp, ftFMTBcd
    {$IFNDEF FPC}, dtSQLTimeStamp{$ELSE}, 0{$ENDIF}, dtFmtBCD
  {$IFDEF FPC}
    // ftFixedWideChar, ftWideMemo
    , dtWideString, dtWideMemo
    {$if FPC_FULLVERSION>30202}
     ,dtUnknown
     ,dtUnknown
     ,dtUnknown
     ,dtUnknown
     ,dtUnknown
     ,dtUnknown
     ,dtUnknown
    {$endif}
  {$ENDIF}
  {$IFDEF VER10P}
    // ftFixedWideChar, ftWideMemo, ftOraTimeStamp, ftOraInterval
    , dtWideString, dtWideMemo, 0, 0
  {$IFDEF VER12P}

2、OraServicesUni.pas:

const
  OraDataTypeMap: array [TFieldType] of word = (
  //ftUnknown, ftString, ftSmallint, ftInteger, ftWord
    dtUnknown, dtString, dtSmallint, dtInteger, dtWord,
  //ftBoolean, ftFloat, ftCurrency, ftBCD, ftDate, ftTime, ftDateTime
    dtBoolean, dtFloat, dtCurrency, dtBCD, dtDate, dtTime, dtDateTime,
  //ftBytes, ftVarBytes, ftAutoInc, ftBlob, ftMemo, ftGraphic, ftFmtMemo
    dtBytes, dtVarBytes, 0,         dtBlob, dtMemo, 0,         0,
  //ftParadoxOle, ftDBaseOle, ftTypedBinary, ftCursor, ftFixedChar, ftWideString
    0,            0,          0,             dtCursor, dtFixedChar, dtWideString,
  //ftLargeint, ftADT,    ftArray, ftReference, ftDataSet, ftOraBlob, ftOraClob
    dtLargeInt, dtObject, dtArray, dtReference, dtTable,   dtOraBlob, dtOraClob,
  //ftVariant, ftInterface, ftIDispatch,  ftGuid,
    0,         0,           0,            dtGuid,
  //             ftTimeStamp,    ftFMTBcd,
    {$IFNDEF FPC}dtSQLTimeStamp,{$ELSE}0,{$ENDIF} dtFMTBcd
  {$IFDEF FPC}
    //ftFixedWideChar, ftWideMemo,
    , dtFixedWideChar, dtWideMemo
    {$if FPC_FULLVERSION>30202}
    //ftOraTimeStamp, ftOraInterval, ftLongWord, ftShortint, ftByte, ftExtended, ftSingle
    , 0,0, dtUInt32,dtInt8,dtUInt8, dtExtended, dtSingle
    {$endif}
  {$ENDIF}
  {$IFDEF VER10P}
    //ftFixedWideChar, ftWideMemo, ftOraTimeStamp, ftOraInterval,
    , dtFixedWideChar, dtWideMemo, dtTimeStamp,    0
  {$IFDEF VER12P}
    //ftLongWord, ftShortint, ftByte,    ftExtended, ftConnection, ftParams, ftStream
    , dtUInt32,   dtInt8,     dtUInt8,   dtExtended, 0,            0,        0
  {$ENDIF}
  {$IFDEF VER14P}
    //ftTimeStampOffset, ftObject, ftSingle
    , 0,                 dtObject, dtSingle
  {$ENDIF}
  {$ENDIF}
  );

 3、VirtualQuery.pas:

const
  DataTypeMap: array [TFieldType] of word = (
    // ftUnknown, ftString, ftSmallint, ftInteger, ftWord
    dtUnknown, dtString, dtInt16, dtInteger, dtUInt16,
    // ftBoolean, ftFloat, ftCurrency, ftBCD, ftDate, ftTime, ftDateTime,
    dtBoolean, dtFloat, dtCurrency, dtBCD, dtDate, dtTime, dtDateTime,
    // ftBytes, ftVarBytes, ftAutoInc, ftBlob, ftMemo, ftGraphic, ftFmtMemo,
    dtBytes, dtVarBytes, dtInteger, dtBlob, dtMemo, dtBlob, dtMemo,
    // ftParadoxOle, ftDBaseOle, ftTypedBinary, ftCursor, ftFixedChar, ftWideString,
    0, 0, 0, dtCursor, dtString, dtWideString,
    // ftLargeint, ftADT, ftArray, ftReference, ftDataSet, ftOraBlob, ftOraClob,
    dtInt64, dtObject, dtArray, dtReference, dtTable, 0, 0,
    // ftVariant, ftInterface, ftIDispatch, ftGuid
    dtVariant, 0, 0, dtGuid
    // ftTimeStamp, ftFMTBcd
    {$IFNDEF FPC}, dtSQLTimeStamp{$ELSE}, 0{$ENDIF}, dtFmtBCD
  {$IFDEF FPC}
    // ftFixedWideChar, ftWideMemo
    , dtWideString, dtWideMemo
    {$if FPC_FULLVERSION>=30301}
    ,dtUnknown
    ,dtUnknown
    ,dtUnknown
    ,dtUnknown
    ,dtUnknown
    ,dtUnknown
    ,dtUnknown
    {$endif}
  {$ENDIF}
  {$IFDEF VER10P}
    // ftFixedWideChar, ftWideMemo, ftOraTimeStamp, ftOraInterval
    , dtWideString, dtWideMemo, 0, 0
  {$IFDEF VER12P}
    // ftLongWord, ftShortint, ftByte, ftExtended, ftConnection, ftParams, ftStream
    , dtUInt32, dtInt8, dtUInt8, dtExtended, 0, 0, 0
  {$IFDEF VER14P}
    // ftTimeStampOffset, ftObject, ftSingle
    , dtSQLTimeStampOffset, 0, dtSingle
  {$ENDIF}
  {$ENDIF}
  {$ENDIF}
  );

 4、DAParamsFrame.pas:

{$IFDEF FPC}
const
  FieldTypeVarMap: array[TFieldType] of Word = (
    varEmpty, varString, varInteger, varInteger, varInteger,
    varBoolean, varDouble, varCurrency, varCurrency, varDate, varDate, varDate,
    varEmpty, varEmpty, varInteger, varEmpty, varString, varEmpty,
    varEmpty, varEmpty, varEmpty, varEmpty, varEmpty, varString, varOleStr,
    varEmpty, varEmpty, varEmpty, varEmpty, varEmpty, varEmpty, varEmpty,
    varVariant, varUnknown, varDispatch, varString, varEmpty, varEmpty,
    varOleStr, varOleStr
    {$if FPC_FULLVERSION>30202}
     ,varEmpty
     ,varEmpty
     ,varEmpty
     ,varEmpty
     ,varEmpty
     ,varEmpty
     ,varEmpty
    {$endif}
    );
{$ENDIF}

EHLib的MemTableDataEh.pas:

var
  DefaultDataFieldClasses: array[TFieldType] of TMTDataFieldClassEh = (
    TMTRefObjectFieldEh,        { ftUnknown }
    TMTStringDataFieldEh,       { ftString }
    TMTNumericDataFieldEh,      { ftSmallint }
    TMTNumericDataFieldEh,      { ftInteger }
    TMTNumericDataFieldEh,      { ftWord }
    TMTBooleanDataFieldEh,      { ftBoolean }
    TMTNumericDataFieldEh,      { ftFloat }
    TMTNumericDataFieldEh,      { ftCurrency }
    TMTNumericDataFieldEh,      { ftBCD }
    TMTDateTimeDataFieldEh,     { ftDate }
    TMTDateTimeDataFieldEh,     { ftTime }
    TMTDateTimeDataFieldEh,     { ftDateTime }
    TMTVariantDataFieldEh,      { ftBytes }
    TMTVariantDataFieldEh,      { ftVarBytes }
    TMTNumericDataFieldEh,      { ftAutoInc }
    TMTBlobDataFieldEh,         { ftBlob }
    TMTBlobDataFieldEh,         { ftMemo }
    TMTBlobDataFieldEh,         { ftGraphic }
    TMTBlobDataFieldEh,         { ftFmtMemo }
    TMTBlobDataFieldEh,         { ftParadoxOle }
    TMTBlobDataFieldEh,         { ftDBaseOle }
    TMTBlobDataFieldEh,         { ftTypedBinary }
    nil,                        { ftCursor }
    TMTStringDataFieldEh,       { ftFixedChar }
    TMTStringDataFieldEh,       { ftWideString }
    TMTNumericDataFieldEh,      { ftLargeInt }
    nil{TADTField},             { ftADT }
    nil{TArrayField},           { ftArray }
    nil{TReferenceField},       { ftReference }
    nil{TDataSetField},         { ftDataSet }
    TMTBlobDataFieldEh,         { ftOraBlob }
    TMTBlobDataFieldEh,         { ftOraClob }
    TMTVariantDataFieldEh,      { ftVariant }
    TMTInterfaceDataFieldEh,    { ftInterface }
    TMTInterfaceDataFieldEh,    { ftIDispatch }
    TMTStringDataFieldEh        { ftGuid }
    ,TMTSQLTimeStampDataFieldEh { ftTimeStamp }
    ,TMTNumericDataFieldEh      { ftFMTBCD }
  {$IFDEF FPC}
    ,nil
    ,nil
  {$ELSE}
  {$ENDIF}
{$IFDEF EH_LIB_10}
    ,TMTStringDataFieldEh       { ftFixedWideChar }
    ,TMTBlobDataFieldEh         { ftWideMemo }
    ,TMTSQLTimeStampDataFieldEh { ftOraTimeStamp }
    ,TMTStringDataFieldEh       { ftOraInterval }
{$ENDIF}
{$IFDEF EH_LIB_12}
    ,TMTNumericDataFieldEh      { ftLongWord }
    ,TMTNumericDataFieldEh      { ftShortint }
    ,TMTNumericDataFieldEh      { ftByte }
    ,TMTNumericDataFieldEh      { ftExtended }
    ,nil { ftConnection }
    ,nil { ftParams }
    ,nil { ftStream}
{$ENDIF}
{$IFDEF EH_LIB_13}
    ,TMTSQLTimeStampDataFieldEh { ftTimeStampOffset }
    ,nil                        { ftObject }
    ,TMTNumericDataFieldEh      { ftSingle }
{$ENDIF}
{$if FPC_FULLVERSION>30202}
    ,nil
    ,nil
    ,nil
    ,nil
    ,nil
    ,nil
    ,nil
{$endif}
);

修改后就能在fpc 3.3.1的lazarus安装使用。
其它控件如遇到类似的问题也可以参考这个方法进行修改。

posted on 2024-09-01 16:39  秋·风  阅读(222)  评论(0编辑  收藏  举报