
//////////////////////////////////////////////////
//  DB Access Components
//  Copyright © 1998-2014 Devart. All right reserved.
//  Core Data Type Mapping
//////////////////////////////////////////////////

{$IFNDEF CLR}
{$IFNDEF EntityDAC}
{$I Dac.inc}
unit CRDataTypeMap;
{$ENDIF}
{$ENDIF}

{$IFDEF LITE}
  Error // Data Type Mapping is not supported in dbExpress drivers
{$ENDIF}

interface

uses
  Classes, SysUtils,
{$IFDEF VER6P}
  Variants,
{$IFNDEF FPC}
  FMTBcd,
  SqlTimSt,
{$ENDIF}
{$ENDIF}
{$IFDEF CLR}
  System.Runtime.InteropServices, System.Text,
{$ELSE}
  {$IFNDEF EntityDAC}
  CLRClasses,
  {$ELSE}
  EntityDAC.Common.CLRClasses,
  {$ENDIF}
{$ENDIF}
{$IFNDEF EntityDAC}
  CRTypes, CRFunctions, DAConsts, MemUtils, MemData;
{$ELSE}
  EntityDAC.Common.Types, EntityDAC.Common.Functions, EntityDAC.Common.Consts, EntityDAC.Common.MemUtils, EntityDAC.Common.MemData;
{$ENDIF}

const
  MaxSingle = 3.4e+38;
  MaxDouble = 1.7e+308;
  DecValue: array[0..3] of integer = (10000, 1000, 100, 10);

type
  TMapRules = class;
  TCRMapRules = class;
  TConverterManager = class;

  TMapRuleClass = class of TMapRule;
  TCRMapRuleClass = class of TCRMapRule;
  TCRMapRulesClass = class of TCRMapRules;
  TConverterManagerClass = class of TConverterManager;

  TCalcSizeFunc = function(Value: Integer): Integer of object;

  EDataTypeMappingError = class(Exception)
  public
    constructor Create; overload;
  end;

  EInvalidMapRuleExpression = class (EDataTypeMappingError)
  end;

  EUnsupportedDataTypeMapping = class (EDataTypeMappingError)
  end;

  EInvalidDBTypeMapping = class (EDataTypeMappingError)
  end;

  EInvalidFieldTypeMapping = class (EDataTypeMappingError)
  end;

  EDataMappingError = class (EDataTypeMappingError)
  end;

  TDBTypeInfo = class
  private
    FDBType: Word;
    FName: string;
    FLength: boolean;
    FScale: boolean;
    function GetDBProvider: Word;
  protected
  public
    constructor Create(DBType: Word; const Name: string; Length, Scale: boolean);

    property DBType: Word read FDBType;
    property DBProvider: Word read GetDBProvider;
    property Name: string read FName;
    property Length: boolean read FLength;
    property Scale: boolean read FScale;
  end;

  TDBTypeInfos = class
  private
    FTypeInfos: TDAObjectList;

    function GetCount: Integer;
    function GetTypeInfo(Index: integer): TDBTypeInfo;
  protected
  public
    constructor Create;
    destructor Destroy; override;

    procedure Add(DBType: Word; const Name: string; Length, Scale: boolean);
    procedure Delete(Index: Integer);
    procedure Clear;

    procedure Validate(DBType: Word; LengthMin, LengthMax, ScaleMin, ScaleMax: Integer; IsDBTypeRequired: boolean);

    function FindTypeInfo(DBType: Word): TDBTypeInfo; overload;
    function FindTypeInfo(const Name: string; DBProvider: Word): TDBTypeInfo; overload;

    property TypeInfos[Index: Integer]: TDBTypeInfo read GetTypeInfo; default;
    property Count: Integer read GetCount;
  end;

  TMapRule = class (TCollectionItem)
  private
    // Field Name
    FFieldName: string;

    // Source Database Type
    FDBType: Word;
    FDBLengthMin: Integer;
    FDBLengthMax: Integer;
    FDBScaleMin: Integer;
    FDBScaleMax: Integer;

    // Field Data Type
    FFieldLength: Integer;
    FFieldScale: Integer;

    // Ignore conversion errors
    FIgnoreErrors: Boolean;
    function GetDBProvider: Word;
  protected
    procedure AssignTo(Dest: TPersistent); override;
  public
    constructor Create(Owner: TCollection); override;

    property FieldName: string read FFieldName write FFieldName;

    property DBType: Word read FDBType write FDBType;
    property DBProvider: Word read GetDBProvider;
    property DBLengthMin: Integer read FDBLengthMin write FDBLengthMin;
    property DBLengthMax: Integer read FDBLengthMax write FDBLengthMax;
    property DBScaleMin: Integer read FDBScaleMin write FDBScaleMin;
    property DBScaleMax: Integer read FDBScaleMax write FDBScaleMax;

    property FieldLength: Integer read FFieldLength write FFieldLength;
    property FieldScale: Integer read FFieldScale write FFieldScale;
    property IgnoreErrors: Boolean read FIgnoreErrors write FIgnoreErrors;
  end;

  TMapRules = class (TCollection)
  private
    function GetItem(Index: Integer): TMapRule;
    procedure SetItem(Index: Integer; Value: TMapRule);
  protected
  public
    property Items[Index: Integer]: TMapRule read GetItem write SetItem; default;
  end;

  TCRMapRule = class (TMapRule)
  private
    FDataType: Word;
  protected
    procedure AssignTo(Dest: TPersistent); override;
  public
    constructor Create(Owner: TCollection); override;

    property DataType: Word read FDataType write FDataType;
  end;

  TCRMapRules = class (TMapRules)
  private
    FEnabled: boolean;

    function GetItem(Index: Integer): TCRMapRule;
    procedure SetItem(Index: Integer; Value: TCRMapRule);
  protected
    function CheckSQLType(Rule: TMapRule; DBType, DBLength, DBScale: integer): boolean;
  public
    constructor Create; virtual;

    class function GetConverterManager: TConverterManager; virtual;

    function AddRule(const FieldName: string;
      DBType: Word; DBLengthMin, DBLengthMax, DBScaleMin, DBScaleMax: Integer;
      DataType: Word; FieldLength, FieldScale: Integer;
      IgnoreErrors: boolean): TCRMapRule;
    function DetectFieldNameMapRule(const FieldName: string; DBType, DBLength, DBScale: integer): TCRMapRule;
    function DetectDBTypeMapRule(DBType, DBLength, DBScale: integer): TCRMapRule;

    property Enabled: boolean read FEnabled write FEnabled;
    property Items[Index: Integer]: TCRMapRule read GetItem write SetItem; default;
  end;

  TFetchConverter = class
  private
    FDBType: Word;
    FDBLengthMin: Integer;
    FDBLengthMax: Integer;
    FDBScaleMin: Integer;
    FDBScaleMax: Integer;

    FDestDataType: Word;
    FInternalDataType: Word;

    FCalcLength: TCalcSizeFunc;
    FCalcScale: TCalcSizeFunc;
  protected
  public
    constructor Create(DBType: Word;
      DBLengthMin, DBLengthMax, DBScaleMin, DBScaleMax: Integer;
      DestDataType, InternalDataType: Word;
      CalcLength: TCalcSizeFunc; CalcScale: TCalcSizeFunc);

    property DBType: Word read FDBType;
    property DBLengthMin: Integer read FDBLengthMin;
    property DBLengthMax: Integer read FDBLengthMax;
    property DBScaleMin: Integer read FDBScaleMin;
    property DBScaleMax: Integer read FDBScaleMax;

    property DestDataType: Word read FDestDataType;
    property InternalDataType: Word read FInternalDataType;

    property CalcLength: TCalcSizeFunc read FCalcLength;
    property CalcScale: TCalcSizeFunc read FCalcScale;
  end;

  TOnDemandConverter = class
  private
    FSourceDataType: Word;
    FDestDataType: Word;

    FCalcLength: TCalcSizeFunc;
    FCalcScale: TCalcSizeFunc;

    FGetDataConverter: TConvertProcedure;
    FPutDataConverter: TConvertProcedure;
  protected
  public
    constructor Create(SourceDataType, DestDataType: Word;
      GetDataConverter, PutDataConverter: TConvertProcedure;
      CalcLength: TCalcSizeFunc; CalcScale: TCalcSizeFunc);

    property SourceDataType: Word read FSourceDataType write FSourceDataType;
    property DestDataType: Word read FDestDataType write FDestDataType;

    property GetDataConverter: TConvertProcedure read FGetDataConverter;
    property PutDataConverter: TConvertProcedure read FPutDataConverter;

    property CalcLength: TCalcSizeFunc read FCalcLength;
    property CalcScale: TCalcSizeFunc read FCalcScale;
  end;

  TConverterManager = class
  private
    FFetchConverters: TDAObjectList;
    FOnDemandConverters: TDAObjectList;

    function GetFetchConverter(Index: integer): TFetchConverter;
    function GetFetchConverterCount: integer;
    function GetOnDemandConverter(Index: integer): TOnDemandConverter;
    function GetOnDemandConverterCount: integer;
  protected
  public
    constructor Create;
    destructor Destroy; override;

    class function GetDBProvider: Word; virtual;

    procedure AddFetchConverter(FetchConverter: TFetchConverter); overload;
    procedure AddFetchConverter(DBType, RequiredDataType: Word); overload;
    procedure AddFetchConverter(DBType, RequiredDataType, DestDataType: Word; CalcLength: TCalcSizeFunc = nil; CalcScale: TCalcSizeFunc = nil); overload;
    procedure AddFetchConverter(DBType: Word; DBLengthMin, DBLengthMax, DBScaleMin, DBScaleMax: integer; RequiredDataType: Word); overload;
    procedure AddFetchConverter(DBType: Word; DBLengthMin, DBLengthMax, DBScaleMin, DBScaleMax: integer; RequiredDataType, DestDataType: Word; CalcLength: TCalcSizeFunc = nil; CalcScale: TCalcSizeFunc = nil); overload;
    procedure DeleteFetchConverter(Index: integer);
    procedure ClearFetchMappers;

    procedure AddOnDemandConverter(OnDemandConverter: TOnDemandConverter); overload;
    procedure AddOnDemandConverter(SourceType, DestType: Word; GetDataConverter, PutDataConverter: TConvertProcedure; CalcLength: TCalcSizeFunc = nil; CalcScale: TCalcSizeFunc = nil); overload;
    procedure DeleteOnDemandConverter(Index: integer);
    procedure ClearOnDemandConverters;

    function DetectFetchConverter(DBType: Word; DBLength, DBScale: integer; DestDataType: Word): TFetchConverter;
    function DetectOnDemandConverter(SourceDataType, DestDataType: Word): TOnDemandConverter;

    property FetchConverters[Index: integer]: TFetchConverter read GetFetchConverter;
    property FetchConverterCount: integer read GetFetchConverterCount;
    property OnDemandConverters[Index: integer]: TOnDemandConverter read GeTOnDemandConverter;
    property OnDemandConverterCount: integer read GeTOnDemandConverterCount;
  end;

  TSizeConverters = class
  public
    class function CopySize(Value: Integer): Integer; {$IFDEF CLR}static;{$ENDIF}
    class function SizeX2(Value: Integer): Integer; {$IFDEF CLR}static;{$ENDIF}
    class function SizeDiv2(Value: Integer): Integer; {$IFDEF CLR}static;{$ENDIF}
    class function Size0(Value: Integer): Integer; {$IFDEF CLR}static;{$ENDIF}
    class function Size20(Value: Integer): Integer; {$IFDEF CLR}static;{$ENDIF}
    class function Size32(Value: Integer): Integer; {$IFDEF CLR}static;{$ENDIF}
    class function GuidSize(Value: Integer): Integer; {$IFDEF CLR}static;{$ENDIF}
  end;

  TDataConverters = class
  public
    class function InternalInt8ToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalUInt8ToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalInt16ToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalUInt16ToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalInt32ToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalUInt32ToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalInt64ToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$IFDEF VER12P}
    class function InternalUInt64ToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$ENDIF}
    class function InternalSingleToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalFloatToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalExtendedToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalBCDToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function InternalFMTBCDToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function InternalBoolToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalDateToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalTimeToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalDateTimeToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function InternalSQLTimeStampToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$ENDIF}{$ENDIF}

    class function InternalStrToNumber(const Str: String; out Value: Int64): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$IFDEF VER12P}
    class function InternalStrToUNumber(const Str: String; out Value: UInt64): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$ENDIF}
    class function InternalStrToInt8(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalStrToUInt8(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalStrToInt16(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalStrToUInt16(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalStrToInt32(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalStrToUInt32(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalStrToInt64(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$IFDEF VER12P}
    class function InternalStrToUInt64(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$ENDIF}
    class function InternalStrToSingle(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalStrToFloat(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalStrToExtended(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalStrToBCD(const Str: String; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function InternalStrToFMTBCD(const Str: String; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function InternalStrToBool(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalStrToDate(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalStrToTime(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalStrToDateTime(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function InternalStrToSQLTimeStamp(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function InternalStrToGUID(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}

    class procedure InternalCopyToBlob(Source: IntPtr; SourceLen: Integer; Dest: IntPtr); {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalCopyFromBlob(Source: IntPtr; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalCopyFromBlobToBytes(Source: IntPtr; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalCopyFromBlobToVarBytes(Source: IntPtr; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalCopyFromBlobToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}

    class procedure InternalMemoToAStr(Source: IntPtr; out AStr: AnsiString); {$IFDEF USE_INLINE}inline;{$ENDIF}
    class procedure InternalMemoToWStr(Source: IntPtr; out WStr: WideString); {$IFDEF USE_INLINE}inline;{$ENDIF}
    class procedure InternalWideMemoToAStr(Source: IntPtr; out AStr: AnsiString); {$IFDEF USE_INLINE}inline;{$ENDIF}
    class procedure InternalWideMemoToWStr(Source: IntPtr; out WStr: WideString); {$IFDEF USE_INLINE}inline;{$ENDIF}
    class procedure InternalBytesToAStr(Source: IntPtr; SourceLen: Integer; out AStr: AnsiString); {$IFDEF USE_INLINE}inline;{$ENDIF}
    class procedure InternalBytesToWStr(Source: IntPtr; SourceLen: Integer; out WStr: WideString); {$IFDEF USE_INLINE}inline;{$ENDIF}
    class procedure InternalVarBytesToAStr(Source: IntPtr; out AStr: AnsiString); {$IFDEF USE_INLINE}inline;{$ENDIF}
    class procedure InternalVarBytesToWStr(Source: IntPtr; out WStr: WideString); {$IFDEF USE_INLINE}inline;{$ENDIF}

    class function InternalCopyToBytes(Source: IntPtr; SourceLen: Integer; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalCopyToVarBytes(Source: IntPtr; SourceLen: Integer; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalCopyToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen: Integer; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalExactCopyFromBytes(Source: IntPtr; SourceLen: Integer; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalExactCopyFromVarBytes(Source: IntPtr; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}

    class function InternalWriteAStr(const AStr: AnsiString; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalWritePAChar(AStr: PAChar; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalWriteExtAStr(StringHeap: TStringHeap; const AStr: AnsiString; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalWriteExtPAChar(StringHeap: TStringHeap; AStr: PAChar; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalWriteWStr(const WStr: WideString; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalWritePWChar(WStr: PWChar; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalWriteExtWStr(StringHeap: TStringHeap; const WStr: WideString; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalWriteExtPWChar(StringHeap: TStringHeap; WStr: PWChar; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}

    class function InternalInt32ToInt8(Value: Integer; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalInt32ToUInt8(Value: Integer; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalInt32ToInt16(Value: Integer; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalInt32ToUInt16(Value: Integer; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalInt32ToUInt32(Value: Integer; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}

    class function InternalInt64ToInt8(Value: Int64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalInt64ToUInt8(Value: Int64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalInt64ToInt16(Value: Int64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalInt64ToUInt16(Value: Int64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalInt64ToInt32(Value: Int64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalInt64ToUInt32(Value: Int64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$IFDEF VER12P}
    class function InternalInt64ToUInt64(Value: Int64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$ENDIF}

  {$IFDEF VER12P}
    class function InternalUInt64ToInt8(Value: UInt64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalUInt64ToUInt8(Value: UInt64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalUInt64ToInt16(Value: UInt64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalUInt64ToUInt16(Value: UInt64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalUInt64ToInt32(Value: UInt64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalUInt64ToUInt32(Value: UInt64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalUInt64ToInt64(Value: UInt64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$ENDIF}

    class function InternalSingleToInt64(Source: IntPtr; out Value: Int64): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$IFDEF VER12P}
    class function InternalSingleToUInt64(Source: IntPtr; out Value: UInt64): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$ENDIF}
    class function InternalFloatToInt64(Source: IntPtr; out Value: Int64): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$IFDEF VER12P}
    class function InternalFloatToUInt64(Source: IntPtr; out Value: UInt64): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$ENDIF}
    class function InternalExtendedToInt64(Source: IntPtr; out Value: Int64): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$IFDEF VER12P}
    class function InternalExtendedToUInt64(Source: IntPtr; out Value: UInt64): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$ENDIF}
    class function InternalBCDToInt64(Source: IntPtr; out Value: Int64): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$IFDEF VER12P}
    class function InternalBCDToUInt64(Source: IntPtr; out Value: UInt64): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$ENDIF}
    class function InternalExtendedToBCD(e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF}; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function WriteInt64AsBCD(i64: Int64; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$IFDEF VER12P}
    class function WriteUInt64AsBCD(ui64: UInt64; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$ENDIF}

  {$IFDEF VER6P}{$IFNDEF FPC}
    class function InternalFMTBCDToInt64(Source: IntPtr; out Value: Int64): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$IFDEF VER12P}
    class function InternalFMTBCDToUInt64(Source: IntPtr; out Value: UInt64): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$ENDIF}  
    class procedure InternalReadFMTBCD(Source: IntPtr; out Value: TBcd); {$IFDEF USE_INLINE}inline;{$ENDIF}
    class function InternalBCDToFMTBCD(Bcd: TBcd; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF USE_INLINE}inline;{$ENDIF}
    class procedure InternalTimeStampToSQLTimeStamp(const TS: TTimeStamp; Dest: IntPtr); {$IFDEF USE_INLINE}inline;{$ENDIF}
    class procedure InternalSQLTimeStampToTimeStamp(Source: IntPtr; out Value: TTimeStamp); {$IFDEF USE_INLINE}inline;{$ENDIF}
  {$ENDIF}{$ENDIF}

    class function CopyByte(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function CopyInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function CopyInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function CopyInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function CopyPtr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

    class function Int8ToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int8ToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int8ToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int8ToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int8ToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int8ToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER12P}
    class function Int8ToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}
    class function Int8ToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int8ToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int8ToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int8ToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function Int8ToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function Int8ToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int8ToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int8ToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int8ToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int8ToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int8ToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int8ToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int8ToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int8ToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

    class function UInt8ToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt8ToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt8ToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt8ToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt8ToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt8ToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER12P}
    class function UInt8ToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}
    class function UInt8ToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt8ToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt8ToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt8ToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function UInt8ToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function UInt8ToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt8ToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt8ToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt8ToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt8ToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt8ToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt8ToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt8ToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt8ToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

    class function Int16ToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int16ToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int16ToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int16ToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int16ToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int16ToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER12P}
    class function Int16ToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}
    class function Int16ToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int16ToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int16ToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int16ToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function Int16ToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function Int16ToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int16ToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int16ToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int16ToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int16ToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int16ToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int16ToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int16ToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int16ToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

    class function UInt16ToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt16ToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt16ToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt16ToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt16ToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt16ToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER12P}
    class function UInt16ToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}
    class function UInt16ToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt16ToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt16ToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt16ToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function UInt16ToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function UInt16ToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt16ToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt16ToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt16ToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt16ToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt16ToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt16ToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt16ToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt16ToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

    class function Int32ToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int32ToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int32ToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int32ToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int32ToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int32ToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER12P}
    class function Int32ToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}
    class function Int32ToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int32ToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int32ToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int32ToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function Int32ToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function Int32ToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int32ToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int32ToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int32ToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int32ToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int32ToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int32ToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int32ToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int32ToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

    class function UInt32ToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt32ToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt32ToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt32ToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt32ToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt32ToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER12P}
    class function UInt32ToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}
    class function UInt32ToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt32ToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt32ToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt32ToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function UInt32ToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function UInt32ToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt32ToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt32ToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt32ToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt32ToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt32ToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt32ToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt32ToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt32ToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

    class function Int64ToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int64ToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int64ToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int64ToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int64ToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int64ToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER12P}
    class function Int64ToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}
    class function Int64ToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int64ToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int64ToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int64ToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function Int64ToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function Int64ToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int64ToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int64ToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int64ToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int64ToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int64ToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int64ToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int64ToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function Int64ToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

  {$IFDEF VER12P}
    class function UInt64ToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt64ToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt64ToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt64ToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt64ToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt64ToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt64ToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt64ToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt64ToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt64ToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt64ToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function UInt64ToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function UInt64ToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt64ToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt64ToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt64ToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt64ToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt64ToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt64ToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt64ToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function UInt64ToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}

    class function SingleToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SingleToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SingleToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SingleToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SingleToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SingleToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SingleToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER12P}
    class function SingleToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}
    class function SingleToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SingleToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SingleToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function SingleToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function SingleToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SingleToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SingleToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SingleToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SingleToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SingleToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SingleToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SingleToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SingleToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

    class function FloatToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FloatToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FloatToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FloatToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FloatToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FloatToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FloatToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER12P}
    class function FloatToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}
    class function FloatToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FloatToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FloatToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function FloatToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function FloatToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FloatToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FloatToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FloatToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FloatToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FloatToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FloatToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FloatToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FloatToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

    class function ExtendedToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtendedToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtendedToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtendedToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtendedToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtendedToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtendedToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER12P}
    class function ExtendedToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}
    class function ExtendedToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtendedToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtendedToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function ExtendedToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function ExtendedToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtendedToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtendedToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtendedToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtendedToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtendedToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtendedToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtendedToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtendedToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

    class function BCDToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BCDToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BCDToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BCDToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BCDToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BCDToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BCDToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER12P}
    class function BCDToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}
    class function BCDToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BCDToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BCDToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BCDToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function BCDToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function BCDToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BCDToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BCDToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BCDToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BCDToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BCDToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BCDToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BCDToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BCDToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

  {$IFDEF VER6P}{$IFNDEF FPC}
    class function FMTBCDToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FMTBCDToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FMTBCDToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FMTBCDToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FMTBCDToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FMTBCDToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FMTBCDToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER12P}
    class function FMTBCDToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}
    class function FMTBCDToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FMTBCDToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FMTBCDToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FMTBCDToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FMTBCDToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FMTBCDToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FMTBCDToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FMTBCDToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FMTBCDToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FMTBCDToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FMTBCDToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FMTBCDToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FMTBCDToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function FMTBCDToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}

    class function BoolToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BoolToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BoolToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BoolToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BoolToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BoolToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BoolToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER12P}
    class function BoolToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}
    class function BoolToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BoolToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BoolToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BoolToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function BoolToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function BoolToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BoolToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BoolToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BoolToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BoolToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BoolToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BoolToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BoolToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

    class function DateToDateTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function DateToSQLTimeStamp(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function DateToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function DateToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function DateToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function DateToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function DateToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function DateToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function DateToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function DateToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

    class function TimeToDateTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function TimeToSQLTimeStamp(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function TimeToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function TimeToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function TimeToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function TimeToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function TimeToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function TimeToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function TimeToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function TimeToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

    class function DateTimeToDate(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function DateTimeToTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function DateTimeToSQLTimeStamp(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function DateTimeToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function DateTimeToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function DateTimeToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function DateTimeToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function DateTimeToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function DateTimeToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function DateTimeToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function DateTimeToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

  {$IFDEF VER6P}{$IFNDEF FPC}
    class function SQLTimeStampToDate(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SQLTimeStampToTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SQLTimeStampToDateTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SQLTimeStampToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SQLTimeStampToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SQLTimeStampToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SQLTimeStampToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SQLTimeStampToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SQLTimeStampToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SQLTimeStampToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function SQLTimeStampToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}

    class function AStrToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function AStrToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function AStrToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function AStrToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function AStrToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function AStrToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function AStrToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER12P}
    class function AStrToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}
    class function AStrToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function AStrToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function AStrToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function AStrToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function AStrToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function AStrToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function AStrToDate(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function AStrToTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function AStrToDateTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function AStrToSQLTimeStamp(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function AStrToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function AStrToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function AStrToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function AStrToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function AStrToMemo(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function AStrToWideMemo(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function AStrToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function AStrToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function AStrToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function AStrToGuid(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

    class function WStrToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function WStrToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function WStrToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function WStrToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function WStrToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function WStrToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function WStrToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER12P}
    class function WStrToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}
    class function WStrToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function WStrToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function WStrToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function WStrToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function WStrToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function WStrToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function WStrToDate(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function WStrToTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function WStrToDateTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function WStrToSQLTimeStamp(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function WStrToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function WStrToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function WStrToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function WStrToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function WStrToMemo(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function WStrToWideMemo(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function WStrToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function WStrToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function WStrToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function WStrToGuid(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

    class function ExtAStrToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtAStrToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtAStrToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtAStrToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtAStrToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtAStrToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtAStrToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtAStrToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtAStrToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtAStrToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtAStrToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function ExtAStrToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function ExtAStrToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtAStrToDate(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtAStrToTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtAStrToDateTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function ExtAStrToSQLTimeStamp(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function ExtAStrToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtAStrToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtAStrToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtAStrToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtAStrToMemo(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtAStrToWideMemo(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtAStrToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtAStrToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtAStrToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtAStrToGuid(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

    class function ExtWStrToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtWStrToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtWStrToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtWStrToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtWStrToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtWStrToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtWStrToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtWStrToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtWStrToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtWStrToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtWStrToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function ExtWStrToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function ExtWStrToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtWStrToDate(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtWStrToTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtWStrToDateTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function ExtWStrToSQLTimeStamp(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function ExtWStrToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtWStrToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtWStrToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtWStrToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtWStrToMemo(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtWStrToWideMemo(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtWStrToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtWStrToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtWStrToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtWStrToGuid(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

    class function BlobToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BlobToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BlobToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BlobToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BlobToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BlobToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BlobToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER12P}
    class function BlobToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}
    class function BlobToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BlobToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BlobToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BlobToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function BlobToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function BlobToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BlobToDate(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BlobToTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BlobToDateTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function BlobToSQLTimeStamp(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function BlobToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BlobToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BlobToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

    class function MemoToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function MemoToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function MemoToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function MemoToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

    class function WideMemoToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function WideMemoToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function WideMemoToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function WideMemoToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

    class function BytesToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BytesToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BytesToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BytesToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BytesToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BytesToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BytesToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER12P}
    class function BytesToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}
    class function BytesToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BytesToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BytesToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BytesToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function BytesToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function BytesToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BytesToDate(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BytesToTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BytesToDateTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function BytesToSQLTimeStamp(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function BytesToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BytesToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BytesToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BytesToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BytesToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BytesToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BytesToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function BytesToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

    class function VarBytesToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function VarBytesToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function VarBytesToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function VarBytesToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function VarBytesToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function VarBytesToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function VarBytesToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER12P}
    class function VarBytesToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}
    class function VarBytesToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function VarBytesToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function VarBytesToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function VarBytesToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function VarBytesToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function VarBytesToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function VarBytesToDate(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function VarBytesToTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function VarBytesToDateTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function VarBytesToSQLTimeStamp(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function VarBytesToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function VarBytesToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function VarBytesToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function VarBytesToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function VarBytesToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function VarBytesToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function VarBytesToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function VarBytesToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

    class function ExtVarBytesToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtVarBytesToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtVarBytesToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtVarBytesToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtVarBytesToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtVarBytesToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtVarBytesToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER12P}
    class function ExtVarBytesToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}
    class function ExtVarBytesToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtVarBytesToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtVarBytesToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtVarBytesToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function ExtVarBytesToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function ExtVarBytesToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtVarBytesToDate(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtVarBytesToTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtVarBytesToDateTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$IFDEF VER6P}{$IFNDEF FPC}
    class function ExtVarBytesToSQLTimeStamp(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  {$ENDIF}{$ENDIF}
    class function ExtVarBytesToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtVarBytesToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtVarBytesToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtVarBytesToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtVarBytesToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtVarBytesToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtVarBytesToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function ExtVarBytesToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}

    class function GuidToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function GuidToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function GuidToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
    class function GuidToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus; {$IFDEF CLR}static;{$ENDIF}
  end;

const
  ConvertStatusErrors: array [TConvertStatus] of string = (
    '', SInvalidIntegerValue, SInvalidNumericValue,
    SInvalidDateTimeValue, SInvalidBooleanValue,
    SInvalidGUIDValue, SInvalidIntervalValue,
    SInvalidDataMapping, SInvalidBinaryValue, SInvalidBlobValue,
    SValueOutOfRange, SValueTooLong, SInvalidValueScale,
    SFractionTruncated, SDataTruncated,
    SStringTooLong, SBinaryTooLong);

var
  DBTypeInfos: TDBTypeInfos;

implementation

{ EDataTypeMappingError }

constructor EDataTypeMappingError.Create;
begin
  inherited Create('Unexpected data type mapping error');
end;

{ TDBTypeInfo }

constructor TDBTypeInfo.Create(DBType: Word; const Name: string; Length, Scale: boolean);
begin
  inherited Create;

  FDBType := DBType;
  FName := Name;
  FLength := Length;
  FScale := Scale;
end;

function TDBTypeInfo.GetDBProvider: Word;
begin
  Result := (FDBType div 100) * 100;
end;

{ TDBTypeInfos }

constructor TDBTypeInfos.Create;
begin
  inherited;

  FTypeInfos := TDAObjectList.Create;
end;

destructor TDBTypeInfos.Destroy;
begin
  Clear;
  FTypeInfos.Free;
  inherited;
end;

function TDBTypeInfos.GetCount: Integer;
begin
  Result := FTypeInfos.Count;
end;

function TDBTypeInfos.GetTypeInfo(Index: integer): TDBTypeInfo;
begin
  Result := TDBTypeInfo(FTypeInfos[Index]);
end;

procedure TDBTypeInfos.Add(DBType: Word; const Name: string; Length, Scale: boolean);
var
  DBTypeInfo: TDBTypeInfo;
begin
  DBTypeInfo := TDBTypeInfo.Create(DBType, Name, Length, Scale);
  FTypeInfos.Add(DBTypeInfo);
end;

procedure TDBTypeInfos.Delete(Index: Integer);
begin
  FTypeInfos.Delete(Index);
end;

procedure TDBTypeInfos.Clear;
begin
  FTypeInfos.Clear;
end;

procedure TDBTypeInfos.Validate(DBType: Word; LengthMin, LengthMax, ScaleMin, ScaleMax: Integer; IsDBTypeRequired: boolean);
var
  DBTypeInfo: TDBTypeinfo;
begin
  if DBType = 0 then
    if not IsDBTypeRequired then
      exit
    else
      raise EInvalidDBTypeMapping.Create(SNotDefinedDBType);

  DBTypeInfo := FindTypeInfo(DBType);
  if DBTypeInfo <> nil then begin
    if (DBTypeInfo.Length = False) and ((LengthMin <> -1) or (LengthMax <> -1)) then
      raise EInvalidDBTypeMapping.CreateFmt(SInvalidDBLength, [DBTypeInfo.Name]);

    if (DBTypeInfo.Scale = False) and ((ScaleMin <> -1) or (ScaleMax <> -1)) then
      raise EInvalidDBTypeMapping.CreateFmt(SInvalidDBScale, [DBTypeInfo.Name]);
  end
  else
    raise EInvalidDBTypeMapping.CreateFmt(SUnsupportedDBType, [IntToStr(DBType)]);
end;

function TDBTypeInfos.FindTypeInfo(DBType: Word): TDBTypeInfo;
var
  i: integer;
begin
  Result := nil;

  for i := 0 to Count - 1 do
    if TypeInfos[i].DBType = DBType then begin
      Result := TypeInfos[i];
      Exit;
    end;
end;

function TDBTypeInfos.FindTypeInfo(const Name: string; DBProvider: Word): TDBTypeInfo;
var
  UName: string;
  i: integer;
begin
  Result := nil;

  UName := AnsiUpperCase(Trim(Name));
  for i := 0 to Count - 1 do
    if (DBProvider = 0) or (DBProvider = TypeInfos[i].DBProvider) then
      if AnsiUpperCase(TypeInfos[i].Name) = UName then begin
        Result := TypeInfos[i];
        Exit;
      end;
end;

{ TMapRule }

constructor TMapRule.Create(Owner: TCollection);
begin
  inherited Create(Owner);

  FFieldName := '';

  FDBType := 0;
  FDBLengthMin := -1;
  FDBLengthMax := -1;
  FDBScaleMin := -1;
  FDBScaleMax := -1;

  FFieldLength := -1;
  FFieldScale := -1;

  FIgnoreErrors := False;
end;

function TMapRule.GetDBProvider: Word;
begin
  Result := (FDBType div 100) * 100;
end;

procedure TMapRule.AssignTo(Dest: TPersistent);
begin
  if Dest is TMapRule then begin
    TMapRule(Dest).FFieldName    := FFieldName;

    TMapRule(Dest).FDBType       := FDBType;

    TMapRule(Dest).FDBLengthMin  := FDBLengthMin;
    TMapRule(Dest).FDBLengthMax  := FDBLengthMax;
    TMapRule(Dest).FDBScaleMin   := FDBScaleMin;
    TMapRule(Dest).FDBScaleMax   := FDBScaleMax;

    TMapRule(Dest).FFieldLength  := FFieldLength;
    TMapRule(Dest).FFieldScale   := FFieldScale;

    TMapRule(Dest).FIgnoreErrors := FIgnoreErrors;
  end;
end;

{ TMapRules }

function TMapRules.GetItem(Index: Integer): TMapRule;
begin
  Result := TMapRule(inherited GetItem(Index));
end;

procedure TMapRules.SetItem(Index: Integer; Value: TMapRule);
begin
  inherited SetItem(Index, TCollectionItem(Value));
end;

{ TCRMapRule }

constructor TCRMapRule.Create(Owner: TCollection);
begin
  inherited Create(Owner);

  FDataType := 0;
end;

procedure TCRMapRule.AssignTo(Dest: TPersistent);
begin
  inherited;

  if Dest is TCRMapRule then
    TCRMapRule(Dest).FDataType := FDataType;
end;

{ TCRMapRules }

constructor TCRMapRules.Create;
begin
  inherited Create(TCRMapRule);
  FEnabled := True;
end;

function TCRMapRules.GetItem(Index: Integer): TCRMapRule;
begin
  Result := TCRMapRule(inherited GetItem(Index));
end;

procedure TCRMapRules.SetItem(Index: Integer; Value: TCRMapRule);
begin
  inherited SetItem(Index, TMapRule(Value));
end;

class function TCRMapRules.GetConverterManager: TConverterManager;
begin
  Result := nil;
  Assert(False); // Must be overriden
end;

function TCRMapRules.AddRule(const FieldName: string;
  DBType: Word; DBLengthMin, DBLengthMax, DBScaleMin, DBScaleMax: Integer;
  DataType: Word; FieldLength, FieldScale: Integer;
  IgnoreErrors: boolean): TCRMapRule;
begin
  DBTypeInfos.Validate(DBType, DBLengthMin, DBLengthMax, DBScaleMin, DBScaleMax, FieldName = '');

  Result := TCRMapRule.Create(Self);

  Result.FieldName := FieldName;

  Result.DBType := DBType;
  Result.DBLengthMin := DBLengthMin;
  Result.DBLengthMax := DBLengthMax;
  Result.DBScaleMin := DBScaleMin;
  Result.DBScaleMax := DBScaleMax;

  Result.DataType := DataType;
  Result.FieldLength := FieldLength;
  Result.FieldScale := FieldScale;

  Result.IgnoreErrors := IgnoreErrors;
end;

function TCRMapRules.CheckSQLType(Rule: TMapRule; DBType, DBLength, DBScale: integer): boolean;
begin
  Result := (Rule.DBType = DBType) and
   ((DBLength = -1) or ((Rule.DBLengthMin = -1) or (DBLength >= Rule.DBLengthMin)) and
                       ((Rule.DBLengthMax = -1) or (DBLength <= Rule.DBLengthMax))) and
   ((DBScale  = -1) or ((Rule.DBScaleMin  = -1) or (DBScale  >= Rule.DBScaleMin)) and
                       ((Rule.DBScaleMax  = -1) or (DBScale  <= Rule.DBScaleMax)));
end;

function TCRMapRules.DetectFieldNameMapRule(const FieldName: string; DBType, DBLength, DBScale: integer): TCRMapRule;
var
  i: Integer;
begin
  for i := 0 to Count - 1 do begin
    Result := Items[i];
    if (Result.FieldName <> '') and
       (AnsiUpperCase(Result.FieldName) = AnsiUpperCase(FieldName)) and
       ((Result.DBType = 0) or CheckSQLType(Result, DBType, DBLength, DBScale))
    then
      exit;
  end;

  Result := nil;
end;

function TCRMapRules.DetectDBTypeMapRule(DBType, DBLength, DBScale: integer): TCRMapRule;
var
  i: Integer;
begin
  for i := 0 to Count - 1 do begin
    Result := Items[i];
    if (Result.DBType <> 0) and CheckSQLType(Result, DBType, DBLength, DBScale) then
      exit;
  end;

  Result := nil;
end;

{ TFetchConverter }

constructor TFetchConverter.Create(DBType: Word; DBLengthMin, DBLengthMax, DBScaleMin, DBScaleMax: integer;
  DestDataType, InternalDataType: Word; CalcLength: TCalcSizeFunc; CalcScale: TCalcSizeFunc);
begin
  inherited Create;

  FDBType := DBType;
  FDBLengthMin := DBLengthMin;
  FDBLengthMax := DBLengthMax;
  FDBScaleMin := DBScaleMin;
  FDBScaleMax := DBScaleMax;

  FDestDataType := DestDataType;
  FInternalDataType := InternalDataType;

  FCalcLength := CalcLength;
  FCalcScale := CalcScale;
end;

{ TOnDemandConverter }

constructor TOnDemandConverter.Create(SourceDataType, DestDataType: Word;
  GetDataConverter, PutDataConverter: TConvertProcedure;
  CalcLength: TCalcSizeFunc; CalcScale: TCalcSizeFunc);
begin
  inherited Create;

  FSourceDataType := SourceDataType;
  FDestDataType := DestDataType;

  FGetDataConverter := GetDataConverter;
  FPutDataConverter := PutDataConverter;

  FCalcLength := CalcLength;
  FCalcScale := CalcScale;
end;

{ TConverterManager }

constructor TConverterManager.Create;
begin
  inherited Create;

  FFetchConverters := TDAObjectList.Create;
  FOnDemandConverters := TDAObjectList.Create;

  AddOnDemandConverter(dtBoolean, dtInt8, TDataConverters.BoolToInt8, TDataConverters.Int8ToBool);
  AddOnDemandConverter(dtBoolean, dtUInt8, TDataConverters.BoolToUInt8, TDataConverters.UInt8ToBool);
  AddOnDemandConverter(dtBoolean, dtSmallint, TDataConverters.BoolToInt16, TDataConverters.Int16ToBool);
  AddOnDemandConverter(dtBoolean, dtWord, TDataConverters.BoolToUInt16, TDataConverters.UInt16ToBool);
  AddOnDemandConverter(dtBoolean, dtInteger, TDataConverters.BoolToInt32, TDataConverters.Int32ToBool);
  AddOnDemandConverter(dtBoolean, dtUInt32, TDataConverters.BoolToUInt32, TDataConverters.UInt32ToBool);
  AddOnDemandConverter(dtBoolean, dtInt64, TDataConverters.BoolToInt64, TDataConverters.Int64ToBool);
  AddOnDemandConverter(dtBoolean, dtSingle, TDataConverters.BoolToSingle, TDataConverters.SingleToBool);
  AddOnDemandConverter(dtBoolean, dtFloat, TDataConverters.BoolToFloat, TDataConverters.FloatToBool);
  AddOnDemandConverter(dtBoolean, dtCurrency, TDataConverters.BoolToFloat, TDataConverters.FloatToBool);
  AddOnDemandConverter(dtBoolean, dtExtended, TDataConverters.BoolToExtended, TDataConverters.ExtendedToBool);
  AddOnDemandConverter(dtBoolean, dtBCD, TDataConverters.BoolToBCD, TDataConverters.BCDToBool, TSizeConverters.Size0, TSizeConverters.Size0);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtBoolean, dtFMTBCD, TDataConverters.BoolToFMTBCD, TDataConverters.FMTBCDToBool, TSizeConverters.Size0, TSizeConverters.Size0);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtBoolean, dtString, TDataConverters.BoolToAStr, TDataConverters.AStrToBool);
  AddOnDemandConverter(dtBoolean, dtExtString, TDataConverters.BoolToExtAStr, TDataConverters.ExtAStrToBool);
  AddOnDemandConverter(dtBoolean, dtWideString, TDataConverters.BoolToWStr, TDataConverters.WStrToBool);
  AddOnDemandConverter(dtBoolean, dtExtWideString, TDataConverters.BoolToExtWStr, TDataConverters.ExtWStrToBool);
  AddOnDemandConverter(dtBoolean, dtBytes, TDataConverters.BoolToBytes, TDataConverters.BytesToBool);
  AddOnDemandConverter(dtBoolean, dtVarBytes, TDataConverters.BoolToVarBytes, TDataConverters.VarBytesToBool);
  AddOnDemandConverter(dtBoolean, dtExtVarBytes, TDataConverters.BoolToExtVarBytes, TDataConverters.ExtVarBytesToBool);

  AddOnDemandConverter(dtInt8, dtBoolean, TDataConverters.Int8ToBool, TDataConverters.BoolToInt8);
  AddOnDemandConverter(dtInt8, dtUInt8, TDataConverters.Int8ToUInt8, TDataConverters.UInt8ToInt8);
  AddOnDemandConverter(dtInt8, dtSmallint, TDataConverters.Int8ToInt16, TDataConverters.Int16ToInt8);
  AddOnDemandConverter(dtInt8, dtWord, TDataConverters.Int8ToUInt16, TDataConverters.UInt16ToInt8);
  AddOnDemandConverter(dtInt8, dtInteger, TDataConverters.Int8ToInt32, TDataConverters.Int32ToInt8);
  AddOnDemandConverter(dtInt8, dtUInt32, TDataConverters.Int8ToUInt32, TDataConverters.UInt32ToInt8);
  AddOnDemandConverter(dtInt8, dtInt64, TDataConverters.Int8ToInt64, TDataConverters.Int64ToInt8);
  AddOnDemandConverter(dtInt8, dtSingle, TDataConverters.Int8ToSingle, TDataConverters.SingleToInt8);
  AddOnDemandConverter(dtInt8, dtFloat, TDataConverters.Int8ToFloat, TDataConverters.FloatToInt8);
  AddOnDemandConverter(dtInt8, dtCurrency, TDataConverters.Int8ToFloat, TDataConverters.FloatToInt8);
  AddOnDemandConverter(dtInt8, dtExtended, TDataConverters.Int8ToExtended, TDataConverters.ExtendedToInt8);
  AddOnDemandConverter(dtInt8, dtBCD, TDataConverters.Int8ToBCD, TDataConverters.BCDToInt8, TSizeConverters.Size0, TSizeConverters.Size0);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtInt8, dtFMTBCD, TDataConverters.Int8ToFMTBCD, TDataConverters.FMTBCDToInt8, TSizeConverters.Size0, TSizeConverters.Size0);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtInt8, dtString, TDataConverters.Int8ToAStr, TDataConverters.AStrToInt8);
  AddOnDemandConverter(dtInt8, dtExtString, TDataConverters.Int8ToExtAStr, TDataConverters.ExtAStrToInt8);
  AddOnDemandConverter(dtInt8, dtWideString, TDataConverters.Int8ToWStr, TDataConverters.WStrToInt8);
  AddOnDemandConverter(dtInt8, dtExtWideString, TDataConverters.Int8ToExtWStr, TDataConverters.ExtWStrToInt8);
  AddOnDemandConverter(dtInt8, dtBytes, TDataConverters.Int8ToBytes, TDataConverters.BytesToInt8);
  AddOnDemandConverter(dtInt8, dtVarBytes, TDataConverters.Int8ToVarBytes, TDataConverters.VarBytesToInt8);
  AddOnDemandConverter(dtInt8, dtExtVarBytes, TDataConverters.Int8ToExtVarBytes, TDataConverters.ExtVarBytesToInt8);

  AddOnDemandConverter(dtUInt8, dtBoolean, TDataConverters.UInt8ToBool, TDataConverters.BoolToUInt8);
  AddOnDemandConverter(dtUInt8, dtInt8, TDataConverters.UInt8ToInt8, TDataConverters.Int8ToUInt8);
  AddOnDemandConverter(dtUInt8, dtSmallint, TDataConverters.UInt8ToInt16, TDataConverters.Int16ToUInt8);
  AddOnDemandConverter(dtUInt8, dtWord, TDataConverters.UInt8ToUInt16, TDataConverters.UInt16ToUInt8);
  AddOnDemandConverter(dtUInt8, dtInteger, TDataConverters.UInt8ToInt32, TDataConverters.Int32ToUInt8);
  AddOnDemandConverter(dtUInt8, dtUInt32, TDataConverters.UInt8ToUInt32, TDataConverters.UInt32ToUInt8);
  AddOnDemandConverter(dtUInt8, dtInt64, TDataConverters.UInt8ToInt64, TDataConverters.Int64ToUInt8);
  AddOnDemandConverter(dtUInt8, dtSingle, TDataConverters.UInt8ToSingle, TDataConverters.SingleToUInt8);
  AddOnDemandConverter(dtUInt8, dtFloat, TDataConverters.UInt8ToFloat, TDataConverters.FloatToUInt8);
  AddOnDemandConverter(dtUInt8, dtCurrency, TDataConverters.UInt8ToFloat, TDataConverters.FloatToUInt8);
  AddOnDemandConverter(dtUInt8, dtExtended, TDataConverters.UInt8ToExtended, TDataConverters.ExtendedToUInt8);
  AddOnDemandConverter(dtUInt8, dtBCD, TDataConverters.UInt8ToBCD, TDataConverters.BCDToUInt8, TSizeConverters.Size0, TSizeConverters.Size0);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtUInt8, dtFMTBCD, TDataConverters.UInt8ToFMTBCD, TDataConverters.FMTBCDToUInt8, TSizeConverters.Size0, TSizeConverters.Size0);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtUInt8, dtString, TDataConverters.UInt8ToAStr, TDataConverters.AStrToUInt8);
  AddOnDemandConverter(dtUInt8, dtExtString, TDataConverters.UInt8ToExtAStr, TDataConverters.ExtAStrToUInt8);
  AddOnDemandConverter(dtUInt8, dtWideString, TDataConverters.UInt8ToWStr, TDataConverters.WStrToUInt8);
  AddOnDemandConverter(dtUInt8, dtExtWideString, TDataConverters.UInt8ToExtWStr, TDataConverters.ExtWStrToUInt8);
  AddOnDemandConverter(dtUInt8, dtBytes, TDataConverters.UInt8ToBytes, TDataConverters.BytesToUInt8);
  AddOnDemandConverter(dtUInt8, dtVarBytes, TDataConverters.UInt8ToVarBytes, TDataConverters.VarBytesToUInt8);
  AddOnDemandConverter(dtUInt8, dtExtVarBytes, TDataConverters.UInt8ToExtVarBytes, TDataConverters.ExtVarBytesToUInt8);

  AddOnDemandConverter(dtSmallint, dtBoolean, TDataConverters.Int16ToBool, TDataConverters.BoolToInt16);
  AddOnDemandConverter(dtSmallint, dtInt8, TDataConverters.Int16ToInt8, TDataConverters.Int8ToInt16);
  AddOnDemandConverter(dtSmallint, dtUInt8, TDataConverters.Int16ToUInt8, TDataConverters.UInt8ToInt16);
  AddOnDemandConverter(dtSmallint, dtInteger, TDataConverters.Int16ToInt32, TDataConverters.Int32ToInt16);
  AddOnDemandConverter(dtSmallint, dtWord, TDataConverters.Int16ToUInt16, TDataConverters.UInt16ToInt16);
  AddOnDemandConverter(dtSmallint, dtUInt32, TDataConverters.Int16ToUInt32, TDataConverters.UInt32ToInt16);
  AddOnDemandConverter(dtSmallint, dtInt64, TDataConverters.Int16ToInt64, TDataConverters.Int64ToInt16);
  AddOnDemandConverter(dtSmallint, dtSingle, TDataConverters.Int16ToSingle, TDataConverters.SingleToInt16);
  AddOnDemandConverter(dtSmallint, dtFloat, TDataConverters.Int16ToFloat, TDataConverters.FloatToInt16);
  AddOnDemandConverter(dtSmallint, dtCurrency, TDataConverters.Int16ToFloat, TDataConverters.FloatToInt16);
  AddOnDemandConverter(dtSmallint, dtExtended, TDataConverters.Int16ToExtended, TDataConverters.ExtendedToInt16);
  AddOnDemandConverter(dtSmallint, dtBCD, TDataConverters.Int16ToBCD, TDataConverters.BCDToInt16, TSizeConverters.Size0, TSizeConverters.Size0);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtSmallint, dtFMTBCD, TDataConverters.Int16ToFMTBCD, TDataConverters.FMTBCDToInt16, TSizeConverters.Size0, TSizeConverters.Size0);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtSmallint, dtString, TDataConverters.Int16ToAStr, TDataConverters.AStrToInt16);
  AddOnDemandConverter(dtSmallint, dtExtString, TDataConverters.Int16ToExtAStr, TDataConverters.ExtAStrToInt16);
  AddOnDemandConverter(dtSmallint, dtWideString, TDataConverters.Int16ToWStr, TDataConverters.WStrToInt16);
  AddOnDemandConverter(dtSmallint, dtExtWideString, TDataConverters.Int16ToExtWStr, TDataConverters.ExtWStrToInt16);
  AddOnDemandConverter(dtSmallint, dtBytes, TDataConverters.Int16ToBytes, TDataConverters.BytesToInt16);
  AddOnDemandConverter(dtSmallint, dtVarBytes, TDataConverters.Int16ToVarBytes, TDataConverters.VarBytesToInt16);
  AddOnDemandConverter(dtSmallint, dtExtVarBytes, TDataConverters.Int16ToExtVarBytes, TDataConverters.ExtVarBytesToInt16);

  AddOnDemandConverter(dtWord, dtBoolean, TDataConverters.UInt16ToBool, TDataConverters.BoolToUInt16);
  AddOnDemandConverter(dtWord, dtInt8, TDataConverters.UInt16ToInt8, TDataConverters.Int8ToUInt16);
  AddOnDemandConverter(dtWord, dtUInt8, TDataConverters.UInt16ToUInt8, TDataConverters.UInt8ToUInt16);
  AddOnDemandConverter(dtWord, dtSmallint, TDataConverters.UInt16ToInt16, TDataConverters.Int16ToUInt16);
  AddOnDemandConverter(dtWord, dtInteger, TDataConverters.UInt16ToInt32, TDataConverters.Int32ToUInt16);
  AddOnDemandConverter(dtWord, dtUInt32, TDataConverters.UInt16ToUInt32, TDataConverters.UInt32ToUInt16);
  AddOnDemandConverter(dtWord, dtInt64, TDataConverters.UInt16ToInt64, TDataConverters.Int64ToUInt16);
  AddOnDemandConverter(dtWord, dtSingle, TDataConverters.UInt16ToSingle, TDataConverters.SingleToUInt16);
  AddOnDemandConverter(dtWord, dtFloat, TDataConverters.UInt16ToFloat, TDataConverters.FloatToUInt16);
  AddOnDemandConverter(dtWord, dtCurrency, TDataConverters.UInt16ToFloat, TDataConverters.FloatToUInt16);
  AddOnDemandConverter(dtWord, dtExtended, TDataConverters.UInt16ToExtended, TDataConverters.ExtendedToUInt16);
  AddOnDemandConverter(dtWord, dtBCD, TDataConverters.UInt16ToBCD, TDataConverters.BCDToUInt16, TSizeConverters.Size0, TSizeConverters.Size0);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtWord, dtFMTBCD, TDataConverters.UInt16ToFMTBCD, TDataConverters.FMTBCDToUInt16, TSizeConverters.Size0, TSizeConverters.Size0);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtWord, dtString, TDataConverters.UInt16ToAStr, TDataConverters.AStrToUInt16);
  AddOnDemandConverter(dtWord, dtExtString, TDataConverters.UInt16ToExtAStr, TDataConverters.ExtAStrToUInt16);
  AddOnDemandConverter(dtWord, dtWideString, TDataConverters.UInt16ToWStr, TDataConverters.WStrToUInt16);
  AddOnDemandConverter(dtWord, dtExtWideString, TDataConverters.UInt16ToExtWStr, TDataConverters.ExtWStrToUInt16);
  AddOnDemandConverter(dtWord, dtBytes, TDataConverters.UInt16ToBytes, TDataConverters.BytesToUInt16);
  AddOnDemandConverter(dtWord, dtVarBytes, TDataConverters.UInt16ToVarBytes, TDataConverters.VarBytesToUInt16);
  AddOnDemandConverter(dtWord, dtExtVarBytes, TDataConverters.UInt16ToExtVarBytes, TDataConverters.ExtVarBytesToUInt16);

  AddOnDemandConverter(dtInteger, dtBoolean, TDataConverters.Int32ToBool, TDataConverters.BoolToInt32);
  AddOnDemandConverter(dtInteger, dtInt8, TDataConverters.Int32ToInt8, TDataConverters.Int8ToInt32);
  AddOnDemandConverter(dtInteger, dtUInt8, TDataConverters.Int32ToUInt8, TDataConverters.UInt8ToInt32);
  AddOnDemandConverter(dtInteger, dtSmallint, TDataConverters.Int32ToInt16, TDataConverters.Int16ToInt32);
  AddOnDemandConverter(dtInteger, dtWord, TDataConverters.Int32ToUInt16, TDataConverters.UInt16ToInt32);
  AddOnDemandConverter(dtInteger, dtUInt32, TDataConverters.Int32ToUInt32, TDataConverters.UInt32ToInt32);
  AddOnDemandConverter(dtInteger, dtInt64, TDataConverters.Int32ToInt64, TDataConverters.Int64ToInt32);
  AddOnDemandConverter(dtInteger, dtSingle, TDataConverters.Int32ToSingle, TDataConverters.SingleToInt32);
  AddOnDemandConverter(dtInteger, dtFloat, TDataConverters.Int32ToFloat, TDataConverters.FloatToInt32);
  AddOnDemandConverter(dtInteger, dtCurrency, TDataConverters.Int32ToFloat, TDataConverters.FloatToInt32);
  AddOnDemandConverter(dtInteger, dtExtended, TDataConverters.Int32ToExtended, TDataConverters.ExtendedToInt32);
  AddOnDemandConverter(dtInteger, dtBCD, TDataConverters.Int32ToBCD, TDataConverters.BCDToInt32, TSizeConverters.Size0, TSizeConverters.Size0);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtInteger, dtFMTBCD, TDataConverters.Int32ToFMTBCD, TDataConverters.FMTBCDToInt32, TSizeConverters.Size0, TSizeConverters.Size0);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtInteger, dtString, TDataConverters.Int32ToAStr, TDataConverters.AStrToInt32);
  AddOnDemandConverter(dtInteger, dtExtString, TDataConverters.Int32ToExtAStr, TDataConverters.ExtAStrToInt32);
  AddOnDemandConverter(dtInteger, dtWideString, TDataConverters.Int32ToWStr, TDataConverters.WStrToInt32);
  AddOnDemandConverter(dtInteger, dtExtWideString, TDataConverters.Int32ToExtWStr, TDataConverters.ExtWStrToInt32);
  AddOnDemandConverter(dtInteger, dtBytes, TDataConverters.Int32ToBytes, TDataConverters.BytesToInt32);
  AddOnDemandConverter(dtInteger, dtVarBytes, TDataConverters.Int32ToVarBytes, TDataConverters.VarBytesToInt32);
  AddOnDemandConverter(dtInteger, dtExtVarBytes, TDataConverters.Int32ToExtVarBytes, TDataConverters.ExtVarBytesToInt32);

  AddOnDemandConverter(dtUInt32, dtBoolean, TDataConverters.UInt32ToBool, TDataConverters.BoolToUInt32);
  AddOnDemandConverter(dtUInt32, dtInt8, TDataConverters.UInt32ToInt8, TDataConverters.Int8ToUInt32);
  AddOnDemandConverter(dtUInt32, dtUInt8, TDataConverters.UInt32ToUInt8, TDataConverters.UInt8ToUInt32);
  AddOnDemandConverter(dtUInt32, dtSmallint, TDataConverters.UInt32ToInt16, TDataConverters.Int16ToUInt32);
  AddOnDemandConverter(dtUInt32, dtWord, TDataConverters.UInt32ToUInt16, TDataConverters.UInt16ToUInt32);
  AddOnDemandConverter(dtUInt32, dtInteger, TDataConverters.UInt32ToInt32, TDataConverters.Int32ToUInt32);
  AddOnDemandConverter(dtUInt32, dtInt64, TDataConverters.UInt32ToInt64, TDataConverters.Int64ToUInt32);
  AddOnDemandConverter(dtUInt32, dtSingle, TDataConverters.UInt32ToSingle, TDataConverters.SingleToUInt32);
  AddOnDemandConverter(dtUInt32, dtFloat, TDataConverters.UInt32ToFloat, TDataConverters.FloatToUInt32);
  AddOnDemandConverter(dtUInt32, dtCurrency, TDataConverters.UInt32ToFloat, TDataConverters.FloatToUInt32);
  AddOnDemandConverter(dtUInt32, dtExtended, TDataConverters.UInt32ToExtended, TDataConverters.ExtendedToUInt32);
  AddOnDemandConverter(dtUInt32, dtBCD, TDataConverters.UInt32ToBCD, TDataConverters.BCDToUInt32, TSizeConverters.Size0, TSizeConverters.Size0);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtUInt32, dtFMTBCD, TDataConverters.UInt32ToFMTBCD, TDataConverters.FMTBCDToUInt32, TSizeConverters.Size0, TSizeConverters.Size0);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtUInt32, dtString, TDataConverters.UInt32ToAStr, TDataConverters.AStrToUInt32);
  AddOnDemandConverter(dtUInt32, dtExtString, TDataConverters.UInt32ToExtAStr, TDataConverters.ExtAStrToUInt32);
  AddOnDemandConverter(dtUInt32, dtWideString, TDataConverters.UInt32ToWStr, TDataConverters.WStrToUInt32);
  AddOnDemandConverter(dtUInt32, dtExtWideString, TDataConverters.UInt32ToExtWStr, TDataConverters.ExtWStrToUInt32);
  AddOnDemandConverter(dtUInt32, dtBytes, TDataConverters.UInt32ToBytes, TDataConverters.BytesToUInt32);
  AddOnDemandConverter(dtUInt32, dtVarBytes, TDataConverters.UInt32ToVarBytes, TDataConverters.VarBytesToUInt32);
  AddOnDemandConverter(dtUInt32, dtExtVarBytes, TDataConverters.UInt32ToExtVarBytes, TDataConverters.ExtVarBytesToUInt32);

  AddOnDemandConverter(dtInt64, dtBoolean, TDataConverters.Int64ToBool, TDataConverters.BoolToInt64);
  AddOnDemandConverter(dtInt64, dtInt8, TDataConverters.Int64ToInt8, TDataConverters.Int8ToInt64);
  AddOnDemandConverter(dtInt64, dtUInt8, TDataConverters.Int64ToUInt8, TDataConverters.UInt8ToInt64);
  AddOnDemandConverter(dtInt64, dtSmallint, TDataConverters.Int64ToInt16, TDataConverters.Int16ToInt64);
  AddOnDemandConverter(dtInt64, dtWord, TDataConverters.Int64ToUInt16, TDataConverters.UInt16ToInt64);
  AddOnDemandConverter(dtInt64, dtInteger, TDataConverters.Int64ToInt32, TDataConverters.Int32ToInt64);
  AddOnDemandConverter(dtInt64, dtUInt32, TDataConverters.Int64ToUInt32, TDataConverters.UInt32ToInt64);
  AddOnDemandConverter(dtInt64, dtSingle, TDataConverters.Int64ToSingle, TDataConverters.SingleToInt64);
  AddOnDemandConverter(dtInt64, dtFloat, TDataConverters.Int64ToFloat, TDataConverters.FloatToInt64);
  AddOnDemandConverter(dtInt64, dtCurrency, TDataConverters.Int64ToFloat, TDataConverters.FloatToInt64);
  AddOnDemandConverter(dtInt64, dtExtended, TDataConverters.Int64ToExtended, TDataConverters.ExtendedToInt64);
  AddOnDemandConverter(dtInt64, dtBCD, TDataConverters.Int64ToBCD, TDataConverters.BCDToInt64, TSizeConverters.Size0, TSizeConverters.Size0);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtInt64, dtFMTBCD, TDataConverters.Int64ToFMTBCD, TDataConverters.FMTBCDToInt64, TSizeConverters.Size0, TSizeConverters.Size0);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtInt64, dtString, TDataConverters.Int64ToAStr, TDataConverters.AStrToInt64);
  AddOnDemandConverter(dtInt64, dtExtString, TDataConverters.Int64ToExtAStr, TDataConverters.ExtAStrToInt64);
  AddOnDemandConverter(dtInt64, dtWideString, TDataConverters.Int64ToWStr, TDataConverters.WStrToInt64);
  AddOnDemandConverter(dtInt64, dtExtWideString, TDataConverters.Int64ToExtWStr, TDataConverters.ExtWStrToInt64);
  AddOnDemandConverter(dtInt64, dtBytes, TDataConverters.Int64ToBytes, TDataConverters.BytesToInt64);
  AddOnDemandConverter(dtInt64, dtVarBytes, TDataConverters.Int64ToVarBytes, TDataConverters.VarBytesToInt64);
  AddOnDemandConverter(dtInt64, dtExtVarBytes, TDataConverters.Int64ToExtVarBytes, TDataConverters.ExtVarBytesToInt64);

  AddOnDemandConverter(dtSingle, dtBoolean, TDataConverters.SingleToBool, TDataConverters.BoolToSingle);
  AddOnDemandConverter(dtSingle, dtInt8, TDataConverters.SingleToInt8, TDataConverters.Int8ToSingle);
  AddOnDemandConverter(dtSingle, dtUInt8, TDataConverters.SingleToUInt8, TDataConverters.UInt8ToSingle);
  AddOnDemandConverter(dtSingle, dtSmallint, TDataConverters.SingleToInt16, TDataConverters.Int16ToSingle);
  AddOnDemandConverter(dtSingle, dtWord, TDataConverters.SingleToUInt16, TDataConverters.UInt16ToSingle);
  AddOnDemandConverter(dtSingle, dtInteger, TDataConverters.SingleToInt32, TDataConverters.Int32ToSingle);
  AddOnDemandConverter(dtSingle, dtUInt32, TDataConverters.SingleToUInt32, TDataConverters.UInt32ToSingle);
  AddOnDemandConverter(dtSingle, dtInt64, TDataConverters.SingleToInt64, TDataConverters.Int64ToSingle);
  AddOnDemandConverter(dtSingle, dtFloat, TDataConverters.SingleToFloat, TDataConverters.FloatToSingle);
  AddOnDemandConverter(dtSingle, dtCurrency, TDataConverters.SingleToFloat, TDataConverters.FloatToSingle);
  AddOnDemandConverter(dtSingle, dtExtended, TDataConverters.SingleToExtended, TDataConverters.ExtendedToSingle);
  AddOnDemandConverter(dtSingle, dtBCD, TDataConverters.SingleToBCD, TDataConverters.BCDToSingle, TSizeConverters.Size0, TSizeConverters.Size0);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtSingle, dtFMTBCD, TDataConverters.SingleToFMTBCD, TDataConverters.FMTBCDToSingle, TSizeConverters.Size0, TSizeConverters.Size0);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtSingle, dtString, TDataConverters.SingleToAStr, TDataConverters.AStrToSingle);
  AddOnDemandConverter(dtSingle, dtExtString, TDataConverters.SingleToExtAStr, TDataConverters.ExtAStrToSingle);
  AddOnDemandConverter(dtSingle, dtWideString, TDataConverters.SingleToWStr, TDataConverters.WStrToSingle);
  AddOnDemandConverter(dtSingle, dtExtWideString, TDataConverters.SingleToExtWStr, TDataConverters.ExtWStrToSingle);
  AddOnDemandConverter(dtSingle, dtBytes, TDataConverters.SingleToBytes, TDataConverters.BytesToSingle);
  AddOnDemandConverter(dtSingle, dtVarBytes, TDataConverters.SingleToVarBytes, TDataConverters.VarBytesToSingle);
  AddOnDemandConverter(dtSingle, dtExtVarBytes, TDataConverters.SingleToExtVarBytes, TDataConverters.ExtVarBytesToSingle);

  AddOnDemandConverter(dtFloat, dtBoolean, TDataConverters.FloatToBool, TDataConverters.BoolToFloat);
  AddOnDemandConverter(dtFloat, dtInt8, TDataConverters.FloatToInt8, TDataConverters.Int8ToFloat);
  AddOnDemandConverter(dtFloat, dtUInt8, TDataConverters.FloatToUInt8, TDataConverters.UInt8ToFloat);
  AddOnDemandConverter(dtFloat, dtSmallint, TDataConverters.FloatToInt16, TDataConverters.Int16ToFloat);
  AddOnDemandConverter(dtFloat, dtWord, TDataConverters.FloatToUInt16, TDataConverters.UInt16ToFloat);
  AddOnDemandConverter(dtFloat, dtInteger, TDataConverters.FloatToInt32, TDataConverters.Int32ToFloat);
  AddOnDemandConverter(dtFloat, dtUInt32, TDataConverters.FloatToUInt32, TDataConverters.UInt32ToFloat);
  AddOnDemandConverter(dtFloat, dtInt64, TDataConverters.FloatToInt64, TDataConverters.Int64ToFloat);
  AddOnDemandConverter(dtFloat, dtSingle, TDataConverters.FloatToSingle, TDataConverters.SingleToFloat);
  AddOnDemandConverter(dtFloat, dtCurrency, TDataConverters.CopyInt64, TDataConverters.CopyInt64);
  AddOnDemandConverter(dtFloat, dtExtended, TDataConverters.FloatToExtended, TDataConverters.ExtendedToFloat);
  AddOnDemandConverter(dtFloat, dtBCD, TDataConverters.FloatToBCD, TDataConverters.BCDToFloat, TSizeConverters.Size0, TSizeConverters.Size0);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtFloat, dtFMTBCD, TDataConverters.FloatToFMTBCD, TDataConverters.FMTBCDToFloat, TSizeConverters.Size0, TSizeConverters.Size0);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtFloat, dtString, TDataConverters.FloatToAStr, TDataConverters.AStrToFloat);
  AddOnDemandConverter(dtFloat, dtExtString, TDataConverters.FloatToExtAStr, TDataConverters.ExtAStrToFloat);
  AddOnDemandConverter(dtFloat, dtWideString, TDataConverters.FloatToWStr, TDataConverters.WStrToFloat);
  AddOnDemandConverter(dtFloat, dtExtWideString, TDataConverters.FloatToExtWStr, TDataConverters.ExtWStrToFloat);
  AddOnDemandConverter(dtFloat, dtBytes, TDataConverters.FloatToBytes, TDataConverters.BytesToFloat);
  AddOnDemandConverter(dtFloat, dtVarBytes, TDataConverters.FloatToVarBytes, TDataConverters.VarBytesToFloat);
  AddOnDemandConverter(dtFloat, dtExtVarBytes, TDataConverters.FloatToExtVarBytes, TDataConverters.ExtVarBytesToFloat);

  AddOnDemandConverter(dtCurrency, dtBoolean, TDataConverters.FloatToBool, TDataConverters.BoolToFloat);
  AddOnDemandConverter(dtCurrency, dtInt8, TDataConverters.FloatToInt8, TDataConverters.Int8ToFloat);
  AddOnDemandConverter(dtCurrency, dtUInt8, TDataConverters.FloatToUInt8, TDataConverters.UInt8ToFloat);
  AddOnDemandConverter(dtCurrency, dtSmallint, TDataConverters.FloatToInt16, TDataConverters.Int16ToFloat);
  AddOnDemandConverter(dtCurrency, dtWord, TDataConverters.FloatToUInt16, TDataConverters.UInt16ToFloat);
  AddOnDemandConverter(dtCurrency, dtInteger, TDataConverters.FloatToInt32, TDataConverters.Int32ToFloat);
  AddOnDemandConverter(dtCurrency, dtUInt32, TDataConverters.FloatToUInt32, TDataConverters.UInt32ToFloat);
  AddOnDemandConverter(dtCurrency, dtInt64, TDataConverters.FloatToInt64, TDataConverters.Int64ToFloat);
  AddOnDemandConverter(dtCurrency, dtSingle, TDataConverters.FloatToSingle, TDataConverters.SingleToFloat);
  AddOnDemandConverter(dtCurrency, dtFloat, TDataConverters.CopyInt64, TDataConverters.CopyInt64);
  AddOnDemandConverter(dtCurrency, dtExtended, TDataConverters.FloatToExtended, TDataConverters.ExtendedToFloat);
  AddOnDemandConverter(dtCurrency, dtBCD, TDataConverters.FloatToBCD, TDataConverters.BCDToFloat, TSizeConverters.Size0, TSizeConverters.Size0);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtCurrency, dtFMTBCD, TDataConverters.FloatToFMTBCD, TDataConverters.FMTBCDToFloat, TSizeConverters.Size0, TSizeConverters.Size0);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtCurrency, dtString, TDataConverters.FloatToAStr, TDataConverters.AStrToFloat);
  AddOnDemandConverter(dtCurrency, dtExtString, TDataConverters.FloatToExtAStr, TDataConverters.ExtAStrToFloat);
  AddOnDemandConverter(dtCurrency, dtWideString, TDataConverters.FloatToWStr, TDataConverters.WStrToFloat);
  AddOnDemandConverter(dtCurrency, dtExtWideString, TDataConverters.FloatToExtWStr, TDataConverters.ExtWStrToFloat);
  AddOnDemandConverter(dtCurrency, dtBytes, TDataConverters.FloatToBytes, TDataConverters.BytesToFloat);
  AddOnDemandConverter(dtCurrency, dtVarBytes, TDataConverters.FloatToVarBytes, TDataConverters.VarBytesToFloat);
  AddOnDemandConverter(dtCurrency, dtExtVarBytes, TDataConverters.FloatToExtVarBytes, TDataConverters.ExtVarBytesToFloat);

  AddOnDemandConverter(dtExtended, dtBoolean, TDataConverters.ExtendedToBool, TDataConverters.BoolToExtended);
  AddOnDemandConverter(dtExtended, dtInt8, TDataConverters.ExtendedToInt8, TDataConverters.Int8ToExtended);
  AddOnDemandConverter(dtExtended, dtUInt8, TDataConverters.ExtendedToUInt8, TDataConverters.UInt8ToExtended);
  AddOnDemandConverter(dtExtended, dtSmallint, TDataConverters.ExtendedToInt16, TDataConverters.Int16ToExtended);
  AddOnDemandConverter(dtExtended, dtWord, TDataConverters.ExtendedToUInt16, TDataConverters.UInt16ToExtended);
  AddOnDemandConverter(dtExtended, dtInteger, TDataConverters.ExtendedToInt32, TDataConverters.Int32ToExtended);
  AddOnDemandConverter(dtExtended, dtUInt32, TDataConverters.ExtendedToUInt32, TDataConverters.UInt32ToExtended);
  AddOnDemandConverter(dtExtended, dtInt64, TDataConverters.ExtendedToInt64, TDataConverters.Int64ToExtended);
  AddOnDemandConverter(dtExtended, dtSingle, TDataConverters.ExtendedToSingle, TDataConverters.SingleToExtended);
  AddOnDemandConverter(dtExtended, dtFloat, TDataConverters.ExtendedToFloat, TDataConverters.FloatToExtended);
  AddOnDemandConverter(dtExtended, dtCurrency, TDataConverters.ExtendedToFloat, TDataConverters.FloatToExtended);
  AddOnDemandConverter(dtExtended, dtBCD, TDataConverters.ExtendedToBCD, TDataConverters.BCDToExtended, TSizeConverters.Size0, TSizeConverters.Size0);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtExtended, dtFMTBCD, TDataConverters.ExtendedToFMTBCD, TDataConverters.FMTBCDToExtended, TSizeConverters.Size0, TSizeConverters.Size0);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtExtended, dtString, TDataConverters.ExtendedToAStr, TDataConverters.AStrToExtended);
  AddOnDemandConverter(dtExtended, dtExtString, TDataConverters.ExtendedToExtAStr, TDataConverters.ExtAStrToExtended);
  AddOnDemandConverter(dtExtended, dtWideString, TDataConverters.ExtendedToWStr, TDataConverters.WStrToExtended);
  AddOnDemandConverter(dtExtended, dtExtWideString, TDataConverters.ExtendedToExtWStr, TDataConverters.ExtWStrToExtended);
  AddOnDemandConverter(dtExtended, dtBytes, TDataConverters.ExtendedToBytes, TDataConverters.BytesToExtended);
  AddOnDemandConverter(dtExtended, dtVarBytes, TDataConverters.ExtendedToVarBytes, TDataConverters.VarBytesToExtended);
  AddOnDemandConverter(dtExtended, dtExtVarBytes, TDataConverters.ExtendedToExtVarBytes, TDataConverters.ExtVarBytesToExtended);

  AddOnDemandConverter(dtBCD, dtBoolean, TDataConverters.BCDToBool, TDataConverters.BoolToBCD);
  AddOnDemandConverter(dtBCD, dtInt8, TDataConverters.BCDToInt8, TDataConverters.Int8ToBCD);
  AddOnDemandConverter(dtBCD, dtUInt8, TDataConverters.BCDToUInt8, TDataConverters.UInt8ToBCD);
  AddOnDemandConverter(dtBCD, dtSmallint, TDataConverters.BCDToInt16, TDataConverters.Int16ToBCD);
  AddOnDemandConverter(dtBCD, dtWord, TDataConverters.BCDToUInt16, TDataConverters.UInt16ToBCD);
  AddOnDemandConverter(dtBCD, dtInteger, TDataConverters.BCDToInt32, TDataConverters.Int32ToBCD);
  AddOnDemandConverter(dtBCD, dtUInt32, TDataConverters.BCDToUInt32, TDataConverters.UInt32ToBCD);
  AddOnDemandConverter(dtBCD, dtInt64, TDataConverters.BCDToInt64, TDataConverters.Int64ToBCD);
  AddOnDemandConverter(dtBCD, dtSingle, TDataConverters.BCDToSingle, TDataConverters.SingleToBCD);
  AddOnDemandConverter(dtBCD, dtFloat, TDataConverters.BCDToFloat, TDataConverters.FloatToBCD);
  AddOnDemandConverter(dtBCD, dtCurrency, TDataConverters.BCDToFloat, TDataConverters.FloatToBCD);
  AddOnDemandConverter(dtBCD, dtExtended, TDataConverters.BCDToExtended, TDataConverters.ExtendedToBCD);
  AddOnDemandConverter(dtBCD, dtBCD, TDataConverters.BCDToBCD, TDataConverters.BCDToBCD, TSizeConverters.CopySize, TSizeConverters.CopySize);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtBCD, dtFMTBCD, TDataConverters.BCDToFMTBCD, TDataConverters.FMTBCDToBCD, TSizeConverters.CopySize, TSizeConverters.CopySize);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtBCD, dtString, TDataConverters.BCDToAStr, TDataConverters.AStrToBCD);
  AddOnDemandConverter(dtBCD, dtExtString, TDataConverters.BCDToExtAStr, TDataConverters.ExtAStrToBCD);
  AddOnDemandConverter(dtBCD, dtWideString, TDataConverters.BCDToWStr, TDataConverters.WStrToBCD);
  AddOnDemandConverter(dtBCD, dtExtWideString, TDataConverters.BCDToExtWStr, TDataConverters.ExtWStrToBCD);
  AddOnDemandConverter(dtBCD, dtBytes, TDataConverters.BCDToBytes, TDataConverters.BytesToBCD);
  AddOnDemandConverter(dtBCD, dtVarBytes, TDataConverters.BCDToVarBytes, TDataConverters.VarBytesToBCD);
  AddOnDemandConverter(dtBCD, dtExtVarBytes, TDataConverters.BCDToExtVarBytes, TDataConverters.ExtVarBytesToBCD);

{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtFMTBCD, dtBoolean, TDataConverters.FMTBCDToBool, TDataConverters.BoolToFMTBCD);
  AddOnDemandConverter(dtFMTBCD, dtInt8, TDataConverters.FMTBCDToInt8, TDataConverters.Int8ToFMTBCD);
  AddOnDemandConverter(dtFMTBCD, dtUInt8, TDataConverters.FMTBCDToUInt8, TDataConverters.UInt8ToFMTBCD);
  AddOnDemandConverter(dtFMTBCD, dtSmallint, TDataConverters.FMTBCDToInt16, TDataConverters.Int16ToFMTBCD);
  AddOnDemandConverter(dtFMTBCD, dtWord, TDataConverters.FMTBCDToUInt16, TDataConverters.UInt16ToFMTBCD);
  AddOnDemandConverter(dtFMTBCD, dtInteger, TDataConverters.FMTBCDToInt32, TDataConverters.Int32ToFMTBCD);
  AddOnDemandConverter(dtFMTBCD, dtUInt32, TDataConverters.FMTBCDToUInt32, TDataConverters.UInt32ToFMTBCD);
  AddOnDemandConverter(dtFMTBCD, dtInt64, TDataConverters.FMTBCDToInt64, TDataConverters.Int64ToFMTBCD);
  AddOnDemandConverter(dtFMTBCD, dtSingle, TDataConverters.FMTBCDToSingle, TDataConverters.SingleToFMTBCD);
  AddOnDemandConverter(dtFMTBCD, dtFloat, TDataConverters.FMTBCDToFloat, TDataConverters.FloatToFMTBCD);
  AddOnDemandConverter(dtFMTBCD, dtCurrency, TDataConverters.FMTBCDToFloat, TDataConverters.FloatToFMTBCD);
  AddOnDemandConverter(dtFMTBCD, dtExtended, TDataConverters.FMTBCDToExtended, TDataConverters.ExtendedToFMTBCD);
  AddOnDemandConverter(dtFMTBCD, dtBCD, TDataConverters.FMTBCDToBCD, TDataConverters.BCDToFMTBCD, TSizeConverters.CopySize, TSizeConverters.CopySize);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtFMTBCD, dtFMTBCD, TDataConverters.FMTBCDToFMTBCD, TDataConverters.FMTBCDToFMTBCD, TSizeConverters.CopySize, TSizeConverters.CopySize);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtFMTBCD, dtString, TDataConverters.FMTBCDToAStr, TDataConverters.AStrToFMTBCD);
  AddOnDemandConverter(dtFMTBCD, dtExtString, TDataConverters.FMTBCDToExtAStr, TDataConverters.ExtAStrToFMTBCD);
  AddOnDemandConverter(dtFMTBCD, dtWideString, TDataConverters.FMTBCDToWStr, TDataConverters.WStrToFMTBCD);
  AddOnDemandConverter(dtFMTBCD, dtExtWideString, TDataConverters.FMTBCDToExtWStr, TDataConverters.ExtWStrToFMTBCD);
  AddOnDemandConverter(dtFMTBCD, dtBytes, TDataConverters.FMTBCDToBytes, TDataConverters.BytesToFMTBCD);
  AddOnDemandConverter(dtFMTBCD, dtVarBytes, TDataConverters.FMTBCDToVarBytes, TDataConverters.VarBytesToFMTBCD);
  AddOnDemandConverter(dtFMTBCD, dtExtVarBytes, TDataConverters.FMTBCDToExtVarBytes, TDataConverters.ExtVarBytesToFMTBCD);
{$ENDIF}{$ENDIF}

  AddOnDemandConverter(dtDate, dtDateTime, TDataConverters.DateToDateTime, TDataConverters.DateTimeToDate);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtDate, dtSQLTimeStamp, TDataConverters.DateToSQLTimeStamp, TDataConverters.SQLTimeStampToDate);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtDate, dtString, TDataConverters.DateToAStr, TDataConverters.AStrToDate);
  AddOnDemandConverter(dtDate, dtExtString, TDataConverters.DateToExtAStr, TDataConverters.ExtAStrToDate);
  AddOnDemandConverter(dtDate, dtWideString, TDataConverters.DateToWStr, TDataConverters.WStrToDate);
  AddOnDemandConverter(dtDate, dtExtWideString, TDataConverters.DateToExtWStr, TDataConverters.ExtWStrToDate);
  AddOnDemandConverter(dtDate, dtBytes, TDataConverters.DateToBytes, TDataConverters.BytesToDate);
  AddOnDemandConverter(dtDate, dtVarBytes, TDataConverters.DateToVarBytes, TDataConverters.VarBytesToDate);
  AddOnDemandConverter(dtDate, dtExtVarBytes, TDataConverters.DateToExtVarBytes, TDataConverters.ExtVarBytesToDate);

  AddOnDemandConverter(dtTime, dtDateTime, TDataConverters.TimeToDateTime, TDataConverters.DateTimeToTime);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtTime, dtSQLTimeStamp, TDataConverters.TimeToSQLTimeStamp, TDataConverters.SQLTimeStampToTime);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtTime, dtString, TDataConverters.TimeToAStr, TDataConverters.AStrToTime);
  AddOnDemandConverter(dtTime, dtExtString, TDataConverters.TimeToExtAStr, TDataConverters.ExtAStrToTime);
  AddOnDemandConverter(dtTime, dtWideString, TDataConverters.TimeToWStr, TDataConverters.WStrToTime);
  AddOnDemandConverter(dtTime, dtExtWideString, TDataConverters.TimeToExtWStr, TDataConverters.ExtWStrToTime);
  AddOnDemandConverter(dtTime, dtBytes, TDataConverters.TimeToBytes, TDataConverters.BytesToTime);
  AddOnDemandConverter(dtTime, dtVarBytes, TDataConverters.TimeToVarBytes, TDataConverters.VarBytesToTime);
  AddOnDemandConverter(dtTime, dtExtVarBytes, TDataConverters.TimeToExtVarBytes, TDataConverters.ExtVarBytesToTime);

  AddOnDemandConverter(dtDateTime, dtDate, TDataConverters.DateTimeToDate, TDataConverters.DateToDateTime);
  AddOnDemandConverter(dtDateTime, dtTime, TDataConverters.DateTimeToTime, TDataConverters.TimeToDateTime);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtDateTime, dtSQLTimeStamp, TDataConverters.DateTimeToSQLTimeStamp, TDataConverters.SQLTimeStampToDateTime);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtDateTime, dtString, TDataConverters.DateTimeToAStr, TDataConverters.AStrToDateTime);
  AddOnDemandConverter(dtDateTime, dtExtString, TDataConverters.DateTimeToExtAStr, TDataConverters.ExtAStrToDateTime);
  AddOnDemandConverter(dtDateTime, dtWideString, TDataConverters.DateTimeToWStr, TDataConverters.WStrToDateTime);
  AddOnDemandConverter(dtDateTime, dtExtWideString, TDataConverters.DateTimeToExtWStr, TDataConverters.ExtWStrToDateTime);
  AddOnDemandConverter(dtDateTime, dtBytes, TDataConverters.DateTimeToBytes, TDataConverters.BytesToDateTime);
  AddOnDemandConverter(dtDateTime, dtVarBytes, TDataConverters.DateTimeToVarBytes, TDataConverters.VarBytesToDateTime);
  AddOnDemandConverter(dtDateTime, dtExtVarBytes, TDataConverters.DateTimeToExtVarBytes, TDataConverters.ExtVarBytesToDateTime);

{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtSQLTimeStamp, dtDate, TDataConverters.SQLTimeStampToDate, TDataConverters.DateToSQLTimeStamp);
  AddOnDemandConverter(dtSQLTimeStamp, dtTime, TDataConverters.SQLTimeStampToTime, TDataConverters.TimeToSQLTimeStamp);
  AddOnDemandConverter(dtSQLTimeStamp, dtDateTime, TDataConverters.SQLTimeStampToDateTime, TDataConverters.DateTimeToSQLTimeStamp);
  AddOnDemandConverter(dtSQLTimeStamp, dtString, TDataConverters.SQLTimeStampToAStr, TDataConverters.AStrToSQLTimeStamp);
  AddOnDemandConverter(dtSQLTimeStamp, dtExtString, TDataConverters.SQLTimeStampToExtAStr, TDataConverters.ExtAStrToSQLTimeStamp);
  AddOnDemandConverter(dtSQLTimeStamp, dtWideString, TDataConverters.SQLTimeStampToWStr, TDataConverters.WStrToSQLTimeStamp);
  AddOnDemandConverter(dtSQLTimeStamp, dtExtWideString, TDataConverters.SQLTimeStampToExtWStr, TDataConverters.ExtWStrToSQLTimeStamp);
  AddOnDemandConverter(dtSQLTimeStamp, dtBytes, TDataConverters.SQLTimeStampToBytes, TDataConverters.BytesToSQLTimeStamp);
  AddOnDemandConverter(dtSQLTimeStamp, dtVarBytes, TDataConverters.SQLTimeStampToVarBytes, TDataConverters.VarBytesToSQLTimeStamp);
  AddOnDemandConverter(dtSQLTimeStamp, dtExtVarBytes, TDataConverters.SQLTimeStampToExtVarBytes, TDataConverters.ExtVarBytesToSQLTimeStamp);
{$ENDIF}{$ENDIF}

  AddOnDemandConverter(dtString, dtBoolean, TDataConverters.AStrToBool, TDataConverters.BoolToAStr);
  AddOnDemandConverter(dtString, dtInt8, TDataConverters.AStrToInt8, TDataConverters.Int8ToAStr);
  AddOnDemandConverter(dtString, dtUInt8, TDataConverters.AStrToUInt8, TDataConverters.UInt8ToAStr);
  AddOnDemandConverter(dtString, dtSmallint, TDataConverters.AStrToInt16, TDataConverters.Int16ToAStr);
  AddOnDemandConverter(dtString, dtWord, TDataConverters.AStrToUInt16, TDataConverters.UInt16ToAStr);
  AddOnDemandConverter(dtString, dtInteger, TDataConverters.AStrToInt32, TDataConverters.Int32ToAStr);
  AddOnDemandConverter(dtString, dtUInt32, TDataConverters.AStrToUInt32, TDataConverters.UInt32ToAStr);
  AddOnDemandConverter(dtString, dtInt64, TDataConverters.AStrToInt64, TDataConverters.Int64ToAStr);
  AddOnDemandConverter(dtString, dtSingle, TDataConverters.AStrToSingle, TDataConverters.SingleToAStr);
  AddOnDemandConverter(dtString, dtFloat, TDataConverters.AStrToFloat, TDataConverters.FloatToAStr);
  AddOnDemandConverter(dtString, dtCurrency, TDataConverters.AStrToFloat, TDataConverters.FloatToAStr);
  AddOnDemandConverter(dtString, dtExtended, TDataConverters.AStrToExtended, TDataConverters.ExtendedToAStr);
  AddOnDemandConverter(dtString, dtBCD, TDataConverters.AStrToBCD, TDataConverters.BCDToAStr, TSizeConverters.Size0, TSizeConverters.Size0);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtString, dtFMTBCD, TDataConverters.AStrToFMTBCD, TDataConverters.FMTBCDToAStr, TSizeConverters.Size0, TSizeConverters.Size0);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtString, dtDate, TDataConverters.AStrToDate, TDataConverters.DateToAStr);
  AddOnDemandConverter(dtString, dtTime, TDataConverters.AStrToTime, TDataConverters.TimeToAStr);
  AddOnDemandConverter(dtString, dtDateTime, TDataConverters.AStrToDateTime, TDataConverters.DateTimeToAStr);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtString, dtSQLTimeStamp, TDataConverters.AStrToSQLTimeStamp, TDataConverters.SQLTimeStampToAStr);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtString, dtString, TDataConverters.AStrToAStr, TDataConverters.AStrToAStr, TSizeConverters.CopySize);
  AddOnDemandConverter(dtString, dtExtString, TDataConverters.AStrToExtAStr, TDataConverters.ExtAStrToAStr, TSizeConverters.CopySize);
  AddOnDemandConverter(dtString, dtWideString, TDataConverters.AStrToWStr, TDataConverters.WStrToAStr, TSizeConverters.CopySize);
  AddOnDemandConverter(dtString, dtExtWideString, TDataConverters.AStrToExtWStr, TDataConverters.ExtWStrToAStr, TSizeConverters.CopySize);
//  AddOnDemandConverter(dtString, dtMemo, TDataConverters.AStrToMemo, TDataConverters.MemoToAStr);
//  AddOnDemandConverter(dtString, dtWideMemo, TDataConverters.AStrToMemo, TDataConverters.MemoToAStr);
  AddOnDemandConverter(dtString, dtBytes, TDataConverters.AStrToBytes, TDataConverters.BytesToAStr, TSizeConverters.CopySize);
  AddOnDemandConverter(dtString, dtVarBytes, TDataConverters.AStrToVarBytes, TDataConverters.VarBytesToAStr, TSizeConverters.CopySize);
  AddOnDemandConverter(dtString, dtExtVarBytes, TDataConverters.AStrToExtVarBytes, TDataConverters.ExtVarBytesToAStr, TSizeConverters.CopySize);
  AddOnDemandConverter(dtString, dtGuid, TDataConverters.AStrToGuid, TDataConverters.GuidToAStr, TSizeConverters.GuidSize);

  AddOnDemandConverter(dtWideString, dtBoolean, TDataConverters.WStrToBool, TDataConverters.BoolToWStr);
  AddOnDemandConverter(dtWideString, dtInt8, TDataConverters.WStrToInt8, TDataConverters.Int8ToWStr);
  AddOnDemandConverter(dtWideString, dtUInt8, TDataConverters.WStrToUInt8, TDataConverters.UInt8ToWStr);
  AddOnDemandConverter(dtWideString, dtSmallint, TDataConverters.WStrToInt16, TDataConverters.Int16ToWStr);
  AddOnDemandConverter(dtWideString, dtWord, TDataConverters.WStrToUInt16, TDataConverters.UInt16ToWStr);
  AddOnDemandConverter(dtWideString, dtInteger, TDataConverters.WStrToInt32, TDataConverters.Int32ToWStr);
  AddOnDemandConverter(dtWideString, dtUInt32, TDataConverters.WStrToUInt32, TDataConverters.UInt32ToWStr);
  AddOnDemandConverter(dtWideString, dtInt64, TDataConverters.WStrToInt64, TDataConverters.Int64ToWStr);
  AddOnDemandConverter(dtWideString, dtSingle, TDataConverters.WStrToSingle, TDataConverters.SingleToWStr);
  AddOnDemandConverter(dtWideString, dtFloat, TDataConverters.WStrToFloat, TDataConverters.FloatToWStr);
  AddOnDemandConverter(dtWideString, dtCurrency, TDataConverters.WStrToFloat, TDataConverters.FloatToWStr);
  AddOnDemandConverter(dtWideString, dtExtended, TDataConverters.WStrToExtended, TDataConverters.ExtendedToWStr);
  AddOnDemandConverter(dtWideString, dtBCD, TDataConverters.WStrToBCD, TDataConverters.BCDToWStr, TSizeConverters.Size0, TSizeConverters.Size0);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtWideString, dtFMTBCD, TDataConverters.WStrToFMTBCD, TDataConverters.FMTBCDToWStr, TSizeConverters.Size0, TSizeConverters.Size0);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtWideString, dtDate, TDataConverters.WStrToDate, TDataConverters.DateToWStr);
  AddOnDemandConverter(dtWideString, dtTime, TDataConverters.WStrToTime, TDataConverters.TimeToWStr);
  AddOnDemandConverter(dtWideString, dtDateTime, TDataConverters.WStrToDateTime, TDataConverters.DateTimeToWStr);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtWideString, dtSQLTimeStamp, TDataConverters.WStrToSQLTimeStamp, TDataConverters.SQLTimeStampToWStr);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtWideString, dtString, TDataConverters.WStrToAStr, TDataConverters.AStrToWStr, TSizeConverters.CopySize);
  AddOnDemandConverter(dtWideString, dtExtString, TDataConverters.WStrToExtAStr, TDataConverters.ExtAStrToWStr, TSizeConverters.CopySize);
  AddOnDemandConverter(dtWideString, dtWideString, TDataConverters.WStrToWStr, TDataConverters.WStrToWStr, TSizeConverters.CopySize);
  AddOnDemandConverter(dtWideString, dtExtWideString, TDataConverters.WStrToExtWStr, TDataConverters.ExtWStrToWStr, TSizeConverters.CopySize);
//  AddOnDemandConverter(dtWideString, dtMemo, TDataConverters.WStrToMemo, TDataConverters.MemoToWStr);
//  AddOnDemandConverter(dtWideString, dtWideMemo, TDataConverters.WStrToWideMemo, TDataConverters.WideMemoToWStr);
  AddOnDemandConverter(dtWideString, dtBytes, TDataConverters.WStrToBytes, TDataConverters.BytesToWStr, TSizeConverters.SizeX2);
  AddOnDemandConverter(dtWideString, dtVarBytes, TDataConverters.WStrToVarBytes, TDataConverters.VarBytesToWStr, TSizeConverters.SizeX2);
  AddOnDemandConverter(dtWideString, dtExtVarBytes, TDataConverters.WStrToExtVarBytes, TDataConverters.ExtVarBytesToWStr, TSizeConverters.SizeX2);
  AddOnDemandConverter(dtWideString, dtGuid, TDataConverters.WStrToGuid, TDataConverters.GuidToWStr, TSizeConverters.GuidSize);

  AddOnDemandConverter(dtExtString, dtBoolean, TDataConverters.ExtAStrToBool, TDataConverters.BoolToExtAStr);
  AddOnDemandConverter(dtExtString, dtInt8, TDataConverters.ExtAStrToInt8, TDataConverters.Int8ToExtAStr);
  AddOnDemandConverter(dtExtString, dtUInt8, TDataConverters.ExtAStrToUInt8, TDataConverters.UInt8ToExtAStr);
  AddOnDemandConverter(dtExtString, dtSmallint, TDataConverters.ExtAStrToInt16, TDataConverters.Int16ToExtAStr);
  AddOnDemandConverter(dtExtString, dtWord, TDataConverters.ExtAStrToUInt16, TDataConverters.UInt16ToExtAStr);
  AddOnDemandConverter(dtExtString, dtInteger, TDataConverters.ExtAStrToInt32, TDataConverters.Int32ToExtAStr);
  AddOnDemandConverter(dtExtString, dtUInt32, TDataConverters.ExtAStrToUInt32, TDataConverters.UInt32ToExtAStr);
  AddOnDemandConverter(dtExtString, dtInt64, TDataConverters.ExtAStrToInt64, TDataConverters.Int64ToExtAStr);
  AddOnDemandConverter(dtExtString, dtSingle, TDataConverters.ExtAStrToSingle, TDataConverters.SingleToExtAStr);
  AddOnDemandConverter(dtExtString, dtFloat, TDataConverters.ExtAStrToFloat, TDataConverters.FloatToExtAStr);
  AddOnDemandConverter(dtExtString, dtCurrency, TDataConverters.ExtAStrToFloat, TDataConverters.FloatToExtAStr);
  AddOnDemandConverter(dtExtString, dtExtended, TDataConverters.ExtAStrToExtended, TDataConverters.ExtendedToExtAStr);
  AddOnDemandConverter(dtExtString, dtBCD, TDataConverters.ExtAStrToBCD, TDataConverters.BCDToExtAStr, TSizeConverters.Size0, TSizeConverters.Size0);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtExtString, dtFMTBCD, TDataConverters.ExtAStrToFMTBCD, TDataConverters.FMTBCDToExtAStr, TSizeConverters.Size0, TSizeConverters.Size0);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtExtString, dtDate, TDataConverters.ExtAStrToDate, TDataConverters.DateToExtAStr);
  AddOnDemandConverter(dtExtString, dtTime, TDataConverters.ExtAStrToTime, TDataConverters.TimeToExtAStr);
  AddOnDemandConverter(dtExtString, dtDateTime, TDataConverters.ExtAStrToDateTime, TDataConverters.DateTimeToExtAStr);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtExtString, dtSQLTimeStamp, TDataConverters.ExtAStrToSQLTimeStamp, TDataConverters.SQLTimeStampToExtAStr);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtExtString, dtString, TDataConverters.ExtAStrToAStr, TDataConverters.AStrToExtAStr, TSizeConverters.CopySize);
  AddOnDemandConverter(dtExtString, dtExtString, TDataConverters.ExtAStrToExtAStr, TDataConverters.ExtAStrToExtAStr, TSizeConverters.CopySize);
  AddOnDemandConverter(dtExtString, dtWideString, TDataConverters.ExtAStrToWStr, TDataConverters.WStrToExtAStr, TSizeConverters.CopySize);
  AddOnDemandConverter(dtExtString, dtExtWideString, TDataConverters.ExtAStrToExtWStr, TDataConverters.ExtWStrToExtAStr, TSizeConverters.CopySize);
//  AddOnDemandConverter(dtExtString, dtMemo, TDataConverters.ExtAStrToMemo, TDataConverters.MemoToExtAStr);
//  AddOnDemandConverter(dtExtString, dtWideMemo, TDataConverters.ExtAStrToWideMemo, TDataConverters.WideMemoToExtAStr);
  AddOnDemandConverter(dtExtString, dtBytes, TDataConverters.ExtAStrToBytes, TDataConverters.BytesToExtAStr, TSizeConverters.CopySize);
  AddOnDemandConverter(dtExtString, dtVarBytes, TDataConverters.ExtAStrToVarBytes, TDataConverters.VarBytesToExtAStr, TSizeConverters.CopySize);
  AddOnDemandConverter(dtExtString, dtExtVarBytes, TDataConverters.ExtAStrToExtVarBytes, TDataConverters.ExtVarBytesToExtAStr, TSizeConverters.CopySize);
  AddOnDemandConverter(dtExtString, dtGuid, TDataConverters.ExtAStrToGuid, TDataConverters.GuidToExtAStr, TSizeConverters.GuidSize);

  AddOnDemandConverter(dtExtWideString, dtBoolean, TDataConverters.ExtWStrToBool, TDataConverters.BoolToExtWStr);
  AddOnDemandConverter(dtExtWideString, dtInt8, TDataConverters.ExtWStrToInt8, TDataConverters.Int8ToExtWStr);
  AddOnDemandConverter(dtExtWideString, dtUInt8, TDataConverters.ExtWStrToUInt8, TDataConverters.UInt8ToExtWStr);
  AddOnDemandConverter(dtExtWideString, dtSmallint, TDataConverters.ExtWStrToInt16, TDataConverters.Int16ToExtWStr);
  AddOnDemandConverter(dtExtWideString, dtWord, TDataConverters.ExtWStrToUInt16, TDataConverters.UInt16ToExtWStr);
  AddOnDemandConverter(dtExtWideString, dtInteger, TDataConverters.ExtWStrToInt32, TDataConverters.Int32ToExtWStr);
  AddOnDemandConverter(dtExtWideString, dtUInt32, TDataConverters.ExtWStrToUInt32, TDataConverters.UInt32ToExtWStr);
  AddOnDemandConverter(dtExtWideString, dtInt64, TDataConverters.ExtWStrToInt64, TDataConverters.Int64ToExtWStr);
  AddOnDemandConverter(dtExtWideString, dtSingle, TDataConverters.ExtWStrToSingle, TDataConverters.SingleToExtWStr);
  AddOnDemandConverter(dtExtWideString, dtFloat, TDataConverters.ExtWStrToFloat, TDataConverters.FloatToExtWStr);
  AddOnDemandConverter(dtExtWideString, dtCurrency, TDataConverters.ExtWStrToFloat, TDataConverters.FloatToExtWStr);
  AddOnDemandConverter(dtExtWideString, dtExtended, TDataConverters.ExtWStrToExtended, TDataConverters.ExtendedToExtWStr);
  AddOnDemandConverter(dtExtWideString, dtBCD, TDataConverters.ExtWStrToBCD, TDataConverters.BCDToExtWStr, TSizeConverters.Size0, TSizeConverters.Size0);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtExtWideString, dtFMTBCD, TDataConverters.ExtWStrToFMTBCD, TDataConverters.FMTBCDToExtWStr, TSizeConverters.Size0, TSizeConverters.Size0);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtExtWideString, dtDate, TDataConverters.ExtWStrToDate, TDataConverters.DateToExtWStr);
  AddOnDemandConverter(dtExtWideString, dtTime, TDataConverters.ExtWStrToTime, TDataConverters.TimeToExtWStr);
  AddOnDemandConverter(dtExtWideString, dtDateTime, TDataConverters.ExtWStrToDateTime, TDataConverters.DateTimeToExtWStr);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtExtWideString, dtSQLTimeStamp, TDataConverters.ExtWStrToSQLTimeStamp, TDataConverters.SQLTimeStampToExtWStr);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtExtWideString, dtString, TDataConverters.ExtWStrToAStr, TDataConverters.AStrToExtWStr, TSizeConverters.CopySize);
  AddOnDemandConverter(dtExtWideString, dtExtString, TDataConverters.ExtWStrToExtAStr, TDataConverters.ExtAStrToExtWStr, TSizeConverters.CopySize);
  AddOnDemandConverter(dtExtWideString, dtWideString, TDataConverters.ExtWStrToWStr, TDataConverters.WStrToExtWStr, TSizeConverters.CopySize);
  AddOnDemandConverter(dtExtWideString, dtExtWideString, TDataConverters.ExtWStrToExtWStr, TDataConverters.ExtWStrToExtWStr, TSizeConverters.CopySize);
//  AddOnDemandConverter(dtExtWideString, dtMemo, TDataConverters.ExtWStrToMemo, TDataConverters.MemoToExtWStr);
//  AddOnDemandConverter(dtExtWideString, dtWideMemo, TDataConverters.ExtWStrToWideMemo, TDataConverters.WideMemoToExtWStr);
  AddOnDemandConverter(dtExtWideString, dtBytes, TDataConverters.ExtWStrToBytes, TDataConverters.BytesToExtWStr, TSizeConverters.SizeX2);
  AddOnDemandConverter(dtExtWideString, dtVarBytes, TDataConverters.ExtWStrToVarBytes, TDataConverters.VarBytesToExtWStr, TSizeConverters.SizeX2);
  AddOnDemandConverter(dtExtWideString, dtExtVarBytes, TDataConverters.ExtWStrToExtVarBytes, TDataConverters.ExtVarBytesToExtWStr, TSizeConverters.SizeX2);
  AddOnDemandConverter(dtExtWideString, dtGuid, TDataConverters.ExtWStrToGuid, TDataConverters.GuidToExtWStr, TSizeConverters.GuidSize);

  AddOnDemandConverter(dtMemo, dtString, TDataConverters.MemoToAStr, TDataConverters.AStrToMemo);
  AddOnDemandConverter(dtMemo, dtWideString, TDataConverters.MemoToWStr, TDataConverters.WStrToMemo);
  AddOnDemandConverter(dtMemo, dtExtString, TDataConverters.MemoToExtAStr, TDataConverters.ExtAStrToMemo);
  AddOnDemandConverter(dtMemo, dtExtWideString, TDataConverters.MemoToExtWStr, TDataConverters.ExtWStrToMemo);
  AddOnDemandConverter(dtMemo, dtWideMemo, TDataConverters.CopyPtr, TDataConverters.CopyPtr);

  AddOnDemandConverter(dtWideMemo, dtString, TDataConverters.WideMemoToAStr, TDataConverters.AStrToWideMemo);
  AddOnDemandConverter(dtWideMemo, dtWideString, TDataConverters.WideMemoToWStr, TDataConverters.WStrToWideMemo);
  AddOnDemandConverter(dtWideMemo, dtExtString, TDataConverters.WideMemoToExtAStr, TDataConverters.ExtAStrToWideMemo);
  AddOnDemandConverter(dtWideMemo, dtExtWideString, TDataConverters.WideMemoToExtWStr, TDataConverters.ExtWStrToWideMemo);
  AddOnDemandConverter(dtWideMemo, dtMemo, TDataConverters.CopyPtr, TDataConverters.CopyPtr);

  AddOnDemandConverter(dtBlob, dtBoolean, TDataConverters.BlobToBool, TDataConverters.BoolToBlob);
  AddOnDemandConverter(dtBlob, dtInt8, TDataConverters.BlobToInt8, TDataConverters.Int8ToBlob);
  AddOnDemandConverter(dtBlob, dtUInt8, TDataConverters.BlobToUInt8, TDataConverters.UInt8ToBlob);
  AddOnDemandConverter(dtBlob, dtInt16, TDataConverters.BlobToInt16, TDataConverters.Int16ToBlob);
  AddOnDemandConverter(dtBlob, dtUInt16, TDataConverters.BlobToUInt16, TDataConverters.UInt16ToBlob);
  AddOnDemandConverter(dtBlob, dtInt32, TDataConverters.BlobToInt32, TDataConverters.Int32ToBlob);
  AddOnDemandConverter(dtBlob, dtUInt32, TDataConverters.BlobToUInt32, TDataConverters.UInt32ToBlob);
  AddOnDemandConverter(dtBlob, dtInt64, TDataConverters.BlobToInt64, TDataConverters.Int64ToBlob);
  AddOnDemandConverter(dtBlob, dtSingle, TDataConverters.BlobToSingle, TDataConverters.SingleToBlob);
  AddOnDemandConverter(dtBlob, dtFloat, TDataConverters.BlobToFloat, TDataConverters.FloatToBlob);
  AddOnDemandConverter(dtBlob, dtCurrency, TDataConverters.BlobToFloat, TDataConverters.FloatToBlob);
  AddOnDemandConverter(dtBlob, dtExtended, TDataConverters.BlobToExtended, TDataConverters.ExtendedToBlob);
  AddOnDemandConverter(dtBlob, dtBCD, TDataConverters.BlobToBCD, TDataConverters.BCDToBlob);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtBlob, dtFMTBCD, TDataConverters.BlobToFMTBCD, TDataConverters.FMTBCDToBlob);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtBlob, dtDate, TDataConverters.BlobToDate, TDataConverters.DateToBlob);
  AddOnDemandConverter(dtBlob, dtTime, TDataConverters.BlobToTime, TDataConverters.TimeToBlob);
  AddOnDemandConverter(dtBlob, dtDateTime, TDataConverters.BlobToDateTime, TDataConverters.DateTimeToBlob);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtBlob, dtSQLTimeStamp, TDataConverters.BlobToSQLTimeStamp, TDataConverters.SQLTimeStampToBlob);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtBlob, dtString, TDataConverters.MemoToAStr, TDataConverters.AStrToMemo);
  AddOnDemandConverter(dtBlob, dtExtString, TDataConverters.MemoToExtAStr, TDataConverters.ExtAStrToMemo);
  AddOnDemandConverter(dtBlob, dtWideString, TDataConverters.MemoToWStr, TDataConverters.WStrToMemo);
  AddOnDemandConverter(dtBlob, dtExtWideString, TDataConverters.MemoToExtWStr, TDataConverters.ExtWStrToMemo);
  AddOnDemandConverter(dtBlob, dtMemo, TDataConverters.CopyPtr, TDataConverters.CopyPtr);
  AddOnDemandConverter(dtBlob, dtWideMemo, TDataConverters.CopyPtr, TDataConverters.CopyPtr);
  AddOnDemandConverter(dtBlob, dtBytes, TDataConverters.BlobToBytes, TDataConverters.BytesToBlob);
  AddOnDemandConverter(dtBlob, dtVarBytes, TDataConverters.BlobToVarBytes, TDataConverters.VarBytesToBlob);
  AddOnDemandConverter(dtBlob, dtExtVarBytes, TDataConverters.BlobToExtVarBytes, TDataConverters.ExtVarBytesToBlob);

  AddOnDemandConverter(dtBytes, dtBoolean, TDataConverters.BytesToBool, TDataConverters.BoolToBytes);
  AddOnDemandConverter(dtBytes, dtInt8, TDataConverters.BytesToInt8, TDataConverters.Int8ToBytes);
  AddOnDemandConverter(dtBytes, dtUInt8, TDataConverters.BytesToUInt8, TDataConverters.UInt8ToBytes);
  AddOnDemandConverter(dtBytes, dtSmallint, TDataConverters.BytesToInt16, TDataConverters.Int16ToBytes);
  AddOnDemandConverter(dtBytes, dtWord, TDataConverters.BytesToUInt16, TDataConverters.UInt16ToBytes);
  AddOnDemandConverter(dtBytes, dtInteger, TDataConverters.BytesToInt32, TDataConverters.Int32ToBytes);
  AddOnDemandConverter(dtBytes, dtUInt32, TDataConverters.BytesToUInt32, TDataConverters.UInt32ToBytes);
  AddOnDemandConverter(dtBytes, dtInt64, TDataConverters.BytesToInt64, TDataConverters.Int64ToBytes);
  AddOnDemandConverter(dtBytes, dtSingle, TDataConverters.BytesToSingle, TDataConverters.SingleToBytes);
  AddOnDemandConverter(dtBytes, dtFloat, TDataConverters.BytesToFloat, TDataConverters.FloatToBytes);
  AddOnDemandConverter(dtBytes, dtCurrency, TDataConverters.BytesToFloat, TDataConverters.FloatToBytes);
  AddOnDemandConverter(dtBytes, dtExtended, TDataConverters.BytesToExtended, TDataConverters.ExtendedToBytes);
  AddOnDemandConverter(dtBytes, dtBCD, TDataConverters.BytesToBCD, TDataConverters.BCDToBytes, TSizeConverters.Size0, TSizeConverters.Size0);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtBytes, dtFMTBCD, TDataConverters.BytesToFMTBCD, TDataConverters.FMTBCDToBytes, TSizeConverters.Size0, TSizeConverters.Size0);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtBytes, dtDate, TDataConverters.BytesToDate, TDataConverters.DateToBytes);
  AddOnDemandConverter(dtBytes, dtTime, TDataConverters.BytesToTime, TDataConverters.TimeToBytes);
  AddOnDemandConverter(dtBytes, dtDateTime, TDataConverters.BytesToDateTime, TDataConverters.DateTimeToBytes);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtBytes, dtSQLTimeStamp, TDataConverters.BytesToSQLTimeStamp, TDataConverters.SQLTimeStampToBytes);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtBytes, dtString, TDataConverters.BytesToAStr, TDataConverters.AStrToBytes, TSizeConverters.CopySize);
  AddOnDemandConverter(dtBytes, dtExtString, TDataConverters.BytesToExtAStr, TDataConverters.ExtAStrToBytes, TSizeConverters.CopySize);
  AddOnDemandConverter(dtBytes, dtWideString, TDataConverters.BytesToWStr, TDataConverters.WStrToBytes, TSizeConverters.SizeDiv2);
  AddOnDemandConverter(dtBytes, dtExtWideString, TDataConverters.BytesToExtWStr, TDataConverters.ExtWStrToBytes, TSizeConverters.SizeDiv2);
  AddOnDemandConverter(dtBytes, dtBytes, TDataConverters.BytesToBytes, TDataConverters.BytesToBytes, TSizeConverters.CopySize);
  AddOnDemandConverter(dtBytes, dtVarBytes, TDataConverters.BytesToVarBytes, TDataConverters.VarBytesToBytes, TSizeConverters.CopySize);
  AddOnDemandConverter(dtBytes, dtExtVarBytes, TDataConverters.BytesToExtVarBytes, TDataConverters.ExtVarBytesToBytes, TSizeConverters.CopySize);

  AddOnDemandConverter(dtVarBytes, dtBoolean, TDataConverters.VarBytesToBool, TDataConverters.BoolToVarBytes);
  AddOnDemandConverter(dtVarBytes, dtInt8, TDataConverters.VarBytesToInt8, TDataConverters.Int8ToVarBytes);
  AddOnDemandConverter(dtVarBytes, dtUInt8, TDataConverters.VarBytesToUInt8, TDataConverters.UInt8ToVarBytes);
  AddOnDemandConverter(dtVarBytes, dtSmallint, TDataConverters.VarBytesToInt16, TDataConverters.Int16ToVarBytes);
  AddOnDemandConverter(dtVarBytes, dtWord, TDataConverters.VarBytesToUInt16, TDataConverters.UInt16ToVarBytes);
  AddOnDemandConverter(dtVarBytes, dtInteger, TDataConverters.VarBytesToInt32, TDataConverters.Int32ToVarBytes);
  AddOnDemandConverter(dtVarBytes, dtUInt32, TDataConverters.VarBytesToUInt32, TDataConverters.UInt32ToVarBytes);
  AddOnDemandConverter(dtVarBytes, dtInt64, TDataConverters.VarBytesToInt64, TDataConverters.Int64ToVarBytes);
  AddOnDemandConverter(dtVarBytes, dtSingle, TDataConverters.VarBytesToSingle, TDataConverters.SingleToVarBytes);
  AddOnDemandConverter(dtVarBytes, dtFloat, TDataConverters.VarBytesToFloat, TDataConverters.FloatToVarBytes);
  AddOnDemandConverter(dtVarBytes, dtCurrency, TDataConverters.VarBytesToFloat, TDataConverters.FloatToVarBytes);
  AddOnDemandConverter(dtVarBytes, dtExtended, TDataConverters.VarBytesToExtended, TDataConverters.ExtendedToVarBytes);
  AddOnDemandConverter(dtVarBytes, dtBCD, TDataConverters.VarBytesToBCD, TDataConverters.BCDToVarBytes, TSizeConverters.Size0, TSizeConverters.Size0);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtVarBytes, dtFMTBCD, TDataConverters.VarBytesToFMTBCD, TDataConverters.FMTBCDToVarBytes, TSizeConverters.Size0, TSizeConverters.Size0);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtVarBytes, dtDate, TDataConverters.VarBytesToDate, TDataConverters.DateToVarBytes);
  AddOnDemandConverter(dtVarBytes, dtTime, TDataConverters.VarBytesToTime, TDataConverters.TimeToVarBytes);
  AddOnDemandConverter(dtVarBytes, dtDateTime, TDataConverters.VarBytesToDateTime, TDataConverters.DateTimeToVarBytes);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtVarBytes, dtSQLTimeStamp, TDataConverters.VarBytesToSQLTimeStamp, TDataConverters.SQLTimeStampToVarBytes);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtVarBytes, dtString, TDataConverters.VarBytesToAStr, TDataConverters.AStrToVarBytes, TSizeConverters.CopySize);
  AddOnDemandConverter(dtVarBytes, dtExtString, TDataConverters.VarBytesToExtAStr, TDataConverters.ExtAStrToVarBytes, TSizeConverters.CopySize);
  AddOnDemandConverter(dtVarBytes, dtWideString, TDataConverters.VarBytesToWStr, TDataConverters.WStrToVarBytes, TSizeConverters.SizeDiv2);
  AddOnDemandConverter(dtVarBytes, dtExtWideString, TDataConverters.VarBytesToExtWStr, TDataConverters.ExtWStrToVarBytes, TSizeConverters.SizeDiv2);
  AddOnDemandConverter(dtVarBytes, dtBytes, TDataConverters.VarBytesToBytes, TDataConverters.BytesToVarBytes, TSizeConverters.CopySize);
  AddOnDemandConverter(dtVarBytes, dtVarBytes, TDataConverters.VarBytesToVarBytes, TDataConverters.VarBytesToVarBytes, TSizeConverters.CopySize);
  AddOnDemandConverter(dtVarBytes, dtExtVarBytes, TDataConverters.VarBytesToExtVarBytes, TDataConverters.ExtVarBytesToVarBytes, TSizeConverters.CopySize);

  AddOnDemandConverter(dtExtVarBytes, dtBoolean, TDataConverters.ExtVarBytesToBool, TDataConverters.BoolToExtVarBytes);
  AddOnDemandConverter(dtExtVarBytes, dtInt8, TDataConverters.ExtVarBytesToInt8, TDataConverters.Int8ToExtVarBytes);
  AddOnDemandConverter(dtExtVarBytes, dtUInt8, TDataConverters.ExtVarBytesToUInt8, TDataConverters.UInt8ToExtVarBytes);
  AddOnDemandConverter(dtExtVarBytes, dtSmallint, TDataConverters.ExtVarBytesToInt16, TDataConverters.Int16ToExtVarBytes);
  AddOnDemandConverter(dtExtVarBytes, dtWord, TDataConverters.ExtVarBytesToUInt16, TDataConverters.UInt16ToExtVarBytes);
  AddOnDemandConverter(dtExtVarBytes, dtInteger, TDataConverters.ExtVarBytesToInt32, TDataConverters.Int32ToExtVarBytes);
  AddOnDemandConverter(dtExtVarBytes, dtUInt32, TDataConverters.ExtVarBytesToUInt32, TDataConverters.UInt32ToExtVarBytes);
  AddOnDemandConverter(dtExtVarBytes, dtInt64, TDataConverters.ExtVarBytesToInt64, TDataConverters.Int64ToExtVarBytes);
  AddOnDemandConverter(dtExtVarBytes, dtSingle, TDataConverters.ExtVarBytesToSingle, TDataConverters.SingleToExtVarBytes);
  AddOnDemandConverter(dtExtVarBytes, dtFloat, TDataConverters.ExtVarBytesToFloat, TDataConverters.FloatToExtVarBytes);
  AddOnDemandConverter(dtExtVarBytes, dtCurrency, TDataConverters.ExtVarBytesToFloat, TDataConverters.FloatToExtVarBytes);
  AddOnDemandConverter(dtExtVarBytes, dtExtended, TDataConverters.ExtVarBytesToExtended, TDataConverters.ExtendedToExtVarBytes);
  AddOnDemandConverter(dtExtVarBytes, dtBCD, TDataConverters.ExtVarBytesToBCD, TDataConverters.BCDToExtVarBytes, TSizeConverters.Size0, TSizeConverters.Size0);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtExtVarBytes, dtFMTBCD, TDataConverters.ExtVarBytesToFMTBCD, TDataConverters.FMTBCDToExtVarBytes, TSizeConverters.Size0, TSizeConverters.Size0);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtExtVarBytes, dtDate, TDataConverters.ExtVarBytesToDate, TDataConverters.DateToExtVarBytes);
  AddOnDemandConverter(dtExtVarBytes, dtTime, TDataConverters.ExtVarBytesToTime, TDataConverters.TimeToExtVarBytes);
  AddOnDemandConverter(dtExtVarBytes, dtDateTime, TDataConverters.ExtVarBytesToDateTime, TDataConverters.DateTimeToExtVarBytes);
{$IFDEF VER6P}{$IFNDEF FPC}
  AddOnDemandConverter(dtExtVarBytes, dtSQLTimeStamp, TDataConverters.ExtVarBytesToSQLTimeStamp, TDataConverters.SQLTimeStampToExtVarBytes);
{$ENDIF}{$ENDIF}
  AddOnDemandConverter(dtExtVarBytes, dtString, TDataConverters.ExtVarBytesToAStr, TDataConverters.AStrToExtVarBytes, TSizeConverters.CopySize);
  AddOnDemandConverter(dtExtVarBytes, dtExtString, TDataConverters.ExtVarBytesToExtAStr, TDataConverters.ExtAStrToExtVarBytes, TSizeConverters.CopySize);
  AddOnDemandConverter(dtExtVarBytes, dtWideString, TDataConverters.ExtVarBytesToWStr, TDataConverters.WStrToExtVarBytes, TSizeConverters.SizeDiv2);
  AddOnDemandConverter(dtExtVarBytes, dtExtWideString, TDataConverters.ExtVarBytesToExtWStr, TDataConverters.ExtWStrToExtVarBytes, TSizeConverters.SizeDiv2);
  AddOnDemandConverter(dtExtVarBytes, dtBytes, TDataConverters.ExtVarBytesToBytes, TDataConverters.BytesToExtVarBytes, TSizeConverters.CopySize);
  AddOnDemandConverter(dtExtVarBytes, dtVarBytes, TDataConverters.ExtVarBytesToVarBytes, TDataConverters.VarBytesToExtVarBytes, TSizeConverters.CopySize);
  AddOnDemandConverter(dtExtVarBytes, dtExtVarBytes, TDataConverters.ExtVarBytesToExtVarBytes, TDataConverters.ExtVarBytesToExtVarBytes, TSizeConverters.CopySize);

  AddOnDemandConverter(dtGuid, dtString, TDataConverters.GuidToAStr, TDataConverters.AStrToGuid, TSizeConverters.GuidSize);
  AddOnDemandConverter(dtGuid, dtExtString, TDataConverters.GuidToExtAStr, TDataConverters.ExtAStrToGuid, TSizeConverters.GuidSize);
  AddOnDemandConverter(dtGuid, dtWideString, TDataConverters.GuidToWStr, TDataConverters.WStrToGuid, TSizeConverters.GuidSize);
  AddOnDemandConverter(dtGuid, dtExtWideString, TDataConverters.GuidToExtWStr, TDataConverters.ExtWStrToGuid, TSizeConverters.GuidSize);
end;

destructor TConverterManager.Destroy;
begin
  ClearFetchMappers;
  FFetchConverters.Free;

  ClearOnDemandConverters;
  FOnDemandConverters.Free;

  inherited;
end;

function TConverterManager.GetFetchConverter(Index: integer): TFetchConverter;
begin
  Result := TFetchConverter(FFetchConverters[Index]);
end;

function TConverterManager.GetFetchConverterCount: integer;
begin
  Result := FFetchConverters.Count;
end;

function TConverterManager.GetOnDemandConverter(Index: integer): TOnDemandConverter;
begin
  Result := TOnDemandConverter(FOnDemandConverters[Index]);
end;

function TConverterManager.GetOnDemandConverterCount: integer;
begin
  Result := FOnDemandConverters.Count;
end;

class function TConverterManager.GetDBProvider: Word;
begin
  Result := 0;
end;

procedure TConverterManager.AddFetchConverter(FetchConverter: TFetchConverter);
begin
  FFetchConverters.Add(FetchConverter);
end;

procedure TConverterManager.AddFetchConverter(DBType, RequiredDataType: Word);
var
  FetchConverter: TFetchConverter;
begin
  FetchConverter := TFetchConverter.Create(DBType, -1, -1, -1, -1, RequiredDataType, RequiredDataType, nil, nil);
  AddFetchConverter(FetchConverter);
end;

procedure TConverterManager.AddFetchConverter(DBType, RequiredDataType, DestDataType: Word; CalcLength: TCalcSizeFunc = nil; CalcScale: TCalcSizeFunc = nil);
var
  FetchConverter: TFetchConverter;
begin
  FetchConverter := TFetchConverter.Create(DBType, -1, -1, -1, -1, RequiredDataType, DestDataType, CalcLength, CalcScale);
  AddFetchConverter(FetchConverter);
end;

procedure TConverterManager.AddFetchConverter(DBType: Word; DBLengthMin, DBLengthMax, DBScaleMin, DBScaleMax: integer; RequiredDataType: Word);
var
  FetchConverter: TFetchConverter;
begin
  FetchConverter := TFetchConverter.Create(DBType, DBLengthMin, DBLengthMax, DBScaleMin, DBScaleMax, RequiredDataType, RequiredDataType, nil, nil);
  AddFetchConverter(FetchConverter)
end;

procedure TConverterManager.AddFetchConverter(DBType: Word; DBLengthMin, DBLengthMax, DBScaleMin, DBScaleMax: integer; RequiredDataType, DestDataType: Word; CalcLength: TCalcSizeFunc = nil; CalcScale: TCalcSizeFunc = nil);
var
  FetchConverter: TFetchConverter;
begin
  FetchConverter := TFetchConverter.Create(DBType, DBLengthMin, DBLengthMax, DBScaleMin, DBScaleMax, RequiredDataType, DestDataType, CalcLength, CalcScale);
  AddFetchConverter(FetchConverter)
end;

procedure TConverterManager.DeleteFetchConverter(Index: integer);
begin
  FFetchConverters.Delete(Index);
end;

procedure TConverterManager.ClearFetchMappers;
begin
  FFetchConverters.Clear;
end;

procedure TConverterManager.AddOnDemandConverter(OnDemandConverter: TOnDemandConverter);
begin
  FOnDemandConverters.Add(OnDemandConverter);
end;

procedure TConverterManager.AddOnDemandConverter(SourceType, DestType: Word; GetDataConverter, PutDataConverter: TConvertProcedure; CalcLength: TCalcSizeFunc = nil; CalcScale: TCalcSizeFunc = nil);
var
  OnDemandConverter: TOnDemandConverter;
begin
  OnDemandConverter := TOnDemandConverter.Create(SourceType, DestType, GetDataConverter, PutDataConverter, CalcLength, CalcScale);
  AddOnDemandConverter(OnDemandConverter);
end;

procedure TConverterManager.DeleteOnDemandConverter(Index: integer);
begin
  FOnDemandConverters.Delete(Index);
end;

procedure TConverterManager.ClearOnDemandConverters;
begin
  FOnDemandConverters.Clear;
end;

function TConverterManager.DetectFetchConverter(DBType: Word; DBLength, DBScale: integer; DestDataType: Word): TFetchConverter;
var
  i: Integer;
  FetchConverter: TFetchConverter;
begin
  Result := nil;

  for i := 0 to FFetchConverters.Count - 1 do begin
    FetchConverter := TFetchConverter(FFetchConverters[i]);

    if (DBType = FetchConverter.DBType) and
       (DestDataType = FetchConverter.DestDataType) and
       ((DBLength = -1) or (((FetchConverter.FDBLengthMin = -1) or (DBLength >= FetchConverter.FDBLengthMin)) and
                           ((FetchConverter.FDBLengthMax  = -1) or (DBLength <= FetchConverter.FDBLengthMax)))) and
       ((DBScale = -1)  or (((FetchConverter.FDBScaleMin  = -1)  or (DBScale >= FetchConverter.FDBScaleMin)) and
                           ((FetchConverter.FDBScaleMax   = -1)  or (DBScale <= FetchConverter.FDBScaleMax))))
    then begin
      Result := FetchConverter;
      exit;
    end;
  end;
end;

function TConverterManager.DetectOnDemandConverter(SourceDataType, DestDataType: Word): TOnDemandConverter;
var
  i: Integer;
  OnDemandConverter: TOnDemandConverter;
begin
  Result := nil;

  for i := 0 to FOnDemandConverters.Count - 1 do begin
    OnDemandConverter := TOnDemandConverter(FOnDemandConverters[i]);

    if (OnDemandConverter.SourceDataType = SourceDataType) and
       (OnDemandConverter.DestDataType = DestDataType)
    then begin
      Result := OnDemandConverter;
      exit;
    end;
  end;
end;

{ TSizeConverters }

class function TSizeConverters.CopySize(Value: Integer): Integer;
begin
  Result := Value;
end;

class function TSizeConverters.SizeX2(Value: Integer): Integer;
begin
  Result := Value * 2;
end;

class function TSizeConverters.SizeDiv2(Value: Integer): Integer;
begin
  Result := Value div 2;
end;

class function TSizeConverters.Size0(Value: Integer): Integer;
begin
  Result := 0;
end;

class function TSizeConverters.Size20(Value: Integer): Integer;
begin
  Result := 20;
end;

class function TSizeConverters.Size32(Value: Integer): Integer;
begin
  Result := 32;
end;

class function TSizeConverters.GuidSize(Value: Integer): Integer;
begin
  Result := 38;
end;

{ TDataConverters }

class function TDataConverters.InternalInt8ToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus;
begin
  Str := IntToStr(ShortInt(Marshal.ReadByte(Source)));

  if Length(Str) > DestLen then
    Result := csValueOverflow
  else
    Result := csSuccess;
end;

class function TDataConverters.InternalUInt8ToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus;
begin
  Str := IntToStr(Byte(Marshal.ReadByte(Source)));

  if Length(Str) > DestLen then
    Result := csValueOverflow
  else
    Result := csSuccess;
end;

class function TDataConverters.InternalInt16ToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus;
begin
  Str := IntToStr(SmallInt(Marshal.ReadInt16(Source)));

  if Length(Str) > DestLen then
    Result := csValueOverflow
  else
    Result := csSuccess;
end;

class function TDataConverters.InternalUInt16ToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus;
begin
  Str := IntToStr(Word(Marshal.ReadInt16(Source)));

  if Length(Str) > DestLen then
    Result := csValueOverflow
  else
    Result := csSuccess;
end;

class function TDataConverters.InternalInt32ToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus;
begin
  Str := IntToStr(Integer(Marshal.ReadInt32(Source)));

  if Length(Str) > DestLen then
    Result := csValueOverflow
  else
    Result := csSuccess;
end;

class function TDataConverters.InternalUInt32ToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus;
begin
  Str := IntToStr(LongWord(Marshal.ReadInt32(Source)));

  if Length(Str) > DestLen then
    Result := csValueOverflow
  else
    Result := csSuccess;
end;

class function TDataConverters.InternalInt64ToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus;
begin
  Str := IntToStr(Marshal.ReadInt64(Source));

  if Length(Str) > DestLen then
    Result := csValueOverflow
  else
    Result := csSuccess;
end;

{$IFDEF VER12P}
class function TDataConverters.InternalUInt64ToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus;
var
  ui64: UInt64;
begin
  ui64 := UInt64(Marshal.ReadInt64(Source));
  Str := UIntToStr(ui64);

  if Length(Str) > DestLen then
    Result := csValueOverflow
  else
    Result := csSuccess;
end;
{$ENDIF}

class function TDataConverters.InternalSingleToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus;
var
  s: Single;
  DecPos: integer;
begin
  s := CRBitConverter.Int32BitsToSingle(Marshal.ReadInt32(Source));
  Str := FloatToStr(s);

  if Length(Str) > DestLen then begin
    DecPos := Pos({$IFDEF VER16P}FormatSettings.{$ENDIF}DecimalSeparator, Str);
    if (DecPos > 0) and (DecPos - 1 <= DestLen) then
      Result := csFractionTruncated
    else
      Result := csValueOverflow;
  end
  else
    Result := csSuccess;
end;

class function TDataConverters.InternalFloatToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus;
var
  d: Double;
  DecPos: integer;
begin
  d := BitConverter.Int64BitsToDouble(Marshal.ReadInt64(Source));
  Str := FloatToStr(d);

  if Length(Str) > DestLen then begin
    DecPos := Pos({$IFDEF VER16P}FormatSettings.{$ENDIF}DecimalSeparator, Str);
    if (DecPos > 0) and (DecPos - 1 <= DestLen) then
      Result := csFractionTruncated
    else
      Result := csValueOverflow;
  end
  else
    Result := csSuccess;
end;

class function TDataConverters.InternalExtendedToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus;
var
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
  DecPos: integer;
begin
{$IFDEF CLR}
  e := BitConverter.Int64BitsToDouble(Marshal.ReadInt64(Source));
{$ELSE}
  e := Extended(Source^);
{$ENDIF}
  Str := FloatToStr(e);

  if Length(Str) > DestLen then begin
    DecPos := Pos({$IFDEF VER16P}FormatSettings.{$ENDIF}DecimalSeparator, Str);
    if (DecPos > 0) and (DecPos - 1 <= DestLen) then
      Result := csFractionTruncated
    else
      Result := csValueOverflow;
  end
  else
    Result := csSuccess;
end;

class function TDataConverters.InternalBCDToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus;
var
  d: Double;
  DecPos: integer;
begin
  d := Marshal.ReadInt64(Source) / 10000;
  Str := FloatToStr(d);

  if Length(Str) > DestLen then begin
    DecPos := Pos({$IFDEF VER16P}FormatSettings.{$ENDIF}DecimalSeparator, Str);
    if (DecPos > 0) and (DecPos - 1 <= DestLen) then
      Result := csFractionTruncated
    else
      Result := csValueOverflow;
  end
  else
    Result := csSuccess;
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.InternalFMTBCDToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus;
var
  Bcd: TBcd;
  DecPos: integer;
begin
  InternalReadFMTBCD(Source, bcd);
  Str := BcdToStr(Bcd);

  if Length(Str) > DestLen then begin
    DecPos := Pos({$IFDEF VER16P}FormatSettings.{$ENDIF}DecimalSeparator, Str);
    if (DecPos > 0) and (DecPos - 1 <= DestLen) then
      Result := csFractionTruncated
    else
      Result := csValueOverflow;
  end
  else
    Result := csSuccess;
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.InternalBoolToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus;
var
  wb: WordBool;
begin
  wb := WordBool(Marshal.ReadInt16(Source));
  if wb then
    Str := 'True'
  else
    Str := 'False';

  if Length(Str) > DestLen then
    Result := csValueOverflow
  else
    Result := csSuccess;
end;

class function TDataConverters.InternalDateToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus;
var
  ts: TTimeStamp;
begin
  ts.Date := Marshal.ReadInt32(Source);
  ts.Time := 0;
  Str := DateToStr(TimeStampToDateTime(ts));

  if Length(Str) > DestLen then
    Result := csValueOverflow
  else
    Result := csSuccess;
end;

class function TDataConverters.InternalTimeToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus;
var
  ts: TTimeStamp;
begin
  ts.Date := DateDelta;
  ts.Time := Marshal.ReadInt32(Source);
  Str := TimeToStr(TimeStampToDateTime(ts));

  if Length(Str) > DestLen then
    Result := csValueOverflow
  else
    Result := csSuccess;
end;

class function TDataConverters.InternalDateTimeToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus;
var
  d: Double;
begin
  d := BitConverter.Int64BitsToDouble(Marshal.ReadInt64(Source));
{$IFDEF CLR}
  Str := DateTimeToStr(TimeStampToDateTime(MSecsToTimeStamp(Trunc(d))));
{$ELSE}{$IFDEF FPC}
  Str := DateTimeToStr(TimeStampToDateTime(MSecsToTimeStamp(Trunc(d))));
{$ELSE}
  Str := DateTimeToStr(TimeStampToDateTime(MSecsToTimeStamp(d)));
{$ENDIF}{$ENDIF}

  if Length(Str) > DestLen then
    Result := csValueOverflow
  else
    Result := csSuccess;
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.InternalSQLTimeStampToStr(Source: IntPtr; out Str: String; DestLen: Integer): TConvertStatus;
var
  SQLTimeStamp: TSQLTimeStamp;
{$IFDEF CLR}
  Data: TBytes;
{$ENDIF}
begin
{$IFDEF CLR}
  SetLength(Data, SizeOf(TSQLTimeStamp));
  Marshal.Copy(Source, Data, 0, SizeOf(TSQLTimeStamp));
  SQLTimeStamp := TSQLTimeStamp.FromBytes(Data);
{$ELSE}
  SQLTimeStamp := PSQLTimeStamp(Source)^;
{$ENDIF}
  Str := SQLTimeStampToStr('', SQLTimeStamp);

  if Length(Str) > DestLen then
    Result := csValueOverflow
  else
    Result := csSuccess;
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.InternalStrToNumber(const Str: String; out Value: Int64): TConvertStatus;
var
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
begin
  if not TryStrToFloat(Trim(Str), e) then begin
    Result := csInvalidIntegerValue;
    Value := 0;
  end
  else
    if (e > Int64($7FFFFFFFFFFFFFFF)) or (e < Int64($8000000000000000)) then begin
      Result := csValueOutOfRange;
      Value := 0;
    end
    else begin
      if {$IFNDEF CLR}System.{$ENDIF}Frac(e) <> 0 then
        Result := csFractionTruncated
      else
        Result := csSuccess;

      Value := Trunc(e);
    end;
end;

{$IFDEF VER12P}
class function TDataConverters.InternalStrToUNumber(const Str: String; out Value: UInt64): TConvertStatus;
var
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
  ui64: UInt64;
begin
  if not TryStrToFloat(Trim(Str), e) then begin
    Result := csInvalidIntegerValue;
    Value := 0;
  end
  else begin
    ui64 := UInt64($FFFFFFFFFFFFFFFF);
    if (e > ui64) or (e < 0) then begin
      Result := csValueOutOfRange;
      Value := 0;
    end
    else begin
      if {$IFNDEF CLR}System.{$ENDIF}Frac(e) <> 0 then
        Result := csFractionTruncated
      else
        Result := csSuccess;

      Value := Trunc(e);
    end;
  end;
end;
{$ENDIF}

class function TDataConverters.InternalStrToInt8(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  if not TryStrToInt64(Trim(Str), i64) then begin
    Result := InternalStrToNumber(Str, i64);
    if (Result <> csSuccess) and not IgnoreConvertErrors then
      Exit;
  end
  else
    Result := csSuccess;

  r := InternalInt64ToInt8(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.InternalStrToUInt8(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  if not TryStrToInt64(Trim(Str), i64) then begin
    Result := InternalStrToNumber(Str, i64);
    if (Result <> csSuccess) and not IgnoreConvertErrors then
      Exit;
  end
  else
    Result := csSuccess;

  r := InternalInt64ToUInt8(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.InternalStrToInt16(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  if not TryStrToInt64(Trim(Str), i64) then begin
    Result := InternalStrToNumber(Str, i64);
    if (Result <> csSuccess) and not IgnoreConvertErrors then
      Exit;
  end
  else
    Result := csSuccess;

  r := InternalInt64ToInt16(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.InternalStrToUInt16(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  if not TryStrToInt64(Trim(Str), i64) then begin
    Result := InternalStrToNumber(Str, i64);
    if (Result <> csSuccess) and not IgnoreConvertErrors then
      Exit;
  end
  else
    Result := csSuccess;

  r := InternalInt64ToUInt16(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.InternalStrToInt32(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  if not TryStrToInt64(Trim(Str), i64) then begin
    Result := InternalStrToNumber(Str, i64);
    if (Result <> csSuccess) and not IgnoreConvertErrors then
      Exit;
  end
  else
    Result := csSuccess;

  r := InternalInt64ToInt32(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.InternalStrToUInt32(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  if not TryStrToInt64(Trim(Str), i64) then begin
    Result := InternalStrToNumber(Str, i64);
    if (Result <> csSuccess) and not IgnoreConvertErrors then
      Exit;
  end
  else
    Result := csSuccess;

  r := InternalInt64ToUInt32(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.InternalStrToInt64(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
begin
  if not TryStrToInt64(Trim(Str), i64) then begin
    Result := InternalStrToNumber(Str, i64);
    if (Result <> csSuccess) and not IgnoreConvertErrors then
      Exit;
  end
  else
    Result := csSuccess;

  Marshal.WriteInt64(Dest, i64);
end;

{$IFDEF VER12P}
class function TDataConverters.InternalStrToUInt64(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  ui64: UInt64;
begin
  if not TryStrToUInt64(Trim(Str), ui64) then begin
    Result := InternalStrToUNumber(Str, ui64);
    if (Result <> csSuccess) and not IgnoreConvertErrors then
      Exit;
  end
  else
    Result := csSuccess;

  Marshal.WriteInt64(Dest, Int64(ui64));
end;
{$ENDIF}

class function TDataConverters.InternalStrToSingle(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
begin
  if not TryStrToFloat(Trim(Str), e) then begin
    Result := csInvalidNumericValue;
    if not IgnoreConvertErrors then
      Exit
    else
      e := 0;
  end
  else
    if e < -MaxSingle then begin
      Result := csValueOutOfRange;
      if not IgnoreConvertErrors then
        Exit
      else
        e := -MaxSingle;
    end
    else
    if e > MaxSingle then begin
      Result := csValueOutOfRange;
      if not IgnoreConvertErrors then
        Exit
      else
        e := MaxSingle;
    end
    else
      Result := csSuccess;

  Marshal.WriteInt32(Dest, CRBitConverter.SingleToInt32Bits(e));
end;

class function TDataConverters.InternalStrToFloat(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
begin
  if not TryStrToFloat(Trim(Str), e) then begin
    Result := csInvalidNumericValue;
    if not IgnoreConvertErrors then
      Exit
    else
      e := 0;
  end
  else
    Result := csSuccess;

  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(e));
end;

class function TDataConverters.InternalStrToExtended(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
begin
  if not TryStrToFloat(Trim(Str), e) then begin
    Result := csInvalidNumericValue;
    if not IgnoreConvertErrors then
      Exit
    else
      e := 0;
  end
  else
    Result := csSuccess;

{$IFDEF CLR}
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(e));
{$ELSE}
  Extended(Dest^) := e;
{$ENDIF}
end;

class function TDataConverters.InternalStrToBCD(const Str: String; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
  r: TConvertStatus;
begin
  if not TryStrToFloat(Trim(Str), e) then begin
    Result := csInvalidNumericValue;
    if not IgnoreConvertErrors then
      Exit
    else
      e := 0;
  end
  else
    Result := csSuccess;

  r := InternalExtendedToBCD(e, Dest, DestLen, DestScale, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.InternalStrToFMTBCD(const Str: String; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  bcd: TBCD;
  r: TConvertStatus;
begin
  if not TryStrToBcd(Trim(Str), bcd) then begin
    Result := csInvalidNumericValue;
    if not IgnoreConvertErrors then
      Exit
    else
      bcd := DoubleToBcd(0);
  end
  else
    Result := csSuccess;

  r := InternalBCDToFMTBCD(bcd, Dest, DestLen, DestScale, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.InternalStrToBool(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  b: boolean;
begin
  if not TryStrToBool(Trim(Str), b) then begin
    Result := csInvalidBooleanValue;
    if not IgnoreConvertErrors then
      Exit
    else
      b := False;
  end
  else
    Result := csSuccess;

  Marshal.WriteInt16(Dest, SmallInt(WordBool(b)));
end;

class function TDataConverters.InternalStrToDate(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  dt: TDateTime;
begin
  if not TryStrToDateTime(Trim(Str), dt) then begin
    Result := csInvalidDateTimeValue;
    if not IgnoreConvertErrors then
      Exit
    else
      dt := 0;
  end
  else
    if {$IFNDEF CLR}System.{$ENDIF}Frac(dt) <> 0 then
      Result := csDataTruncated
    else
      Result := csSuccess;

  Marshal.WriteInt32(Dest, DateTimeToTimeStamp(dt).Date);
end;

class function TDataConverters.InternalStrToTime(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  dt: TDateTime;
begin
  if not TryStrToDateTime(Trim(Str), dt) then begin
    Result := csInvalidDateTimeValue;
    if not IgnoreConvertErrors then
      Exit
    else
      dt := 0;
  end
  else
    Result := csSuccess;

  Marshal.WriteInt32(Dest, DateTimeToTimeStamp(dt).Time);
end;

class function TDataConverters.InternalStrToDateTime(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  dt: TDateTime;
begin
  if not TryStrToDateTime(Trim(Str), dt) then begin
    Result := csInvalidDateTimeValue;
    if not IgnoreConvertErrors then
      Exit
    else
      dt := 0;
  end
  else
    Result := csSuccess;

  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(TimeStampToMSecs(DateTimeToTimeStamp(dt))));
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.InternalStrToSQLTimeStamp(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SQLTimeStamp: TSQLTimeStamp;
{$IFDEF CLR}
  Data: TBytes;
{$ENDIF}
begin
  if not TryStrToSQLTimeStamp(Trim(Str), SQLTimeStamp) then begin
    Result := csInvalidDateTimeValue;
    if not IgnoreConvertErrors then
      Exit
    else
      SQLTimeStamp := SqlTimSt.DateTimeToSQLTimeStamp(0);
  end
  else
    Result := csSuccess;

{$IFDEF CLR}
  Data := TSQLTimeStamp.ToBytes(SQLTimeStamp);
  Marshal.Copy(Data, 0, Dest, SizeOf(TSQLTimeStamp));
{$ELSE}
  PSQLTimeStamp(Dest)^ := SQLTimeStamp;
{$ENDIF}
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.InternalStrToGUID(const Str: String; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  GuidStr: string;
  Guid: TGUID;
  r: TConvertStatus;
begin
  GuidStr := Trim(Str);
  if Length(GuidStr) > 1 then begin
    if GuidStr[1] <> '{' then
      GuidStr := '{' + GuidStr;
    if string(GuidStr[Length(GuidStr)]) <> '}' then // Range check error
      GuidStr := GuidStr + '}';
  end;

  if not TryStrToGUID(GuidStr, Guid) then begin
    Result := csInvalidGUIDValue;
    if not IgnoreConvertErrors then
      Exit
    else
      GuidStr := '{00000000-0000-0000-0000-000000000000}';
  end
  else
    Result := csSuccess;

  r := InternalWriteAStr(AnsiString(GuidStr), Dest, 38, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class procedure TDataConverters.InternalCopyToBlob(Source: IntPtr; SourceLen: Integer; Dest: IntPtr);
var
  Blob: TBlob;
begin
  Blob := TBlob(GetGCHandleTarget(Marshal.ReadIntPtr(Dest)));
  Blob.Clear;
  Blob.Write(0, SourceLen, Source);
end;

class function TDataConverters.InternalCopyFromBlob(Source: IntPtr; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Blob: TBlob;
  BlobSize: Cardinal;
begin
  Blob := TBlob(GetGCHandleTarget(Marshal.ReadIntPtr(Source)));
  BlobSize := Blob.Size;
  if BlobSize = 0 then begin
    Result := csSuccess;
    Exit;
  end
  else
  if BlobSize <> Cardinal(DestLen) then begin
    Result := csInvalidBlobValue;
    if not IgnoreConvertErrors then
      Exit
    else
    if BlobSize > Cardinal(DestLen) then
      BlobSize := DestLen;
  end
  else
    Result := csSuccess;
  Blob.Read(0, BlobSize, Dest);
end;

class function TDataConverters.InternalCopyFromBlobToBytes(Source: IntPtr; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Blob: TBlob;
  BlobSize: Cardinal;
begin
  Blob := TBlob(GetGCHandleTarget(Marshal.ReadIntPtr(Source)));
  BlobSize := Blob.Size;
  if BlobSize > Cardinal(DestLen) then begin
    Result := csBinaryTruncated;
    if not IgnoreConvertErrors then
      Exit
    else
      BlobSize := DestLen;
  end
  else
    Result := csSuccess;
  if BlobSize > 0 then
    Blob.Read(0, BlobSize, Dest);
  FillChar(PtrOffset(Dest, BlobSize), Cardinal(DestLen) - BlobSize, 0);
end;

class function TDataConverters.InternalCopyFromBlobToVarBytes(Source: IntPtr; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Blob: TBlob;
  BlobSize: Cardinal;
begin
  Blob := TBlob(GetGCHandleTarget(Marshal.ReadIntPtr(Source)));
  BlobSize := Blob.Size;
  if BlobSize > Cardinal(DestLen) then begin
    Result := csBinaryTruncated;
    if not IgnoreConvertErrors then
      Exit
    else
      BlobSize := DestLen;
  end
  else
    Result := csSuccess;
  Marshal.WriteInt16(Dest, 0, BlobSize);
  if BlobSize > 0 then
    Blob.Read(0, BlobSize, PtrOffset(Dest, SizeOf(Word)));
end;

class function TDataConverters.InternalCopyFromBlobToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Blob: TBlob;
  BlobSize: Cardinal;
  NewBuf: IntPtr;
begin
  Blob := TBlob(GetGCHandleTarget(Marshal.ReadIntPtr(Source)));
  BlobSize := Blob.Size;
  if BlobSize > Cardinal(DestLen) then begin
    Result := csBinaryTruncated;
    if not IgnoreConvertErrors then
      Exit
    else
      BlobSize := DestLen;
  end
  else
    Result := csSuccess;
  StringHeap.DisposeBuf(Marshal.ReadIntPtr(Dest));
  NewBuf := StringHeap.NewBuf(BlobSize + SizeOf(Word));
  Marshal.WriteInt16(NewBuf, 0, BlobSize);
  if BlobSize > 0 then
    Blob.Read(0, BlobSize, PtrOffset(NewBuf, SizeOf(Word)));
  Marshal.WriteIntPtr(Dest, NewBuf);
end;

class procedure TDataConverters.InternalMemoToAStr(Source: IntPtr; out AStr: AnsiString);
var
  Blob: TBlob;
begin
  Blob := TBlob(GetGCHandleTarget(Marshal.ReadIntPtr(Source)));
  AStr := Blob.AsAnsiString;
end;

class procedure TDataConverters.InternalMemoToWStr(Source: IntPtr; out WStr: WideString);
var
  Blob: TBlob;
begin
  Blob := TBlob(GetGCHandleTarget(Marshal.ReadIntPtr(Source)));
  WStr := Blob.AsWideString;
end;

class procedure TDataConverters.InternalWideMemoToAStr(Source: IntPtr; out AStr: AnsiString);
var
  Blob: TBlob;
begin
  Blob := TBlob(GetGCHandleTarget(Marshal.ReadIntPtr(Source)));
  AStr := Blob.AsAnsiString;
end;

class procedure TDataConverters.InternalWideMemoToWStr(Source: IntPtr; out WStr: WideString);
var
  Blob: TBlob;
begin
  Blob := TBlob(GetGCHandleTarget(Marshal.ReadIntPtr(Source)));
  WStr := Blob.AsWideString;
end;

class procedure TDataConverters.InternalBytesToAStr(Source: IntPtr; SourceLen: Integer; out AStr: AnsiString);
{$IFDEF CLR}
var
  Data: TBytes;
{$ENDIF}
begin
  while SourceLen > 0 do begin
    if Marshal.ReadByte(Source, SourceLen - 1) <> 0  then
      break;
    Dec(SourceLen);
  end;

{$IFDEF CLR}
  SetLength(Data, SourceLen + 1);
  Marshal.Copy(Source, Data, 0, SourceLen);
  Data[SourceLen] := 0;
  AStr := Encoding.Default.GetString(Data);
{$ELSE}
  SetLengthA(AStr, SourceLen);
  CopyBuffer(Source, PAnsiChar(AStr), SourceLen);
{$ENDIF}
end;

class procedure TDataConverters.InternalBytesToWStr(Source: IntPtr; SourceLen: Integer; out WStr: WideString);
{$IFDEF CLR}
var
  Data: TBytes;
{$ENDIF}
begin
  SourceLen := SourceLen and $FFFFFFFE;
  while SourceLen > 0 do begin
    if Marshal.ReadInt16(Source, SourceLen - 2) <> 0  then
      break;
    Dec(SourceLen, 2);
  end;

{$IFDEF CLR}
  SetLength(Data, SourceLen + 2);
  Marshal.Copy(Source, Data, 0, SourceLen);
  Data[SourceLen] := 0;
  Data[SourceLen + 1] := 0;
  WStr := Encoding.Unicode.GetString(Data);
{$ELSE}
  SetLength(WStr, SourceLen div 2);
  CopyBuffer(Source, PWideChar(WStr), SourceLen);
{$ENDIF}
end;

class procedure TDataConverters.InternalVarBytesToAStr(Source: IntPtr; out AStr: AnsiString);
var
  Size: Integer;
{$IFDEF CLR}
  Data: TBytes;
{$ENDIF}
begin
  Size := Marshal.ReadInt16(Source);
{$IFDEF CLR}
  SetLength(Data, Size + 1);
  Marshal.Copy(PtrOffset(Source, SizeOf(Word)), Data, 0, Size);
  Data[Size] := 0;
  AStr := Encoding.Default.GetString(Data);
{$ELSE}
  SetLengthA(AStr, Size);
  CopyBuffer(PtrOffset(Source, SizeOf(Word)), PAnsiChar(AStr), Size);
{$ENDIF}
end;

class procedure TDataConverters.InternalVarBytesToWStr(Source: IntPtr; out WStr: WideString);
var
  Size: Integer;
{$IFDEF CLR}
  Data: TBytes;
{$ENDIF}
begin
  Size := Marshal.ReadInt16(Source) and $FFFFFFFE;
{$IFDEF CLR}
  SetLength(Data, Size + 2);
  Marshal.Copy(PtrOffset(Source, SizeOf(Word)), Data, 0, Size);
  Data[Size] := 0;
  Data[Size + 1] := 0;
  WStr := Encoding.Unicode.GetString(Data);
{$ELSE}
  SetLength(WStr, Size div 2);
  CopyBuffer(PtrOffset(Source, SizeOf(Word)), PWideChar(WStr), Size);
{$ENDIF}
end;

class function TDataConverters.InternalCopyToBytes(Source: IntPtr; SourceLen: Integer; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  if SourceLen > DestLen then begin
    Result := csBinaryTruncated;
    if not IgnoreConvertErrors then
      Exit
    else
      SourceLen := DestLen;
  end
  else
    Result := csSuccess;

  CopyBuffer(Source, Dest, SourceLen);
  FillChar(PtrOffset(Dest, SourceLen), DestLen - SourceLen, 0);
end;

class function TDataConverters.InternalCopyToVarBytes(Source: IntPtr; SourceLen: Integer; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  if SourceLen > DestLen then begin
    Result := csBinaryTruncated;
    if not IgnoreConvertErrors then
      Exit
    else
      SourceLen := DestLen;
  end
  else
    Result := csSuccess;

  Marshal.WriteInt16(Dest, 0, SourceLen);
  CopyBuffer(Source, PtrOffset(Dest, SizeOf(Word)), SourceLen);
end;

class function TDataConverters.InternalCopyToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen: Integer; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  NewBuf: IntPtr;
begin
  if SourceLen > DestLen then begin
    Result := csBinaryTruncated;
    if not IgnoreConvertErrors then
      Exit
    else
      SourceLen := DestLen;
  end
  else
    Result := csSuccess;

  StringHeap.DisposeBuf(Marshal.ReadIntPtr(Dest));
  NewBuf := StringHeap.NewBuf(SourceLen + SizeOf(Word));
  Marshal.WriteInt16(NewBuf, 0, SourceLen);
  CopyBuffer(Source, PtrOffset(NewBuf, SizeOf(Word)), SourceLen);
  Marshal.WriteIntPtr(Dest, NewBuf);
end;

class function TDataConverters.InternalExactCopyFromBytes(Source: IntPtr; SourceLen: Integer; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  if SourceLen <> DestLen then begin
    Result := csInvalidBinaryValue;
    if not IgnoreConvertErrors then
      Exit
    else
    if SourceLen > DestLen then
      SourceLen := DestLen;
  end
  else
    Result := csSuccess;

  CopyBuffer(Source, Dest, SourceLen);
end;

class function TDataConverters.InternalExactCopyFromVarBytes(Source: IntPtr; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourceLen: Integer;
begin
  SourceLen := Marshal.ReadInt16(Source);

  if SourceLen <> DestLen then begin
    Result := csInvalidBinaryValue;
    if not IgnoreConvertErrors then
      Exit
    else
    if SourceLen > DestLen then
      SourceLen := DestLen;
  end
  else
    Result := csSuccess;

  CopyBuffer(PtrOffset(Source, SizeOf(Word)), Dest, SourceLen);
end;

class function TDataConverters.InternalWriteAStr(const AStr: AnsiString; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
{$IFDEF CLR}
var
  Temp: IntPtr;
{$ENDIF}
begin
{$IFDEF CLR}
  Temp := Marshal.StringToHGlobalAnsi(AStr);
  try
    Result := InternalWritePAChar(Temp, Dest, DestLen, IgnoreConvertErrors);
  finally
    Marshal.FreeCoTaskMem(Temp);
  end;
{$ELSE}
  Result := InternalWritePAChar(PAChar(AStr), Dest, DestLen, IgnoreConvertErrors);
{$ENDIF}
end;

class function TDataConverters.InternalWritePAChar(AStr: PAChar; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Size: Integer;
begin
  Size := StrLen(AStr);

  if Size > DestLen then begin
    Result := csStringTruncated;
    if not IgnoreConvertErrors then
      Exit
    else
      Size := DestLen;
  end
  else
    Result := csSuccess;

  CopyBuffer(AStr, Dest, Size);
  Marshal.WriteByte(Dest, Size, 0);
end;

class function TDataConverters.InternalWriteExtAStr(StringHeap: TStringHeap; const AStr: AnsiString; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
{$IFDEF CLR}
var
  Temp: IntPtr;
{$ENDIF}
begin
{$IFDEF CLR}
  Temp := Marshal.StringToHGlobalAnsi(AStr);
  try
    Result := InternalWriteExtPAChar(StringHeap, Temp, Dest, DestLen, IgnoreConvertErrors);
  finally
    Marshal.FreeCoTaskMem(Temp);
  end;
{$ELSE}
  Result := InternalWriteExtPAChar(StringHeap, PAChar(AStr), Dest, DestLen, IgnoreConvertErrors);
{$ENDIF}
end;

class function TDataConverters.InternalWriteExtPAChar(StringHeap: TStringHeap; AStr: PAChar; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Size: Integer;
begin
  Size := StrLen(AStr);

  if Size > DestLen then begin
    Result := csStringTruncated;
    if not IgnoreConvertErrors then
      Exit
    else
      Size := DestLen;
  end
  else
    Result := csSuccess;

  StringHeap.DisposeBuf(Marshal.ReadIntPtr(Dest));
  Marshal.WriteIntPtr(Dest, StringHeap.AllocStr(AStr, False, Size));
end;

class function TDataConverters.InternalWriteWStr(const WStr: WideString; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
{$IFDEF CLR}
var
  Temp: IntPtr;
{$ENDIF}
begin
{$IFDEF CLR}
  Temp := Marshal.StringToHGlobalUni(WStr);
  try
    Result := InternalWritePWChar(Temp, Dest, DestLen, IgnoreConvertErrors);
  finally
    Marshal.FreeCoTaskMem(Temp);
  end;
{$ELSE}
  Result := InternalWritePWChar(PWChar(WStr), Dest, DestLen, IgnoreConvertErrors);
{$ENDIF}
end;

class function TDataConverters.InternalWritePWChar(WStr: PWChar; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Size: Integer;
begin
  Size := StrLenW(WStr);

  if Size > DestLen then begin
    Result := csStringTruncated;
    if not IgnoreConvertErrors then
      Exit
    else
      Size := DestLen;
  end
  else
    Result := csSuccess;

  CopyBuffer(WStr, Dest, Size * 2);
  Marshal.WriteInt16(Dest, Size * 2, 0);
end;

class function TDataConverters.InternalWriteExtWStr(StringHeap: TStringHeap; const WStr: WideString; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
{$IFDEF CLR}
var
  Temp: IntPtr;
{$ENDIF}
begin
{$IFDEF CLR}
  Temp := Marshal.StringToHGlobalUni(WStr);
  try
    Result := InternalWriteExtPWChar(StringHeap, Temp, Dest, DestLen, IgnoreConvertErrors);
  finally
    Marshal.FreeCoTaskMem(Temp);
  end;
{$ELSE}
  Result := InternalWriteExtPWChar(StringHeap, PWChar(WStr), Dest, DestLen, IgnoreConvertErrors);
{$ENDIF}
end;

class function TDataConverters.InternalWriteExtPWChar(StringHeap: TStringHeap; WStr: PWChar; Dest: IntPtr; DestLen: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Size: Integer;
begin
  Size := StrLenW(WStr);

  if Size > DestLen then begin
    Result := csStringTruncated;
    if not IgnoreConvertErrors then
      Exit
    else
      Size := DestLen;
  end
  else
    Result := csSuccess;

  StringHeap.DisposeBuf(Marshal.ReadIntPtr(Dest));
  Marshal.WriteIntPtr(Dest, StringHeap.AllocWideStr(WStr, False, Size));
end;

class function TDataConverters.InternalInt32ToInt8(Value: Integer; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  // Range check
  if (LongWord(Value) and $FFFFFF80 <> $00000000) and (LongWord(Value) and $FFFFFF80 <> $FFFFFF80) then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else if LongWord(Value) and $80000000 = 0 then
      Marshal.WriteByte(Dest, Byte($7F))
    else
      Marshal.WriteByte(Dest, Byte($80));
  end
  else begin
    Result := csSuccess;
    Marshal.WriteByte(Dest, Byte(Value));
  end;
end;

class function TDataConverters.InternalInt32ToUInt8(Value: Integer; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  // Range check
  if LongWord(Value) and $FFFFFF00 <> $00000000 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else if LongWord(Value) and $80000000 = 0 then
      Marshal.WriteByte(Dest, Byte($FF))
    else
      Marshal.WriteByte(Dest, Byte($00));
  end
  else begin
    Result := csSuccess;
    Marshal.WriteByte(Dest, Byte(Value));
  end;
end;

class function TDataConverters.InternalInt32ToInt16(Value: Integer; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  // Range check
  if (LongWord(Value) and $FFFF8000 <> $00000000) and (LongWord(Value) and $FFFF8000 <> $FFFF8000) then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else if LongWord(Value) and $80000000 = 0 then
      Marshal.WriteInt16(Dest, SmallInt($7FFF))
    else
      Marshal.WriteInt16(Dest, SmallInt($8000));
  end
  else begin
    Result := csSuccess;
    Marshal.WriteInt16(Dest, SmallInt(Value));
  end;
end;

class function TDataConverters.InternalInt32ToUInt16(Value: Integer; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  // Range check
  if LongWord(Value) and $FFFF0000 <> $00000000 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else if LongWord(Value) and $80000000 = 0 then
      Marshal.WriteInt16(Dest, SmallInt($FFFF))
    else
      Marshal.WriteInt16(Dest, SmallInt($0000));
  end
  else begin
    Result := csSuccess;
    Marshal.WriteInt16(Dest, SmallInt(Value));
  end;
end;

class function TDataConverters.InternalInt32ToUInt32(Value: Integer; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  // Range check
  if LongWord(Value) and $80000000 <> 0 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      Marshal.WriteInt32(Dest, Integer($00000000));
  end
  else begin
    Result := csSuccess;
    Marshal.WriteInt32(Dest, Value);
  end;
end;

class function TDataConverters.InternalInt64ToInt8(Value: Int64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  if (Value and $FFFFFFFFFFFFFF80 <> 0) and (Value and $FFFFFFFFFFFFFF80 <> $FFFFFFFFFFFFFF80) then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
  {$IFNDEF CLR}
    else if Int64Rec(Value).Hi and $80000000 = 0 then
  {$ELSE}
    else if Value and $8000000000000000 = 0 then
  {$ENDIF}
      Marshal.WriteByte(Dest, Byte($7F))
    else
      Marshal.WriteByte(Dest, Byte($80));
  end
  else begin
    Result := csSuccess;
  {$IFNDEF CLR}
    Marshal.WriteByte(Dest, Byte(Int64Rec(Value).Lo));
  {$ELSE}
    Marshal.WriteByte(Dest, Byte(Value));
  {$ENDIF}
  end;
end;

class function TDataConverters.InternalInt64ToUInt8(Value: Int64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
{$IFNDEF CLR}
  if (Int64Rec(Value).Hi <> $00000000) or (Int64Rec(Value).Lo and $FFFFFF00 <> $00000000) then begin
{$ELSE}
  if Value and $FFFFFFFFFFFFFF00 <> 0 then begin
{$ENDIF}
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
  {$IFNDEF CLR}
    else if Int64Rec(Value).Hi and $80000000 = 0 then
  {$ELSE}
    else if Value and $8000000000000000 = 0 then
  {$ENDIF}
      Marshal.WriteByte(Dest, Byte($FF))
    else
      Marshal.WriteByte(Dest, Byte($00));
  end
  else begin
    Result := csSuccess;
  {$IFNDEF CLR}
    Marshal.WriteByte(Dest, Byte(Int64Rec(Value).Lo));
  {$ELSE}
    Marshal.WriteByte(Dest, Byte(Value));
  {$ENDIF}
  end;
end;

class function TDataConverters.InternalInt64ToInt16(Value: Int64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  if (Value and $FFFFFFFFFFFF8000 <> 0) and (Value and $FFFFFFFFFFFF8000 <> $FFFFFFFFFFFF8000) then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
  {$IFNDEF CLR}
    else if Int64Rec(Value).Hi and $80000000 = 0 then
  {$ELSE}
    else if Value and $8000000000000000 = 0 then
  {$ENDIF}
      Marshal.WriteInt16(Dest, SmallInt($7FFF))
    else
      Marshal.WriteInt16(Dest, SmallInt($8000));
  end
  else begin
    Result := csSuccess;
  {$IFNDEF CLR}
    Marshal.WriteInt16(Dest, SmallInt(Int64Rec(Value).Lo));
  {$ELSE}
    Marshal.WriteInt16(Dest, SmallInt(Value));
  {$ENDIF}
  end;
end;

class function TDataConverters.InternalInt64ToUInt16(Value: Int64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
{$IFNDEF CLR}
  if (Int64Rec(Value).Hi <> $00000000) or (Int64Rec(Value).Lo and $FFFF0000 <> $00000000) then begin
{$ELSE}
  if Value and $FFFFFFFFFFFF0000 <> 0 then begin
{$ENDIF}
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
  {$IFNDEF CLR}
    else if Int64Rec(Value).Hi and $80000000 = 0 then
  {$ELSE}
    else if Value and $8000000000000000 = 0 then
  {$ENDIF}
      Marshal.WriteInt16(Dest, SmallInt($FFFF))
    else
      Marshal.WriteInt16(Dest, SmallInt($0000));
  end
  else begin
    Result := csSuccess;
  {$IFNDEF CLR}
    Marshal.WriteInt16(Dest, SmallInt(Int64Rec(Value).Lo));
  {$ELSE}
    Marshal.WriteInt16(Dest, SmallInt(Value));
  {$ENDIF}
  end;
end;

class function TDataConverters.InternalInt64ToInt32(Value: Int64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  if (Value and $FFFFFFFF80000000 <> 0) and (Value and $FFFFFFFF80000000 <> $FFFFFFFF80000000) then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
  {$IFNDEF CLR}
    else if Int64Rec(Value).Hi and $80000000 = 0 then
  {$ELSE}
    else if Value and $8000000000000000 = 0 then
  {$ENDIF}
      Marshal.WriteInt32(Dest, Integer($7FFFFFFF))
    else
      Marshal.WriteInt32(Dest, Integer($80000000));
  end
  else begin
    Result := csSuccess;
  {$IFNDEF CLR}
    Marshal.WriteInt32(Dest, Integer(Int64Rec(Value).Lo));
  {$ELSE}
    Marshal.WriteInt32(Dest, Integer(Value));
  {$ENDIF}
  end;
end;

class function TDataConverters.InternalInt64ToUInt32(Value: Int64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
{$IFNDEF CLR}
  if Int64Rec(Value).Hi <> $00000000 then begin
{$ELSE}
  if Value and $FFFFFFFF00000000 <> 0 then begin
{$ENDIF}
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
  {$IFNDEF CLR}
    else if Int64Rec(Value).Hi and $80000000 = 0 then
  {$ELSE}
    else if Value and $8000000000000000 = 0 then
  {$ENDIF}
      Marshal.WriteInt32(Dest, Integer($FFFFFFFF))
    else
      Marshal.WriteInt32(Dest, Integer($00000000));
  end
  else begin
    Result := csSuccess;
  {$IFNDEF CLR}
    Marshal.WriteInt32(Dest, Integer(Int64Rec(Value).Lo));
  {$ELSE}
    Marshal.WriteInt32(Dest, Integer(Value));
  {$ENDIF}
  end;
end;

{$IFDEF VER12P}
class function TDataConverters.InternalInt64ToUInt64(Value: Int64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
{$IFNDEF CLR}
  if Int64Rec(Value).Hi and $80000000 <> 0 then begin
{$ELSE}
  if Value and $8000000000000000 <> 0 then begin
{$ENDIF}
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit;
    Marshal.WriteInt64(Dest, 0);
  end
  else begin
    Marshal.WriteInt64(Dest, Value);
    Result := csSuccess;
  end;
end;

class function TDataConverters.InternalUInt64ToInt8(Value: UInt64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  if Value and UInt64($FFFFFFFFFFFFFF80) <> 0 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
  {$IFNDEF CLR}
    else if Int64Rec(Value).Hi and $80000000 = 0 then
  {$ELSE}
    else if Value and $8000000000000000 = 0 then
  {$ENDIF}
      Marshal.WriteByte(Dest, Byte($7F))
    else
      Marshal.WriteByte(Dest, Byte($00));
  end
  else begin
    Result := csSuccess;
  {$IFNDEF CLR}
    Marshal.WriteByte(Dest, Byte(Int64Rec(Value).Lo));
  {$ELSE}
    Marshal.WriteByte(Dest, Byte(Value));
  {$ENDIF}
  end;
end;

class function TDataConverters.InternalUInt64ToUInt8(Value: UInt64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
{$IFNDEF CLR}
  if (Int64Rec(Value).Hi <> $00000000) or (Int64Rec(Value).Lo and $FFFFFF00 <> $00000000) then begin
{$ELSE}
  if Value and UInt64($FFFFFFFFFFFFFF00) <> 0 then begin
{$ENDIF}
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
  {$IFNDEF CLR}
    else if Int64Rec(Value).Hi and $80000000 = 0 then
  {$ELSE}
    else if Value and $8000000000000000 = 0 then
  {$ENDIF}
      Marshal.WriteByte(Dest, Byte($FF))
    else
      Marshal.WriteByte(Dest, Byte($00));
  end
  else begin
    Result := csSuccess;
  {$IFNDEF CLR}
    Marshal.WriteByte(Dest, Byte(Int64Rec(Value).Lo));
  {$ELSE}
    Marshal.WriteByte(Dest, Byte(Value));
  {$ENDIF}
  end;
end;

class function TDataConverters.InternalUInt64ToInt16(Value: UInt64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  if Value and UInt64($FFFFFFFFFFFF8000) <> 0 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
  {$IFNDEF CLR}
    else if Int64Rec(Value).Hi and $80000000 = 0 then
  {$ELSE}
    else if Value and UInt64($8000000000000000) = 0 then
  {$ENDIF}
      Marshal.WriteInt16(Dest, SmallInt($7FFF))
    else
      Marshal.WriteInt16(Dest, SmallInt($0000));
  end
  else begin
    Result := csSuccess;
  {$IFNDEF CLR}
    Marshal.WriteInt16(Dest, SmallInt(Int64Rec(Value).Lo));
  {$ELSE}
    Marshal.WriteInt16(Dest, SmallInt(Value));
  {$ENDIF}
  end;
end;

class function TDataConverters.InternalUInt64ToUInt16(Value: UInt64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
{$IFNDEF CLR}
  if (Int64Rec(Value).Hi <> $00000000) or (Int64Rec(Value).Lo and $FFFF0000 <> $00000000) then begin
{$ELSE}
  if Value and UInt64($FFFFFFFFFFFF0000) <> 0 then begin
{$ENDIF}
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
  {$IFNDEF CLR}
    else if Int64Rec(Value).Hi and $80000000 = 0 then
  {$ELSE}
    else if Value and UInt64($8000000000000000) = 0 then
  {$ENDIF}
      Marshal.WriteInt16(Dest, SmallInt($FFFF))
    else
      Marshal.WriteInt16(Dest, SmallInt($0000));
  end
  else begin
    Result := csSuccess;
  {$IFNDEF CLR}
    Marshal.WriteInt16(Dest, SmallInt(Int64Rec(Value).Lo));
  {$ELSE}
    Marshal.WriteInt16(Dest, SmallInt(Value));
  {$ENDIF}
  end;
end;

class function TDataConverters.InternalUInt64ToInt32(Value: UInt64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  if Value and UInt64($FFFFFFFF80000000) <> 0 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
  {$IFNDEF CLR}
    else if Int64Rec(Value).Hi and $80000000 = 0 then
  {$ELSE}
    else if Value and UInt64($8000000000000000) = 0 then
  {$ENDIF}
      Marshal.WriteInt32(Dest, Integer($7FFFFFFF))
    else
      Marshal.WriteInt32(Dest, Integer($00000000));
  end
  else begin
    Result := csSuccess;
  {$IFNDEF CLR}
    Marshal.WriteInt32(Dest, Integer(Int64Rec(Value).Lo));
  {$ELSE}
    Marshal.WriteInt32(Dest, Integer(Value));
  {$ENDIF}
  end;
end;

class function TDataConverters.InternalUInt64ToUInt32(Value: UInt64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
{$IFNDEF CLR}
  if Int64Rec(Value).Hi <> $00000000 then begin
{$ELSE}
  if Value and UInt64($FFFFFFFF00000000) <> 0 then begin
{$ENDIF}
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
  {$IFNDEF CLR}
    else if Int64Rec(Value).Hi and $80000000 = 0 then
  {$ELSE}
    else if Value and UInt64($8000000000000000) = 0 then
  {$ENDIF}
      Marshal.WriteInt32(Dest, Integer($FFFFFFFF))
    else
      Marshal.WriteInt32(Dest, Integer($00000000));
  end
  else begin
    Result := csSuccess;
  {$IFNDEF CLR}
    Marshal.WriteInt32(Dest, Integer(Int64Rec(Value).Lo));
  {$ELSE}
    Marshal.WriteInt32(Dest, Integer(Value));
  {$ENDIF}
  end;
end;

class function TDataConverters.InternalUInt64ToInt64(Value: UInt64; Dest: IntPtr; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
{$IFNDEF CLR}
  if Int64Rec(Value).Hi and $80000000 <> 0 then begin
{$ELSE}
  if Value and $8000000000000000 <> 0 then begin
{$ENDIF}
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit;
    Marshal.WriteInt64(Dest, 0);
  end
  else begin
    Marshal.WriteInt64(Dest, Int64(Value));
    Result := csSuccess;
  end;
end;
{$ENDIF}

class function TDataConverters.InternalSingleToInt64(Source: IntPtr; out Value: Int64): TConvertStatus;
var
  s: Single;
begin
  s := CRBitConverter.Int32BitsToSingle(Marshal.ReadInt32(Source));

  if (s > Int64($7FFFFFFFFFFFFFFF)) or (s < Int64($8000000000000000)) then begin
    Result := csValueOutOfRange;
    Value := 0;
  end
  else begin
    if {$IFNDEF CLR}System.{$ENDIF}Frac(s) <> 0 then
      Result := csFractionTruncated
    else
      Result := csSuccess;

    Value := Trunc(s);
  end;
end;

{$IFDEF VER12P}
class function TDataConverters.InternalSingleToUInt64(Source: IntPtr; out Value: UInt64): TConvertStatus;
var
  s: Single;
  ui64: UInt64;
begin
  s := CRBitConverter.Int32BitsToSingle(Marshal.ReadInt32(Source));

  ui64 := UInt64($FFFFFFFFFFFFFFFF);
  if (s > ui64) or (s < 0) then begin
    Result := csValueOutOfRange;
    Value := 0;
  end
  else begin
    if {$IFNDEF CLR}System.{$ENDIF}Frac(s) <> 0 then
      Result := csFractionTruncated
    else
      Result := csSuccess;

    Value := Trunc(s);
  end;
end;
{$ENDIF}

class function TDataConverters.InternalFloatToInt64(Source: IntPtr; out Value: Int64): TConvertStatus;
var
  d: Double;
begin
  d := BitConverter.Int64BitsToDouble(Marshal.ReadInt64(Source));

  if (d > Int64($7FFFFFFFFFFFFFFF)) or (d < Int64($8000000000000000)) then begin
    Result := csValueOutOfRange;
    Value := 0;
  end
  else begin
    if {$IFNDEF CLR}System.{$ENDIF}Frac(d) <> 0 then
      Result := csFractionTruncated
    else
      Result := csSuccess;

    Value := Trunc(d);
  end;
end;

{$IFDEF VER12P}
class function TDataConverters.InternalFloatToUInt64(Source: IntPtr; out Value: UInt64): TConvertStatus;
var
  d: Double;
  ui64: UInt64;
begin
  d := BitConverter.Int64BitsToDouble(Marshal.ReadInt64(Source));

  ui64 := UInt64($FFFFFFFFFFFFFFFF);
  if (d > ui64) or (d < 0) then begin
    Result := csValueOutOfRange;
    Value := 0;
  end
  else begin
    if {$IFNDEF CLR}System.{$ENDIF}Frac(d) <> 0 then
      Result := csFractionTruncated
    else
      Result := csSuccess;

    Value := Trunc(d);
  end;
end;
{$ENDIF}

class function TDataConverters.InternalExtendedToInt64(Source: IntPtr; out Value: Int64): TConvertStatus;
var
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
begin
{$IFDEF CLR}
  e := BitConverter.Int64BitsToDouble(Marshal.ReadInt64(Source));
{$ELSE}
  e := Extended(Source^);
{$ENDIF}

  if (e > Int64($7FFFFFFFFFFFFFFF)) or (e < Int64($8000000000000000)) then begin
    Result := csValueOutOfRange;
    Value := 0;
  end
  else begin
    if {$IFNDEF CLR}System.{$ENDIF}Frac(e) <> 0 then
      Result := csFractionTruncated
    else
      Result := csSuccess;

    Value := Trunc(e);
  end;
end;

{$IFDEF VER12P}
class function TDataConverters.InternalExtendedToUInt64(Source: IntPtr; out Value: UInt64): TConvertStatus;
var
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
  ui64: Uint64;
begin
{$IFDEF CLR}
  e := BitConverter.Int64BitsToDouble(Marshal.ReadInt64(Source));
{$ELSE}
  e := Extended(Source^);
{$ENDIF}

  ui64 := UInt64($FFFFFFFFFFFFFFFF);
  if (e > ui64) or (e < 0) then begin
    Result := csValueOutOfRange;
    Value := 0;
  end
  else begin
    if {$IFNDEF CLR}System.{$ENDIF}Frac(e) <> 0 then
      Result := csFractionTruncated
    else
      Result := csSuccess;

    Value := Trunc(e);
  end;
end;
{$ENDIF}

class function TDataConverters.InternalBCDToInt64(Source: IntPtr; out Value: Int64): TConvertStatus;
begin
  Value := Marshal.ReadInt64(Source);

  // Cast check
  if Value mod 10000 <> 0 then
    Result := csFractionTruncated
  else
    Result := csSuccess;

  Value := Value div 10000;
end;

{$IFDEF VER12P}
class function TDataConverters.InternalBCDToUInt64(Source: IntPtr; out Value: UInt64): TConvertStatus;
begin
  Value := UInt64(Marshal.ReadInt64(Source));

  // Cast check
  if Value mod 10000 <> 0 then
    Result := csFractionTruncated
  else
    Result := csSuccess;

  Value := Value div 10000;
end;
{$ENDIF}

class function TDataConverters.InternalExtendedToBCD(e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF}; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  c_frac: Currency;
  i64: Int64;
  r: TConvertStatus;
begin
  if e < -922337203685477 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      e := -922337203685477;
  end
  else if e > 922337203685477 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      e := 922337203685477;
  end
  else
    Result := csSuccess;

  c_frac := {$IFNDEF CLR}System.{$ENDIF}Frac(e) * 10000;
  if {$IFNDEF CLR}System.{$ENDIF}Frac(c_frac) <> 0 then begin
    Result := csFractionTruncated;
    if not IgnoreConvertErrors then
      Exit;
  end;
  {$Q-} // Bug in Delphi on Overflow checking when i64 <= -922337203685477
  i64 := Trunc(e) * Int64(10000) + Trunc(c_frac);

  r := WriteInt64AsBCD(i64, Dest, DestLen, DestScale, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.WriteInt64AsBCD(i64: Int64; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := csSuccess;
  if (DestLen > 0) or (DestScale > 0) then
    if (DestScale >= 0) and (DestScale < 4) and (i64 mod DecValue[DestScale] > 0) then begin
      Result := csInvalidValueScale;
      if not IgnoreConvertErrors then
        Exit
      else
        i64 := (i64 div DecValue[DestScale]) * DecValue[DestScale];
    end;

  Marshal.WriteInt64(Dest, i64);
end;

{$IFDEF VER12P}
class function TDataConverters.WriteUInt64AsBCD(ui64: UInt64; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := csSuccess;
  if (DestLen > 0) or (DestScale > 0) then
    if (DestScale >= 0) and (DestScale < 4) and (ui64 mod DecValue[DestScale] > 0) then begin
      Result := csInvalidValueScale;
      if not IgnoreConvertErrors then
        Exit
      else
        ui64 := (ui64 div DecValue[DestScale]) * DecValue[DestScale];
    end;

  Marshal.WriteInt64(Dest, Int64(ui64));
end;
{$ENDIF}

{$IFDEF VER6P}{$IFNDEF FPC}

class function TDataConverters.InternalFMTBCDToInt64(Source: IntPtr; out Value: Int64): TConvertStatus;
var
  bcd, ibcd: TBcd;
begin
  InternalReadFMTBCD(Source, bcd);

  // Cast check
  if not IsBcdInt(bcd) then
    Result := csFractionTruncated
  else
    Result := csSuccess;

  NormalizeBcd(bcd, ibcd, bcd.Precision, 0);
  Value := StrToInt64(BcdToStr(ibcd));
end;

{$IFDEF VER12P}
class function TDataConverters.InternalFMTBCDToUInt64(Source: IntPtr; out Value: UInt64): TConvertStatus;
var
  bcd, ibcd: TBcd;
begin
  InternalReadFMTBCD(Source, bcd);

  // Cast check
  if not IsBcdInt(bcd) then
    Result := csFractionTruncated
  else
    Result := csSuccess;

  NormalizeBcd(bcd, ibcd, bcd.Precision, 0);
  Value := StrToUInt64(BcdToStr(ibcd));
end;
{$ENDIF}

class procedure TDataConverters.InternalReadFMTBCD(Source: IntPtr; out Value: TBcd);
{$IFDEF CLR}
var
  Data: TBytes;
{$ENDIF}
begin
{$IFDEF CLR}
  SetLength(Data, SizeOfTBcd);
  Marshal.Copy(Source, Data, 0, SizeOfTBcd);
  Value := TBcd.FromBytes(Data);
{$ELSE}
  Value := PBcd(Source)^;
{$ENDIF}
end;

class function TDataConverters.InternalBCDToFMTBCD(Bcd: TBcd; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Precision, Scale: Integer;
{$IFDEF CLR}
  Data: TBytes;
{$ENDIF}
begin
  Result := csSuccess;
  if (DestLen > 0) or (DestScale > 0) then begin
    Precision := GetBcdPrecision(Bcd);
    Scale := GetBcdScale(Bcd);

    if (DestScale >= 0) and (Scale > DestScale) then begin
      Result := csInvalidValueScale;
      if not IgnoreConvertErrors then
        Exit
      else begin
        NormalizeBcd(bcd, bcd, Precision - Scale + DestScale, DestScale);
        Precision := GetBcdPrecision(Bcd);
      end;
    end;

    if (DestLen >= 0) and (Precision > DestLen) then begin
      Result := csValueOutOfRange;
      if not IgnoreConvertErrors then
        Exit
      else if IsBcdNegative(Bcd)then
        Bcd := StrToBcd('-' + StringOfChar('9', DestLen - DestScale) + {$IFDEF VER16P}FormatSettings.{$ENDIF}DecimalSeparator + StringOfChar('9', DestScale))
      else
        Bcd := StrToBcd(StringOfChar('9', DestLen - DestScale) + {$IFDEF VER16P}FormatSettings.{$ENDIF}DecimalSeparator + StringOfChar('9', DestScale));
    end;
  end;

{$IFDEF CLR}
  Data := TBcd.ToBytes(Bcd);
  Marshal.Copy(Data, 0, Dest, SizeOfTBcd);
{$ELSE}
  PBcd(Dest)^ := Bcd;
{$ENDIF}
end;

class procedure TDataConverters.InternalTimeStampToSQLTimeStamp(const TS: TTimeStamp; Dest: IntPtr);
{$IFDEF CLR}
var
  SQLTimeStamp: TSQLTimeStamp;
  Data: TBytes;
{$ENDIF}
begin
{$IFNDEF CLR}
  PSQLTimeStamp(Dest)^ := SqlTimSt.DateTimeToSQLTimeStamp(TimeStampToDateTime(TS));
{$ELSE}
  SQLTimeStamp := SqlTimSt.DateTimeToSQLTimeStamp(TimeStampToDateTime(TS));
  Data := TSQLTimeStamp.ToBytes(SQLTimeStamp);
  Marshal.Copy(Data, 0, Dest, SizeOf(TSQLTimeStamp));
{$ENDIF}
end;

class procedure TDataConverters.InternalSQLTimeStampToTimeStamp(Source: IntPtr; out Value: TTimeStamp);
{$IFDEF CLR}
var
  SQLTimeStamp: TSQLTimeStamp;
  Data: TBytes;
{$ENDIF}
begin
{$IFDEF CLR}
  SetLength(Data, SizeOf(TSQLTimeStamp));
  Marshal.Copy(Source, Data, 0, SizeOf(TSQLTimeStamp));
  SQLTimeStamp := TSQLTimeStamp.FromBytes(Data);
  Value := DateTimeToTimeStamp(SqlTimSt.SQLTimeStampToDateTime(SQLTimeStamp));
{$ELSE}
  Value := DateTimeToTimeStamp(SqlTimSt.SQLTimeStampToDateTime(PSQLTimeStamp(Source)^));
{$ENDIF}
end;

{$ENDIF}{$ENDIF}

class function TDataConverters.CopyByte(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteByte(Dest, Marshal.ReadByte(Source));
  Result := csSuccess;
end;

class function TDataConverters.CopyInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt16(Dest, Marshal.ReadInt16(Source));
  Result := csSuccess;
end;

class function TDataConverters.CopyInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt32(Dest, Marshal.ReadInt32(Source));
  Result := csSuccess;
end;

class function TDataConverters.CopyInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt64(Dest, Marshal.ReadInt64(Source));
  Result := csSuccess;
end;

class function TDataConverters.CopyPtr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteIntPtr(Dest, Marshal.ReadIntPtr(Source));
  Result := csSuccess;
end;

class function TDataConverters.Int8ToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  b: byte;
begin
  b := Marshal.ReadByte(Source);

  if b and $80 <> 0 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      Marshal.WriteByte(Dest, Byte($00));
  end
  else begin
    Result := csSuccess;
    Marshal.WriteByte(Dest, b);
  end;
end;

class function TDataConverters.Int8ToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt16(Dest, ShortInt(Marshal.ReadByte(Source)));
  Result := csSuccess;
end;

class function TDataConverters.Int8ToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  b: byte;
begin
  b := Marshal.ReadByte(Source);

  if b and $80 <> 0 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      Marshal.WriteInt16(Dest, SmallInt($00));
  end
  else begin
    Result := csSuccess;
    Marshal.WriteInt16(Dest, SmallInt(b));
  end;
end;

class function TDataConverters.Int8ToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt32(Dest, ShortInt(Marshal.ReadByte(Source)));
  Result := csSuccess;
end;

class function TDataConverters.Int8ToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  b: byte;
begin
  b := Marshal.ReadByte(Source);

  if b and $80 <> 0 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      Marshal.WriteInt32(Dest, Integer($00));
  end
  else begin
    Result := csSuccess;
    Marshal.WriteInt32(Dest, Integer(b));
  end;
end;

class function TDataConverters.Int8ToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt64(Dest, ShortInt(Marshal.ReadByte(Source)));
  Result := csSuccess;
end;

{$IFDEF VER12P}
class function TDataConverters.Int8ToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  b: byte;
begin
  b := Marshal.ReadByte(Source);

  if b and $80 <> 0 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      Marshal.WriteInt64(Dest, Integer($00));
  end
  else begin
    Result := csSuccess;
    Marshal.WriteInt64(Dest, Int64(b));
  end;
end;
{$ENDIF}

class function TDataConverters.Int8ToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  s: Single;
begin
  s := ShortInt(Marshal.ReadByte(Source));
  Marshal.WriteInt32(Dest, CRBitConverter.SingleToInt32Bits(s));
  Result := csSuccess;
end;

class function TDataConverters.Int8ToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  d: Double;
begin
  d := ShortInt(Marshal.ReadByte(Source));
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(d));
  Result := csSuccess;
end;

class function TDataConverters.Int8ToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
begin
  e := ShortInt(Marshal.ReadByte(Source));
{$IFDEF CLR}
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(e));
{$ELSE}
  Extended(Dest^) := e;
{$ENDIF}
  Result := csSuccess;
end;

class function TDataConverters.Int8ToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i: integer;
begin
  i := ShortInt(Marshal.ReadByte(Source)) * 10000;
  Result := WriteInt64AsBCD(i, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.Int8ToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i: integer;
  bcd: TBcd;
begin
  i := ShortInt(Marshal.ReadByte(Source));
  bcd := StrToBcd(IntToStr(i));
  Result := InternalBCDToFMTBCD(bcd, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.Int8ToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  if Marshal.ReadByte(Source) = 0 then
    Marshal.WriteInt16(Dest, 0)
  else
    Marshal.WriteInt16(Dest, SmallInt(WordBool(True)));
  Result := csSuccess;
end;

class function TDataConverters.Int8ToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalInt8ToStr(Source, Str, DestLen);
  r := InternalWriteAStr(AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.Int8ToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalInt8ToStr(Source, Str, DestLen);
  r := InternalWriteWStr(WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.Int8ToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalInt8ToStr(Source, Str, DestLen);
  r := InternalWriteExtAStr(StringHeap, AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.Int8ToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalInt8ToStr(Source, Str, DestLen);
  r := InternalWriteExtWStr(StringHeap, WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.Int8ToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToBytes(Source, SizeOf(Shortint), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.Int8ToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToVarBytes(Source, SizeOf(Shortint), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.Int8ToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToExtVarBytes(StringHeap, Source, SizeOf(Shortint), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.Int8ToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  InternalCopyToBlob(Source, SizeOf(Shortint), Dest);
  Result := csSuccess;
end;

class function TDataConverters.UInt8ToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  b: byte;
begin
  b := Marshal.ReadByte(Source);

  if b and $80 <> 0 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      Marshal.WriteByte(Dest, Byte($7F));
  end
  else begin
    Result := csSuccess;
    Marshal.WriteByte(Dest, b);
  end;
end;

class function TDataConverters.UInt8ToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt16(Dest, SmallInt(Marshal.ReadByte(Source)));
  Result := csSuccess;
end;

class function TDataConverters.UInt8ToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt16(Dest, SmallInt(Marshal.ReadByte(Source)));
  Result := csSuccess;
end;

class function TDataConverters.UInt8ToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt32(Dest, Marshal.ReadByte(Source));
  Result := csSuccess;
end;

class function TDataConverters.UInt8ToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt32(Dest, Marshal.ReadByte(Source));
  Result := csSuccess;
end;

class function TDataConverters.UInt8ToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt64(Dest, Marshal.ReadByte(Source));
  Result := csSuccess;
end;

{$IFDEF VER12P}
class function TDataConverters.UInt8ToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt64(Dest, Marshal.ReadByte(Source));
  Result := csSuccess;
end;
{$ENDIF}

class function TDataConverters.UInt8ToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  s: Single;
begin
  s := Marshal.ReadByte(Source);
  Marshal.WriteInt32(Dest, CRBitConverter.SingleToInt32Bits(s));
  Result := csSuccess;
end;

class function TDataConverters.UInt8ToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  d: Double;
begin
  d := Marshal.ReadByte(Source);
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(d));
  Result := csSuccess;
end;

class function TDataConverters.UInt8ToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
begin
  e := Byte(Marshal.ReadByte(Source));
{$IFDEF CLR}
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(e));
{$ELSE}
  Extended(Dest^) := e;
{$ENDIF}
  Result := csSuccess;
end;

class function TDataConverters.UInt8ToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  lw: LongWord;
begin
  lw := LongWord(Marshal.ReadByte(Source)) * 10000;
  Result := WriteInt64AsBCD(lw, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.UInt8ToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i: integer;
  bcd: TBcd;
begin
  i := Marshal.ReadByte(Source);
  bcd := StrToBcd(IntToStr(i));
  Result := InternalBCDToFMTBCD(bcd, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.UInt8ToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  if Marshal.ReadByte(Source) = 0 then
    Marshal.WriteInt16(Dest, 0)
  else
    Marshal.WriteInt16(Dest, SmallInt(WordBool(True)));
  Result := csSuccess;
end;

class function TDataConverters.UInt8ToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalUInt8ToStr(Source, Str, DestLen);
  r := InternalWriteAStr(AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.UInt8ToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalUInt8ToStr(Source, Str, DestLen);
  r := InternalWriteWStr(WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.UInt8ToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalUInt8ToStr(Source, Str, DestLen);
  r := InternalWriteExtAStr(StringHeap, AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.UInt8ToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalUInt8ToStr(Source, Str, DestLen);
  r := InternalWriteExtWStr(StringHeap, WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.UInt8ToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToBytes(Source, SizeOf(Byte), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.UInt8ToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToVarBytes(Source, SizeOf(Byte), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.UInt8ToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToExtVarBytes(StringHeap, Source, SizeOf(Byte), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.UInt8ToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  InternalCopyToBlob(Source, SizeOf(Byte), Dest);
  Result := csSuccess;
end;

class function TDataConverters.Int16ToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  w: Word;
begin
  w := Word(Marshal.ReadInt16(Source));

  if (w and $FF80 <> $0000) and (w and $FF80 <> $FF80) then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else if w and $8000 = 0 then
      Marshal.WriteByte(Dest, Byte($7F))
    else
      Marshal.WriteByte(Dest, Byte($80));
  end
  else begin
    Result := csSuccess;
    Marshal.WriteByte(Dest, Byte(w));
  end;
end;

class function TDataConverters.Int16ToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  w: Word;
begin
  w := Word(Marshal.ReadInt16(Source));

  if w and $FF00 <> $0000 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else if w and $8000 = 0 then
      Marshal.WriteByte(Dest, Byte($FF))
    else
      Marshal.WriteByte(Dest, Byte($00));
  end
  else begin
    Result := csSuccess;
    Marshal.WriteByte(Dest, Byte(w));
  end;
end;

class function TDataConverters.Int16ToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  w: Word;
begin
  w := Word(Marshal.ReadInt16(Source));

  if w and $8000 <> 0 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      Marshal.WriteInt16(Dest, $00);
  end
  else begin
    Result := csSuccess;
    Marshal.WriteInt16(Dest, SmallInt(w));
  end;
end;

class function TDataConverters.Int16ToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt32(Dest, Marshal.ReadInt16(Source));
  Result := csSuccess;
end;

class function TDataConverters.Int16ToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  w: Word;
begin
  w := Word(Marshal.ReadInt16(Source));

  if w and $8000 <> 0 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      Marshal.WriteInt32(Dest, $00);
  end
  else begin
    Result := csSuccess;
    Marshal.WriteInt32(Dest, Word(Marshal.ReadInt16(Source)));
  end;
end;

class function TDataConverters.Int16ToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt64(Dest, Marshal.ReadInt16(Source));
  Result := csSuccess;
end;

{$IFDEF VER12P}
class function TDataConverters.Int16ToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  w: Word;
begin
  w := Word(Marshal.ReadInt16(Source));

  if w and $8000 <> 0 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      Marshal.WriteInt64(Dest, $00);
  end
  else begin
    Result := csSuccess;
    Marshal.WriteInt64(Dest, Word(Marshal.ReadInt16(Source)));
  end;
end;
{$ENDIF}

class function TDataConverters.Int16ToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  s: Single;
begin
  s := Marshal.ReadInt16(Source);
  Marshal.WriteInt32(Dest, CRBitConverter.SingleToInt32Bits(s));
  Result := csSuccess;
end;

class function TDataConverters.Int16ToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  d: Double;
begin
  d := Marshal.ReadInt16(Source);
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(d));
  Result := csSuccess;
end;

class function TDataConverters.Int16ToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
begin
  e := SmallInt(Marshal.ReadInt16(Source));
{$IFDEF CLR}
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(e));
{$ELSE}
  Extended(Dest^) := e;
{$ENDIF}
  Result := csSuccess;
end;

class function TDataConverters.Int16ToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i: Integer;
begin
  i := Integer(Marshal.ReadInt16(Source)) * 10000;
  Result := WriteInt64AsBCD(i, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.Int16ToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i: Integer;
  bcd: TBcd;
begin
  i := Marshal.ReadInt16(Source);
  bcd := StrToBcd(IntToStr(i));
  Result := InternalBCDToFMTBCD(bcd, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.Int16ToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  if Marshal.ReadInt16(Source) = 0 then
    Marshal.WriteInt16(Dest, 0)
  else
    Marshal.WriteInt16(Dest, SmallInt(WordBool(True)));
  Result := csSuccess;
end;

class function TDataConverters.Int16ToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalInt16ToStr(Source, Str, DestLen);
  r := InternalWriteAStr(AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.Int16ToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalInt16ToStr(Source, Str, DestLen);
  r := InternalWriteWStr(WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.Int16ToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalInt16ToStr(Source, Str, DestLen);
  r := InternalWriteExtAStr(StringHeap, AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.Int16ToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalInt16ToStr(Source, Str, DestLen);
  r := InternalWriteExtWStr(StringHeap, WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.Int16ToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToBytes(Source, SizeOf(Smallint), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.Int16ToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToVarBytes(Source, SizeOf(Smallint), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.Int16ToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToExtVarBytes(StringHeap, Source, SizeOf(Smallint), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.Int16ToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  InternalCopyToBlob(Source, SizeOf(Smallint), Dest);
  Result := csSuccess;
end;

class function TDataConverters.UInt16ToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  w: Word;
begin
  w := Word(Marshal.ReadInt16(Source));

  if w and $FF80 <> $0000 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      Marshal.WriteByte(Dest, Byte($7F));
  end
  else begin
    Result := csSuccess;
    Marshal.WriteByte(Dest, Byte(w));
  end;
end;

class function TDataConverters.UInt16ToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  w: Word;
begin
  w := Word(Marshal.ReadInt16(Source));

  if w and $FF00 <> $0000 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      Marshal.WriteByte(Dest, Byte($FF));
  end
  else begin
    Result := csSuccess;
    Marshal.WriteByte(Dest, Byte(w));
  end;
end;

class function TDataConverters.UInt16ToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  w: Word;
begin
  w := Word(Marshal.ReadInt16(Source));

  if w and $8000 <> 0 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      Marshal.WriteInt16(Dest, SmallInt($7FFF));
  end
  else begin
    Result := csSuccess;
    Marshal.WriteInt16(Dest, SmallInt(w));
  end;
end;

class function TDataConverters.UInt16ToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt32(Dest, Word(Marshal.ReadInt16(Source)));
  Result := csSuccess;
end;

class function TDataConverters.UInt16ToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt32(Dest, Word(Marshal.ReadInt16(Source)));
  Result := csSuccess;
end;

class function TDataConverters.UInt16ToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt64(Dest, Word(Marshal.ReadInt16(Source)));
  Result := csSuccess;
end;

{$IFDEF VER12P}
class function TDataConverters.UInt16ToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt64(Dest, Word(Marshal.ReadInt16(Source)));
  Result := csSuccess;
end;
{$ENDIF}

class function TDataConverters.UInt16ToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  s: Single;
begin
  s := Word(Marshal.ReadInt16(Source));
  Marshal.WriteInt32(Dest, CRBitConverter.SingleToInt32Bits(s));
  Result := csSuccess;
end;

class function TDataConverters.UInt16ToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  d: Double;
begin
  d := Word(Marshal.ReadInt16(Source));
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(d));
  Result := csSuccess;
end;

class function TDataConverters.UInt16ToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
begin
  e := Word(Marshal.ReadInt16(Source));
{$IFDEF CLR}
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(e));
{$ELSE}
  Extended(Dest^) := e;
{$ENDIF}
  Result := csSuccess;
end;

class function TDataConverters.UInt16ToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  lw: LongWord;
begin
  lw := LongWord(Word(Marshal.ReadInt16(Source))) * 10000;
  Result := WriteInt64AsBCD(lw, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.UInt16ToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i: Integer;
  bcd: TBcd;
begin
  i := Word(Marshal.ReadInt16(Source));
  bcd := StrToBcd(IntToStr(i));
  Result := InternalBCDToFMTBCD(bcd, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.UInt16ToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  if Marshal.ReadInt16(Source) = 0 then
    Marshal.WriteInt16(Dest, 0)
  else
    Marshal.WriteInt16(Dest, SmallInt(WordBool(True)));
  Result := csSuccess;
end;

class function TDataConverters.UInt16ToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalUInt16ToStr(Source, Str, DestLen);
  r := InternalWriteAStr(AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.UInt16ToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalUInt16ToStr(Source, Str, DestLen);
  r := InternalWriteWStr(WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.UInt16ToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalUInt16ToStr(Source, Str, DestLen);
  r := InternalWriteExtAStr(StringHeap, AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.UInt16ToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalUInt16ToStr(Source, Str, DestLen);
  r := InternalWriteExtWStr(StringHeap, WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.UInt16ToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToBytes(Source, SizeOf(Word), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.UInt16ToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToVarBytes(Source, SizeOf(Word), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.UInt16ToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToExtVarBytes(StringHeap, Source, SizeOf(Word), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.UInt16ToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  InternalCopyToBlob(Source, SizeOf(Word), Dest);
  Result := csSuccess;
end;

class function TDataConverters.Int32ToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalInt32ToInt8(Marshal.ReadInt32(Source), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.Int32ToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalInt32ToUInt8(Marshal.ReadInt32(Source), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.Int32ToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalInt32ToInt16(Marshal.ReadInt32(Source), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.Int32ToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalInt32ToUInt16(Marshal.ReadInt32(Source), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.Int32ToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalInt32ToUInt32(Marshal.ReadInt32(Source), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.Int32ToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt64(Dest, Marshal.ReadInt32(Source));
  Result := csSuccess;
end;

{$IFDEF VER12P}
class function TDataConverters.Int32ToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalInt64ToUInt64(Marshal.ReadInt64(Source), Dest, IgnoreConvertErrors);
end;
{$ENDIF}

class function TDataConverters.Int32ToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  s: Single;
begin
  s := Marshal.ReadInt32(Source);
  Marshal.WriteInt32(Dest, CRBitConverter.SingleToInt32Bits(s));
  Result := csSuccess;
end;

class function TDataConverters.Int32ToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  d: Double;
begin
  d := Marshal.ReadInt32(Source);
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(d));
  Result := csSuccess;
end;

class function TDataConverters.Int32ToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
begin
  e := Integer(Marshal.ReadInt32(Source));
{$IFDEF CLR}
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(e));
{$ELSE}
  Extended(Dest^) := e;
{$ENDIF}
  Result := csSuccess;
end;

class function TDataConverters.Int32ToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
begin
  i64 := Int64(Marshal.ReadInt32(Source)) * 10000;
  Result := WriteInt64AsBCD(i64, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.Int32ToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i: Integer;
  bcd: TBcd;
begin
  i := Marshal.ReadInt32(Source);
  bcd := StrToBcd(IntToStr(i));
  Result := InternalBCDToFMTBCD(bcd, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.Int32ToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  if Marshal.ReadInt32(Source) = 0 then
    Marshal.WriteInt16(Dest, 0)
  else
    Marshal.WriteInt16(Dest, SmallInt(WordBool(True)));
  Result := csSuccess;
end;

class function TDataConverters.Int32ToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalInt32ToStr(Source, Str, DestLen);
  r := InternalWriteAStr(AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.Int32ToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalInt32ToStr(Source, Str, DestLen);
  r := InternalWriteWStr(WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.Int32ToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalInt32ToStr(Source, Str, DestLen);
  r := InternalWriteExtAStr(StringHeap, AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.Int32ToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalInt32ToStr(Source, Str, DestLen);
  r := InternalWriteExtWStr(StringHeap, WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.Int32ToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToBytes(Source, SizeOf(Integer), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.Int32ToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToVarBytes(Source, SizeOf(Integer), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.Int32ToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToExtVarBytes(StringHeap, Source, SizeOf(Integer), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.Int32ToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  InternalCopyToBlob(Source, SizeOf(Integer), Dest);
  Result := csSuccess;
end;

class function TDataConverters.UInt32ToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  lw: LongWord;
begin
  lw := LongWord(Marshal.ReadInt32(Source));

  if lw and $FFFFFF80 <> $00000000 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      Marshal.WriteByte(Dest, Byte($7F));
  end
  else begin
    Result := csSuccess;
    Marshal.WriteByte(Dest, Byte(lw));
  end;
end;

class function TDataConverters.UInt32ToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  lw: LongWord;
begin
  lw := LongWord(Marshal.ReadInt32(Source));

  if lw and $FFFFFF00 <> $00000000 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      Marshal.WriteByte(Dest, Byte($FF));
  end
  else begin
    Result := csSuccess;
    Marshal.WriteByte(Dest, Byte(lw));
  end;
end;

class function TDataConverters.UInt32ToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  lw: LongWord;
begin
  lw := LongWord(Marshal.ReadInt32(Source));

  if lw and $FFFF8000 <> $00000000 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      Marshal.WriteInt16(Dest, SmallInt($7FFF));
  end
  else begin
    Result := csSuccess;
    Marshal.WriteInt16(Dest, SmallInt(Word(lw)));
  end;
end;

class function TDataConverters.UInt32ToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  lw: LongWord;
begin
  lw := LongWord(Marshal.ReadInt32(Source));

  if lw and $FFFF0000 <> $00000000 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      Marshal.WriteInt16(Dest, SmallInt($FFFF));
  end
  else begin
    Result := csSuccess;
    Marshal.WriteInt16(Dest, SmallInt(Word(lw)));
  end;
end;

class function TDataConverters.UInt32ToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  lw: LongWord;
begin
  lw := LongWord(Marshal.ReadInt32(Source));

  if lw and $80000000 <> 0 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      Marshal.WriteInt32(Dest, Integer($7FFFFFFF));
  end
  else begin
    Result := csSuccess;
    Marshal.WriteInt32(Dest, Integer(lw));
  end;
end;

class function TDataConverters.UInt32ToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt64(Dest, LongWord(Marshal.ReadInt32(Source)));
  Result := csSuccess;
end;

{$IFDEF VER12P}
class function TDataConverters.UInt32ToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt64(Dest, LongWord(Marshal.ReadInt64(Source)));
  Result := csSuccess;
end;
{$ENDIF}

class function TDataConverters.UInt32ToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  s: Single;
begin
  s := LongWord(Marshal.ReadInt32(Source));
  Marshal.WriteInt32(Dest, CRBitConverter.SingleToInt32Bits(s));
  Result := csSuccess;
end;

class function TDataConverters.UInt32ToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  d: Double;
begin
  d := LongWord(Marshal.ReadInt32(Source));
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(d));
  Result := csSuccess;
end;

class function TDataConverters.UInt32ToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
begin
  e := LongWord(Marshal.ReadInt32(Source));
{$IFDEF CLR}
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(e));
{$ELSE}
  Extended(Dest^) := e;
{$ENDIF}
  Result := csSuccess;
end;

class function TDataConverters.UInt32ToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
begin
  i64 := Int64(LongWord(Marshal.ReadInt32(Source))) * 10000;
  Result := WriteInt64AsBCD(i64, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.UInt32ToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  bcd: TBcd;
begin
  i64 := LongWord(Marshal.ReadInt32(Source));
  bcd := StrToBcd(IntToStr(i64));
  Result := InternalBCDToFMTBCD(bcd, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.UInt32ToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  if Marshal.ReadInt32(Source) = 0 then
    Marshal.WriteInt16(Dest, 0)
  else
    Marshal.WriteInt16(Dest, SmallInt(WordBool(True)));
  Result := csSuccess;
end;

class function TDataConverters.UInt32ToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalUInt32ToStr(Source, Str, DestLen);
  r := InternalWriteAStr(AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.UInt32ToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalUInt32ToStr(Source, Str, DestLen);
  r := InternalWriteWStr(WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.UInt32ToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalUInt32ToStr(Source, Str, DestLen);
  r := InternalWriteExtAStr(StringHeap, AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.UInt32ToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalUInt32ToStr(Source, Str, DestLen);
  r := InternalWriteExtWStr(StringHeap, WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.UInt32ToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToBytes(Source, SizeOf(LongWord), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.UInt32ToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToVarBytes(Source, SizeOf(LongWord), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.UInt32ToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToExtVarBytes(StringHeap, Source, SizeOf(LongWord), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.UInt32ToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  InternalCopyToBlob(Source, SizeOf(LongWord), Dest);
  Result := csSuccess;
end;

class function TDataConverters.Int64ToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
begin
  i64 := Marshal.ReadInt64(Source);
  Result := InternalInt64ToInt8(i64, Dest, IgnoreConvertErrors);
end;

class function TDataConverters.Int64ToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
begin
  i64 := Marshal.ReadInt64(Source);
  Result := InternalInt64ToUInt8(i64, Dest, IgnoreConvertErrors);
end;

class function TDataConverters.Int64ToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
begin
  i64 := Marshal.ReadInt64(Source);
  Result := InternalInt64ToInt16(i64, Dest, IgnoreConvertErrors);
end;

class function TDataConverters.Int64ToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
begin
  i64 := Marshal.ReadInt64(Source);
  Result := InternalInt64ToUInt16(i64, Dest, IgnoreConvertErrors);
end;

class function TDataConverters.Int64ToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
begin
  i64 := Marshal.ReadInt64(Source);
  Result := InternalInt64ToInt32(i64, Dest, IgnoreConvertErrors);
end;

class function TDataConverters.Int64ToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
begin
  i64 := Marshal.ReadInt64(Source);
  Result := InternalInt64ToUInt32(i64, Dest, IgnoreConvertErrors);
end;

{$IFDEF VER12P}
class function TDataConverters.Int64ToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
begin
  i64 := Marshal.ReadInt64(Source);
  Result := InternalInt64ToUInt64(i64, Dest, IgnoreConvertErrors);
end;
{$ENDIF}

class function TDataConverters.Int64ToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  s: Single;
begin
  s := Marshal.ReadInt64(Source);
  Marshal.WriteInt32(Dest, CRBitConverter.SingleToInt32Bits(s));
  Result := csSuccess;
end;

class function TDataConverters.Int64ToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  d: Double;
begin
  d := Marshal.ReadInt64(Source);
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(d));
  Result := csSuccess;
end;

class function TDataConverters.Int64ToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
begin
  e := Marshal.ReadInt64(Source);
{$IFDEF CLR}
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(e));
{$ELSE}
  Extended(Dest^) := e;
{$ENDIF}
  Result := csSuccess;
end;

class function TDataConverters.Int64ToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  i64 := Marshal.ReadInt64(Source);

  // Cast check
  if i64 < -922337203685477 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      i64 := -9223372036854770000;
  end
  else if i64 > 922337203685477 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      i64 := 9223372036854770000;
  end
  else begin
    Result := csSuccess;
    {$Q-} // Bug in Delphi on Overflow checking when i64 <= -922337203685477
    i64 := i64 * 10000;
  end;

  r := WriteInt64AsBCD(i64, Dest, DestLen, DestScale, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.Int64ToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  bcd: TBcd;
begin
  i64 := Marshal.ReadInt64(Source);
  bcd := StrToBcd(IntToStr(i64));
  Result := InternalBCDToFMTBCD(bcd, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.Int64ToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  if Marshal.ReadInt64(Source) = 0 then
    Marshal.WriteInt16(Dest, 0)
  else
    Marshal.WriteInt16(Dest, SmallInt(WordBool(True)));
  Result := csSuccess;
end;

class function TDataConverters.Int64ToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalInt64ToStr(Source, Str, DestLen);
  r := InternalWriteAStr(AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.Int64ToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalInt64ToStr(Source, Str, DestLen);
  r := InternalWriteWStr(WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.Int64ToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalInt64ToStr(Source, Str, DestLen);
  r := InternalWriteExtAStr(StringHeap, AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.Int64ToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalInt64ToStr(Source, Str, DestLen);
  r := InternalWriteExtWStr(StringHeap, WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.Int64ToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToBytes(Source, SizeOf(Int64), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.Int64ToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToVarBytes(Source, SizeOf(Int64), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.Int64ToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToExtVarBytes(StringHeap, Source, SizeOf(Int64), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.Int64ToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  InternalCopyToBlob(Source, SizeOf(Int64), Dest);
  Result := csSuccess;
end;

{$IFDEF VER12P}
class function TDataConverters.UInt64ToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  ui64: UInt64;
begin
  ui64 := UInt64(Marshal.ReadInt64(Source));
  Result := InternalUInt64ToInt8(ui64, Dest, IgnoreConvertErrors);
end;

class function TDataConverters.UInt64ToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  ui64: UInt64;
begin
  ui64 := UInt64(Marshal.ReadInt64(Source));
  Result := InternalUInt64ToUInt8(ui64, Dest, IgnoreConvertErrors);
end;

class function TDataConverters.UInt64ToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  ui64: UInt64;
begin
  ui64 := UInt64(Marshal.ReadInt64(Source));
  Result := InternalUInt64ToInt16(ui64, Dest, IgnoreConvertErrors);
end;

class function TDataConverters.UInt64ToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  ui64: UInt64;
begin
  ui64 := UInt64(Marshal.ReadInt64(Source));
  Result := InternalUInt64ToUInt16(ui64, Dest, IgnoreConvertErrors);
end;

class function TDataConverters.UInt64ToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  ui64: UInt64;
begin
  ui64 := UInt64(Marshal.ReadInt64(Source));
  Result := InternalUInt64ToInt32(ui64, Dest, IgnoreConvertErrors);
end;

class function TDataConverters.UInt64ToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  ui64: UInt64;
begin
  ui64 := UInt64(Marshal.ReadInt64(Source));
  Result := InternalUInt64ToUInt32(ui64, Dest, IgnoreConvertErrors);
end;

class function TDataConverters.UInt64ToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  ui64: UInt64;
begin
  ui64 := UInt64(Marshal.ReadInt64(Source));
  Result := InternalUInt64ToInt64(ui64, Dest, IgnoreConvertErrors);
end;

class function TDataConverters.UInt64ToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  s: Single;
begin
  s := UInt64(Marshal.ReadInt64(Source));
  Marshal.WriteInt32(Dest, CRBitConverter.SingleToInt32Bits(s));
  Result := csSuccess;
end;

class function TDataConverters.UInt64ToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  d: Double;
begin
  d := UInt64(Marshal.ReadInt64(Source));
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(d));
  Result := csSuccess;
end;

class function TDataConverters.UInt64ToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
begin
  e := UInt64(Marshal.ReadInt64(Source));
{$IFDEF CLR}
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(e));
{$ELSE}
  Extended(Dest^) := e;
{$ENDIF}
  Result := csSuccess;
end;

class function TDataConverters.UInt64ToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  ui64: UInt64;
  r: TConvertStatus;
begin
  ui64 := UInt64(Marshal.ReadInt64(Source));

  // Cast check
  if ui64 > 922337203685477 then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      ui64 := 9223372036854770000;
  end
  else begin
    Result := csSuccess;
    {$Q-} // Bug in Delphi on Overflow checking when i64 <= -922337203685477
    ui64 := ui64 * 10000;
  end;

  r := WriteUInt64AsBCD(ui64, Dest, DestLen, DestScale, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.UInt64ToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  ui64: UInt64;
  bcd: TBcd;
begin
  ui64 := UInt64(Marshal.ReadInt64(Source));
  bcd := StrToBcd(UIntToStr(ui64));
  Result := InternalBCDToFMTBCD(bcd, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.UInt64ToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  if Marshal.ReadInt64(Source) = 0 then
    Marshal.WriteInt16(Dest, 0)
  else
    Marshal.WriteInt16(Dest, SmallInt(WordBool(True)));
  Result := csSuccess;
end;

class function TDataConverters.UInt64ToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalUInt64ToStr(Source, Str, DestLen);
  r := InternalWriteAStr(AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.UInt64ToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalUInt64ToStr(Source, Str, DestLen);
  r := InternalWriteWStr(WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.UInt64ToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalUInt64ToStr(Source, Str, DestLen);
  r := InternalWriteExtAStr(StringHeap, AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.UInt64ToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalUInt64ToStr(Source, Str, DestLen);
  r := InternalWriteExtWStr(StringHeap, WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.UInt64ToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToBytes(Source, SizeOf(UInt64), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.UInt64ToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToVarBytes(Source, SizeOf(UInt64), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.UInt64ToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToExtVarBytes(StringHeap, Source, SizeOf(UInt64), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.UInt64ToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  InternalCopyToBlob(Source, SizeOf(UInt64), Dest);
  Result := csSuccess;
end;
{$ENDIF}

class function TDataConverters.SingleToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalSingleToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToInt8(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.SingleToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalSingleToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToUInt8(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.SingleToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalSingleToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToInt16(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.SingleToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalSingleToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToInt16(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.SingleToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalSingleToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToInt32(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.SingleToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalSingleToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToUInt32(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.SingleToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
begin
  Result := InternalSingleToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  Marshal.WriteInt64(Dest, i64);
end;

{$IFDEF VER12P}
class function TDataConverters.SingleToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  ui64: UInt64;
begin
  Result := InternalSingleToUInt64(Source, ui64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  Marshal.WriteInt64(Dest, Int64(ui64));
end;
{$ENDIF}

class function TDataConverters.SingleToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  s: Single;
begin
  s := CRBitConverter.Int32BitsToSingle(Marshal.ReadInt32(Source));
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(s));
  Result := csSuccess;
end;

class function TDataConverters.SingleToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  s: Single;
begin
  s := CRBitConverter.Int32BitsToSingle(Marshal.ReadInt32(Source));
{$IFDEF CLR}
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(s));
{$ELSE}
  Extended(Dest^) := s;
{$ENDIF}
  Result := csSuccess;
end;

class function TDataConverters.SingleToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  s: Single;
begin
  s := CRBitConverter.Int32BitsToSingle(Marshal.ReadInt32(Source));
  Result := InternalExtendedToBCD(s, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.SingleToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  s: Single;
  bcd: TBcd;
begin
  s := CRBitConverter.Int32BitsToSingle(Marshal.ReadInt32(Source));
  bcd := DoubleToBcd(s);
  Result := InternalBCDToFMTBCD(bcd, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.SingleToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  s: Single;
begin
  s := CRBitConverter.Int32BitsToSingle(Marshal.ReadInt32(Source));
  if s = 0 then
    Marshal.WriteInt16(Dest, 0)
  else
    Marshal.WriteInt16(Dest, SmallInt(WordBool(True)));
  Result := csSuccess;
end;

class function TDataConverters.SingleToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalSingleToStr(Source, Str, DestLen);
  r := InternalWriteAStr(AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.SingleToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalSingleToStr(Source, Str, DestLen);
  r := InternalWriteWStr(WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.SingleToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalSingleToStr(Source, Str, DestLen);
  r := InternalWriteExtAStr(StringHeap, AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.SingleToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalSingleToStr(Source, Str, DestLen);
  r := InternalWriteExtWStr(StringHeap, WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.SingleToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToBytes(Source, SizeOf(Single), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.SingleToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToVarBytes(Source, SizeOf(Single), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.SingleToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToExtVarBytes(StringHeap, Source, SizeOf(Single), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.SingleToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  InternalCopyToBlob(Source, SizeOf(Single), Dest);
  Result := csSuccess;
end;

class function TDataConverters.FloatToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalFloatToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToInt8(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.FloatToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalFloatToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToUInt8(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.FloatToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalFloatToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToInt16(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.FloatToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalFloatToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToUInt16(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.FloatToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalFloatToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToInt32(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.FloatToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalFloatToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToUInt32(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.FloatToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
begin
  Result := InternalFloatToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  Marshal.WriteInt64(Dest, i64);
end;

{$IFDEF VER12P}
class function TDataConverters.FloatToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  ui64: UInt64;
begin
  Result := InternalFloatToUInt64(Source, ui64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  Marshal.WriteInt64(Dest, Int64(ui64));
end;
{$ENDIF}

class function TDataConverters.FloatToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  d: Double;
begin
  d := BitConverter.Int64BitsToDouble(Marshal.ReadInt64(Source));

  if d < -MaxSingle then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      d := -MaxSingle;
  end
  else
  if d > MaxSingle then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      d := MaxSingle;
  end
  else
    Result := csSuccess;

  Marshal.WriteInt32(Dest, CRBitConverter.SingleToInt32Bits(d));
end;

class function TDataConverters.FloatToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  d: Double;
begin
  d := BitConverter.Int64BitsToDouble(Marshal.ReadInt64(Source));
{$IFDEF CLR}
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(d));
{$ELSE}
  Extended(Dest^) := d;
{$ENDIF}
  Result := csSuccess;
end;

class function TDataConverters.FloatToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  d: Double;
begin
  d := BitConverter.Int64BitsToDouble(Marshal.ReadInt64(Source));
  Result := InternalExtendedToBCD(d, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.FloatToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  d: Double;
  bcd: TBcd;
begin
  d := BitConverter.Int64BitsToDouble(Marshal.ReadInt64(Source));
  bcd := DoubleToBcd(d);
  Result := InternalBCDToFMTBCD(bcd, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.FloatToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  d: Double;
begin
  d := BitConverter.Int64BitsToDouble(Marshal.ReadInt64(Source));
  if d = 0 then
    Marshal.WriteInt16(Dest, 0)
  else
    Marshal.WriteInt16(Dest, SmallInt(WordBool(True)));
  Result := csSuccess;
end;

class function TDataConverters.FloatToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalFloatToStr(Source, Str, DestLen);
  r := InternalWriteAStr(AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.FloatToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalFloatToStr(Source, Str, DestLen);
  r := InternalWriteWStr(WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.FloatToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalFloatToStr(Source, Str, DestLen);
  r := InternalWriteExtAStr(StringHeap, AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.FloatToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalFloatToStr(Source, Str, DestLen);
  r := InternalWriteExtWStr(StringHeap, WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.FloatToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToBytes(Source, SizeOf(Double), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.FloatToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToVarBytes(Source, SizeOf(Double), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.FloatToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToExtVarBytes(StringHeap, Source, SizeOf(Double), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.FloatToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  InternalCopyToBlob(Source, SizeOf(Double), Dest);
  Result := csSuccess;
end;

class function TDataConverters.ExtendedToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalExtendedToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToInt8(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.ExtendedToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalExtendedToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToUInt8(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.ExtendedToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalExtendedToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToInt16(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.ExtendedToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalExtendedToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToUInt16(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.ExtendedToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalExtendedToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToInt32(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.ExtendedToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalExtendedToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToUInt32(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.ExtendedToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
begin
  Result := InternalExtendedToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  Marshal.WriteInt64(Dest, i64);
end;

{$IFDEF VER12P}
class function TDataConverters.ExtendedToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  ui64: UInt64;
begin
  Result := InternalExtendedToUInt64(Source, ui64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  Marshal.WriteInt64(Dest, Int64(ui64));
end;
{$ENDIF}

class function TDataConverters.ExtendedToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
begin
{$IFDEF CLR}
  e := BitConverter.Int64BitsToDouble(Marshal.ReadInt64(Source));
{$ELSE}
  e := Extended(Source^);
{$ENDIF}

  if e < -MaxSingle then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      e := -MaxSingle;
  end
  else
  if e > MaxSingle then begin
    Result := csValueOutOfRange;
    if not IgnoreConvertErrors then
      Exit
    else
      e := MaxSingle;
  end
  else
    Result := csSuccess;

  Marshal.WriteInt32(Dest, CRBitConverter.SingleToInt32Bits(e));
end;

class function TDataConverters.ExtendedToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
begin
{$IFDEF CLR}
  e := BitConverter.Int64BitsToDouble(Marshal.ReadInt64(Source));
{$ELSE}
  e := Extended(Source^);
{$ENDIF}
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(e));
  Result := csSuccess;
end;

class function TDataConverters.ExtendedToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
begin
{$IFDEF CLR}
  e := BitConverter.Int64BitsToDouble(Marshal.ReadInt64(Source));
{$ELSE}
  e := Extended(Source^);
{$ENDIF}
  Result := InternalExtendedToBCD(e, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.ExtendedToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
  bcd: TBcd;
begin
{$IFDEF CLR}
  e := BitConverter.Int64BitsToDouble(Marshal.ReadInt64(Source));
{$ELSE}
  e := Extended(Source^);
{$ENDIF}
  bcd := DoubleToBcd(e);
  Result := InternalBCDToFMTBCD(bcd, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.ExtendedToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
begin
{$IFDEF CLR}
  e := BitConverter.Int64BitsToDouble(Marshal.ReadInt64(Source));
{$ELSE}
  e := Extended(Source^);
{$ENDIF}
  if e = 0 then
    Marshal.WriteInt16(Dest, 0)
  else
    Marshal.WriteInt16(Dest, SmallInt(WordBool(True)));
  Result := csSuccess;
end;

class function TDataConverters.ExtendedToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalExtendedToStr(Source, Str, DestLen);
  r := InternalWriteAStr(AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.ExtendedToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalExtendedToStr(Source, Str, DestLen);
  r := InternalWriteWStr(WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.ExtendedToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalExtendedToStr(Source, Str, DestLen);
  r := InternalWriteExtAStr(StringHeap, AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.ExtendedToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalExtendedToStr(Source, Str, DestLen);
  r := InternalWriteExtWStr(StringHeap, WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.ExtendedToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToBytes(Source, SizeOf(Extended), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.ExtendedToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToVarBytes(Source, SizeOf(Extended), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.ExtendedToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToExtVarBytes(StringHeap, Source, SizeOf(Extended), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.ExtendedToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  InternalCopyToBlob(Source, SizeOf(Extended), Dest);
  Result := csSuccess;
end;

class function TDataConverters.BCDToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalBCDToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToInt8(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.BCDToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalBCDToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToUInt8(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.BCDToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalBCDToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToInt16(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.BCDToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalBCDToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToUInt16(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.BCDToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalBCDToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToInt32(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.BCDToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalBCDToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToUInt32(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.BCDToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
begin
  Result := InternalBCDToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  Marshal.WriteInt64(Dest, i64);
end;

{$IFDEF VER12P}
class function TDataConverters.BCDToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  ui64: UInt64;
begin
  Result := InternalBCDToUInt64(Source, ui64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  Marshal.WriteInt64(Dest, Int64(ui64));
end;
{$ENDIF}

class function TDataConverters.BCDToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  s: Single;
begin
  s := Marshal.ReadInt64(Source) / 10000;
  Marshal.WriteInt32(Dest, CRBitConverter.SingleToInt32Bits(s));
  Result := csSuccess;
end;

class function TDataConverters.BCDToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  d: Double;
begin
  d := Marshal.ReadInt64(Source) / 10000;
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(d));
  Result := csSuccess;
end;

class function TDataConverters.BCDToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
begin
  e := Marshal.ReadInt64(Source) / 10000;
{$IFDEF CLR}
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(e));
{$ELSE}
  Extended(Dest^) := e;
{$ENDIF}
  Result := csSuccess;
end;

class function TDataConverters.BCDToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
begin
  i64 := Marshal.ReadInt64(Source);
  Result := WriteInt64AsBCD(i64, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.BCDToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  bcd: TBcd;
begin
  i64 := Marshal.ReadInt64(Source);
  bcd := StrToBcd(IntToStr(i64));
{$IFNDEF CLR}
  bcd.SignSpecialPlaces := bcd.SignSpecialPlaces or $04;
{$ELSE}
  bcd := bcd / 10000;
{$ENDIF}
  Result := InternalBCDToFMTBCD(bcd, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.BCDToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
begin
  Result := InternalBCDToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  if i64 = 0 then
    Marshal.WriteInt16(Dest, 0)
  else
    Marshal.WriteInt16(Dest, SmallInt(WordBool(True)));
end;

class function TDataConverters.BCDToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalBCDToStr(Source, Str, DestLen);
  r := InternalWriteAStr(AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.BCDToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalBCDToStr(Source, Str, DestLen);
  r := InternalWriteWStr(WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.BCDToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalBCDToStr(Source, Str, DestLen);
  r := InternalWriteExtAStr(StringHeap, AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.BCDToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalBCDToStr(Source, Str, DestLen);
  r := InternalWriteExtWStr(StringHeap, WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.BCDToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToBytes(Source, SizeOf(Int64), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.BCDToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToVarBytes(Source, SizeOf(Int64), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.BCDToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToExtVarBytes(StringHeap, Source, SizeOf(Int64), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.BCDToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  InternalCopyToBlob(Source, SizeOf(Int64), Dest);
  Result := csSuccess;
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.FMTBCDToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalFMTBCDToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToInt8(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.FMTBCDToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalFMTBCDToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToUInt8(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.FMTBCDToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalFMTBCDToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToInt16(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.FMTBCDToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalFMTBCDToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToUInt16(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.FMTBCDToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalFMTBCDToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToInt32(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.FMTBCDToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
  r: TConvertStatus;
begin
  Result := InternalFMTBCDToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  r := InternalInt64ToUInt32(i64, Dest, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.FMTBCDToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
begin
  Result := InternalFMTBCDToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  Marshal.WriteInt64(Dest, i64);
end;

{$IFDEF VER12P}
class function TDataConverters.FMTBCDToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  ui64: UInt64;
begin
  Result := InternalFMTBCDToUInt64(Source, ui64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  Marshal.WriteInt64(Dest, Int64(ui64));
end;
{$ENDIF}

class function TDataConverters.FMTBCDToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  bcd: TBcd;
  s: Single;
begin
  InternalReadFMTBCD(Source, bcd);
  s := BcdToDouble(bcd);
  Marshal.WriteInt32(Dest, CRBitConverter.SingleToInt32Bits(s));
  Result := csSuccess;
end;

class function TDataConverters.FMTBCDToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  bcd: TBcd;
  d: Double;
begin
  InternalReadFMTBCD(Source, bcd);
  d := BcdToDouble(bcd);
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(d));
  Result := csSuccess;
end;

class function TDataConverters.FMTBCDToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  bcd: TBcd;
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
begin
  InternalReadFMTBCD(Source, bcd);
  e := BcdToDouble(bcd);
{$IFDEF CLR}
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(e));
{$ELSE}
  Extended(Dest^) := e;
{$ENDIF}
  Result := csSuccess;
end;

class function TDataConverters.FMTBCDToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  bcd: TBcd;
  abcd: TBcd;
  i64: Int64;
{$IFNDEF CLR}
  BCDScale: Integer;
{$ENDIF}
  r: TConvertStatus;
begin
  InternalReadFMTBCD(Source, bcd);

  // Cast check
  if not IsBcdInt(bcd) then begin
    Result := csFractionTruncated;
    if not IgnoreConvertErrors then
      Exit
    else
      NormalizeBcd(bcd, abcd, Bcd.Precision, 4);
  end
  else begin
    Result := csSuccess;
    abcd := bcd;
  end;

{$IFNDEF CLR}
  BCDScale := GetBcdScale(abcd);
  if BCDScale < 4 then
    abcd.Precision := abcd.Precision + 4 - BCDScale;
  abcd.SignSpecialPlaces := abcd.SignSpecialPlaces and $C0;
{$ELSE}
  abcd := abcd * 10000;
{$ENDIF}
  i64 := StrToInt64(BcdToStr(abcd));

  r := WriteInt64AsBCD(i64, Dest, DestLen, DestScale, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.FMTBCDToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  bcd: TBcd;
begin
  InternalReadFMTBCD(Source, bcd);
  Result := InternalBCDToFMTBCD(bcd, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.FMTBCDToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Int64;
begin
  Result := InternalFMTBCDToInt64(Source, i64);
  if (Result <> csSuccess) and not IgnoreConvertErrors then
    Exit;

  if i64 = 0 then
    Marshal.WriteInt16(Dest, 0)
  else
    Marshal.WriteInt16(Dest, SmallInt(WordBool(True)));
end;

class function TDataConverters.FMTBCDToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalFMTBCDToStr(Source, Str, DestLen);
  r := InternalWriteAStr(AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.FMTBCDToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalFMTBCDToStr(Source, Str, DestLen);
  r := InternalWriteWStr(WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.FMTBCDToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalFMTBCDToStr(Source, Str, DestLen);
  r := InternalWriteExtAStr(StringHeap, AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.FMTBCDToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalFMTBCDToStr(Source, Str, DestLen);
  r := InternalWriteExtWStr(StringHeap, WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.FMTBCDToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToBytes(Source, SizeOf(TBcd), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.FMTBCDToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToVarBytes(Source, SizeOf(TBcd), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.FMTBCDToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToExtVarBytes(StringHeap, Source, SizeOf(TBcd), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.FMTBCDToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  InternalCopyToBlob(Source, SizeOf(TBcd), Dest);
  Result := csSuccess;
end;

{$ENDIF}{$ENDIF}

class function TDataConverters.BoolToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteByte(Dest, Byte(Boolean(WordBool(Marshal.ReadInt16(Source)))));
  Result := csSuccess;
end;

class function TDataConverters.BoolToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteByte(Dest, Byte(Boolean(WordBool(Marshal.ReadInt16(Source)))));
  Result := csSuccess;
end;

class function TDataConverters.BoolToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt16(Dest, SmallInt(Boolean(WordBool(Marshal.ReadInt16(Source)))));
  Result := csSuccess;
end;

class function TDataConverters.BoolToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt16(Dest, SmallInt(Boolean(WordBool(Marshal.ReadInt16(Source)))));
  Result := csSuccess;
end;

class function TDataConverters.BoolToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt32(Dest, Integer(Boolean(WordBool(Marshal.ReadInt16(Source)))));
  Result := csSuccess;
end;

class function TDataConverters.BoolToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt32(Dest, Integer(Boolean(WordBool(Marshal.ReadInt16(Source)))));
  Result := csSuccess;
end;

class function TDataConverters.BoolToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt64(Dest, Int64(Boolean(WordBool(Marshal.ReadInt16(Source)))));
  Result := csSuccess;
end;

{$IFDEF VER12P}
class function TDataConverters.BoolToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Marshal.WriteInt64(Dest, Int64(Boolean(WordBool(Marshal.ReadInt16(Source)))));
  Result := csSuccess;
end;
{$ENDIF}

class function TDataConverters.BoolToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  s: Single;
begin
  s := Integer(Boolean(WordBool(Marshal.ReadInt16(Source))));
  Marshal.WriteInt32(Dest, CRBitConverter.SingleToInt32Bits(s));
  Result := csSuccess;
end;

class function TDataConverters.BoolToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  d: Double;
begin
  d := Integer(Boolean(WordBool(Marshal.ReadInt16(Source))));
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(d));
  Result := csSuccess;
end;

class function TDataConverters.BoolToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  e: {$IFNDEF CLR}Extended{$ELSE}Double{$ENDIF};
begin
  e := Integer(Boolean(WordBool(Marshal.ReadInt16(Source))));
{$IFDEF CLR}
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(e));
{$ELSE}
  Extended(Dest^) := e;
{$ENDIF}
  Result := csSuccess;
end;

class function TDataConverters.BoolToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i64: Integer;
begin
  i64 := Integer(Boolean(WordBool(Marshal.ReadInt16(Source)))) * 10000;
  Result := WriteInt64AsBCD(i64, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.BoolToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  i: integer;
  bcd: TBcd;
begin
  i := Integer(Boolean(WordBool(Marshal.ReadInt16(Source))));
  bcd := StrToBcd(IntToStr(i));
  Result := InternalBCDToFMTBCD(bcd, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.BoolToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalBoolToStr(Source, Str, DestLen);
  r := InternalWriteAStr(AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.BoolToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalBoolToStr(Source, Str, DestLen);
  r := InternalWriteWStr(WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.BoolToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalBoolToStr(Source, Str, DestLen);
  r := InternalWriteExtAStr(StringHeap, AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.BoolToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: String;
  r: TConvertStatus;
begin
  Result := InternalBoolToStr(Source, Str, DestLen);
  r := InternalWriteExtWStr(StringHeap, WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.BoolToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  w: Word;
  p: IntPtr;
begin
  w := Word(Boolean(WordBool(Marshal.ReadInt16(Source))));
  p := AllocOrdinal(w);
  try
    Result := InternalCopyToBytes(p, SizeOf(w), Dest, DestLen, IgnoreConvertErrors);
  finally
    FreeOrdinal(p);
  end;
end;

class function TDataConverters.BoolToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  w: Word;
  p: IntPtr;
begin
  w := Word(Boolean(WordBool(Marshal.ReadInt16(Source))));
  p := AllocOrdinal(w);
  try
    Result := InternalCopyToVarBytes(p, SizeOf(w), Dest, DestLen, IgnoreConvertErrors);
  finally
    FreeOrdinal(p);
  end;
end;

class function TDataConverters.BoolToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  w: Word;
  p: IntPtr;
begin
  w := Word(Boolean(WordBool(Marshal.ReadInt16(Source))));
  p := AllocOrdinal(w);
  try
    Result := InternalCopyToExtVarBytes(StringHeap, p, SizeOf(w), Dest, DestLen, IgnoreConvertErrors);
  finally
    FreeOrdinal(p);
  end;
end;

class function TDataConverters.BoolToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  w: Word;
  p: IntPtr;
begin
  w := Word(Boolean(WordBool(Marshal.ReadInt16(Source))));
  p := AllocOrdinal(w);
  try
    InternalCopyToBlob(p, SizeOf(WordBool), Dest);
  finally
    FreeOrdinal(p);
  end;
  Result := csSuccess;
end;

class function TDataConverters.DateToDateTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  ts: TTimeStamp;
begin
  ts.Date := Marshal.ReadInt32(Source);
  ts.Time := 0;
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(TimeStampToMSecs(ts)));
  Result := csSuccess;
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.DateToSQLTimeStamp(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  ts: TTimeStamp;
begin
  ts.Date := Marshal.ReadInt32(Source);
  ts.Time := 0;
  InternalTimeStampToSQLTimeStamp(ts, Dest);
  Result := csSuccess;
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.DateToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: string;
  r: TConvertStatus;
begin
  Result := InternalDateToStr(Source, Str, DestLen);
  r := InternalWriteAStr(AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.DateToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: string;
  r: TConvertStatus;
begin
  Result := InternalDateToStr(Source, Str, DestLen);
  r := InternalWriteWStr(WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.DateToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: string;
  r: TConvertStatus;
begin
  Result := InternalDateToStr(Source, Str, DestLen);
  r := InternalWriteExtAStr(StringHeap, AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.DateToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: string;
  r: TConvertStatus;
begin
  Result := InternalDateToStr(Source, Str, DestLen);
  r := InternalWriteExtWStr(StringHeap, WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.DateToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToBytes(Source, SizeOf(Integer), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.DateToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToVarBytes(Source, SizeOf(Integer), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.DateToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToExtVarBytes(StringHeap, Source, SizeOf(Integer), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.DateToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  InternalCopyToBlob(Source, SizeOf(Integer), Dest);
  Result := csSuccess;
end;

class function TDataConverters.TimeToDateTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  ts: TTimeStamp;
begin
  ts.Date := DateDelta;
  ts.Time := Marshal.ReadInt32(Source);
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(TimeStampToMSecs(ts)));
  Result := csSuccess;
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.TimeToSQLTimeStamp(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  ts: TTimeStamp;
begin
  ts.Date := DateDelta;
  ts.Time := Marshal.ReadInt32(Source);
  InternalTimeStampToSQLTimeStamp(ts, Dest);
  Result := csSuccess;
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.TimeToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: string;
  r: TConvertStatus;
begin
  Result := InternalTimeToStr(Source, Str, DestLen);
  r := InternalWriteAStr(AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.TimeToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: string;
  r: TConvertStatus;
begin
  Result := InternalTimeToStr(Source, Str, DestLen);
  r := InternalWriteWStr(WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.TimeToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: string;
  r: TConvertStatus;
begin
  Result := InternalTimeToStr(Source, Str, DestLen);
  r := InternalWriteExtAStr(StringHeap, AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.TimeToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: string;
  r: TConvertStatus;
begin
  Result := InternalTimeToStr(Source, Str, DestLen);
  r := InternalWriteExtWStr(StringHeap, WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.TimeToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToBytes(Source, SizeOf(Integer), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.TimeToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToVarBytes(Source, SizeOf(Integer), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.TimeToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToExtVarBytes(StringHeap, Source, SizeOf(Integer), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.TimeToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  InternalCopyToBlob(Source, SizeOf(Integer), Dest);
  Result := csSuccess;
end;

class function TDataConverters.DateTimeToDate(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  d: Double;
  ts: TTimeStamp;
begin
  d := BitConverter.Int64BitsToDouble(Marshal.ReadInt64(Source));
{$IFDEF CLR}
  ts := MSecsToTimeStamp(Trunc(d));
{$ELSE}{$IFDEF FPC}
  ts := MSecsToTimeStamp(Trunc(d));
{$ELSE}
  ts := MSecsToTimeStamp(d);
{$ENDIF}{$ENDIF}

  // Cast check
  if ts.Time <> 0 then begin
    Result := csDataTruncated;
    if not IgnoreConvertErrors then
      Exit;
  end
  else
    Result := csSuccess;

  Marshal.WriteInt32(Dest, ts.Date);
end;

class function TDataConverters.DateTimeToTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  d: Double;
  ts: TTimeStamp;
begin
  d := BitConverter.Int64BitsToDouble(Marshal.ReadInt64(Source));
{$IFDEF CLR}
  ts := MSecsToTimeStamp(Trunc(d));
{$ELSE}{$IFDEF FPC}
  ts := MSecsToTimeStamp(Trunc(d));
{$ELSE}
  ts := MSecsToTimeStamp(d);
{$ENDIF}{$ENDIF}

  // Cast check
  if (ts.Date <> 0) and (ts.Date <> DateDelta) then begin
    Result := csDataTruncated;
    if not IgnoreConvertErrors then
      Exit;
  end
  else
    Result := csSuccess;

  Marshal.WriteInt32(Dest, ts.Time);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.DateTimeToSQLTimeStamp(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  d: Double;
  ts: TTimeStamp;
begin
  d := BitConverter.Int64BitsToDouble(Marshal.ReadInt64(Source));
{$IFDEF CLR}
  ts := MSecsToTimeStamp(Trunc(d));
{$ELSE}
  ts := MSecsToTimeStamp(d);
{$ENDIF}
  InternalTimeStampToSQLTimeStamp(ts, Dest);
  Result := csSuccess;
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.DateTimeToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: string;
  r: TConvertStatus;
begin
  Result := InternalDateTimeToStr(Source, Str, DestLen);
  r := InternalWriteAStr(AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.DateTimeToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: string;
  r: TConvertStatus;
begin
  Result := InternalDateTimeToStr(Source, Str, DestLen);
  r := InternalWriteWStr(WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.DateTimeToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: string;
  r: TConvertStatus;
begin
  Result := InternalDateTimeToStr(Source, Str, DestLen);
  r := InternalWriteExtAStr(StringHeap, AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.DateTimeToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: string;
  r: TConvertStatus;
begin
  Result := InternalDateTimeToStr(Source, Str, DestLen);
  r := InternalWriteExtWStr(StringHeap, WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.DateTimeToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToBytes(Source, SizeOf(Int64), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.DateTimeToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToVarBytes(Source, SizeOf(Int64), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.DateTimeToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToExtVarBytes(StringHeap, Source, SizeOf(Int64), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.DateTimeToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  InternalCopyToBlob(Source, SizeOf(Int64), Dest);
  Result := csSuccess;
end;

{$IFDEF VER6P}{$IFNDEF FPC}

class function TDataConverters.SQLTimeStampToDate(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  ts: TTimeStamp;
begin
  InternalSQLTimeStampToTimeStamp(Source, ts);

  // Cast check
  if ts.Time <> 0 then begin
    Result := csDataTruncated;
    if not IgnoreConvertErrors then
      Exit;
  end
  else
    Result := csSuccess;

  Marshal.WriteInt32(Dest, ts.Date);
end;

class function TDataConverters.SQLTimeStampToTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  ts: TTimeStamp;
begin
  InternalSQLTimeStampToTimeStamp(Source, ts);

  // Cast check
  if (ts.Date <> 0) and (ts.Date <> DateDelta) then begin
    Result := csDataTruncated;
    if not IgnoreConvertErrors then
      Exit;
  end
  else
    Result := csSuccess;

  Marshal.WriteInt32(Dest, ts.Time);
end;

class function TDataConverters.SQLTimeStampToDateTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  ts: TTimeStamp;
begin
  InternalSQLTimeStampToTimeStamp(Source, ts);
  Marshal.WriteInt64(Dest, BitConverter.DoubleToInt64Bits(TimeStampToMSecs(ts)));
  Result := csSuccess;
end;

class function TDataConverters.SQLTimeStampToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: string;
  r: TConvertStatus;
begin
  Result := InternalSQLTimeStampToStr(Source, Str, DestLen);
  r := InternalWriteAStr(AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.SQLTimeStampToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: string;
  r: TConvertStatus;
begin
  Result := InternalSQLTimeStampToStr(Source, Str, DestLen);
  r := InternalWriteWStr(WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;


class function TDataConverters.SQLTimeStampToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: string;
  r: TConvertStatus;
begin
  Result := InternalSQLTimeStampToStr(Source, Str, DestLen);
  r := InternalWriteExtAStr(StringHeap, AnsiString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.SQLTimeStampToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Str: string;
  r: TConvertStatus;
begin
  Result := InternalSQLTimeStampToStr(Source, Str, DestLen);
  r := InternalWriteExtWStr(StringHeap, WideString(Str), Dest, DestLen, IgnoreConvertErrors);
  if Result = csSuccess then
    Result := r;
end;

class function TDataConverters.SQLTimeStampToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToBytes(Source, SizeOf(TSQLTimeStamp), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.SQLTimeStampToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToVarBytes(Source, SizeOf(TSQLTimeStamp), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.SQLTimeStampToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToExtVarBytes(StringHeap, Source, SizeOf(TSQLTimeStamp), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.SQLTimeStampToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  InternalCopyToBlob(Source, SizeOf(TSQLTimeStamp), Dest);
  Result := csSuccess;
end;

{$ENDIF}{$ENDIF}

class function TDataConverters.AStrToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalStrToInt8(string(AStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.AStrToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalStrToUInt8(string(AStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.AStrToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalStrToInt16(string(AStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.AStrToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalStrToUInt16(string(AStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.AStrToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalStrToInt32(string(AStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.AStrToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalStrToUInt32(string(AStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.AStrToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalStrToInt64(string(AStr), Dest, IgnoreConvertErrors);
end;

{$IFDEF VER12P}
class function TDataConverters.AStrToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalStrToUInt64(string(AStr), Dest, IgnoreConvertErrors);
end;
{$ENDIF}

class function TDataConverters.AStrToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalStrToSingle(string(AStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.AStrToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalStrToFloat(string(AStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.AStrToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalStrToExtended(string(AStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.AStrToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalStrToBCD(string(AStr), Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.AStrToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalStrToFMTBCD(string(AStr), Dest, DestLen, DestScale, IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.AStrToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalStrToBool(string(AStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.AStrToDate(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalStrToDate(string(AStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.AStrToTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalStrToTime(string(AStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.AStrToDateTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalStrToDateTime(string(AStr), Dest, IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.AStrToSQLTimeStamp(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalStrToSQLTimeStamp(string(AStr), Dest, IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.AStrToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalWritePAChar(Source, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.AStrToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalWriteExtPAChar(StringHeap, Source, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.AStrToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalWriteWStr(WideString(AStr), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.AStrToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalWriteExtWStr(StringHeap, WideString(AStr), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.AStrToMemo(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Blob: TBlob;
begin
  Blob := TBlob(GetGCHandleTarget(Marshal.ReadIntPtr(Dest)));
  Blob.AsAnsiString := Marshal.PtrToStringAnsi(Source);
  Result := csSuccess;
end;

class function TDataConverters.AStrToWideMemo(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Blob: TBlob;
begin
  Blob := TBlob(GetGCHandleTarget(Marshal.ReadIntPtr(Dest)));
  Blob.AsWideString := WideString(Marshal.PtrToStringAnsi(Source));
  Result := csSuccess;
end;

class function TDataConverters.AStrToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalCopyToBytes(Source, LengthA(AStr), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.AStrToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalCopyToVarBytes(Source, LengthA(AStr), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.AStrToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalCopyToExtVarBytes(StringHeap, Source, LengthA(AStr), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.AStrToGuid(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalStrToGUID(string(AStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.WStrToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  WStr := Marshal.PtrToStringUni(Source);
  Result := InternalStrToInt8(string(WStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.WStrToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  WStr := Marshal.PtrToStringUni(Source);
  Result := InternalStrToUInt8(string(WStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.WStrToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  WStr := Marshal.PtrToStringUni(Source);
  Result := InternalStrToInt16(string(WStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.WStrToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  WStr := Marshal.PtrToStringUni(Source);
  Result := InternalStrToUInt16(string(WStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.WStrToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  WStr := Marshal.PtrToStringUni(Source);
  Result := InternalStrToInt32(string(WStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.WStrToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  WStr := Marshal.PtrToStringUni(Source);
  Result := InternalStrToUInt32(string(WStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.WStrToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  WStr := Marshal.PtrToStringUni(Source);
  Result := InternalStrToInt64(string(WStr), Dest, IgnoreConvertErrors);
end;

{$IFDEF VER12P}
class function TDataConverters.WStrToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  WStr := Marshal.PtrToStringUni(Source);
  Result := InternalStrToUInt64(string(WStr), Dest, IgnoreConvertErrors);
end;
{$ENDIF}

class function TDataConverters.WStrToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  WStr := Marshal.PtrToStringUni(Source);
  Result := InternalStrToSingle(string(WStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.WStrToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  WStr := Marshal.PtrToStringUni(Source);
  Result := InternalStrToFloat(string(WStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.WStrToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  WStr := Marshal.PtrToStringUni(Source);
  Result := InternalStrToExtended(string(WStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.WStrToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  WStr := Marshal.PtrToStringUni(Source);
  Result := InternalStrToBCD(string(WStr), Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.WStrToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  WStr := Marshal.PtrToStringUni(Source);
  Result := InternalStrToFMTBCD(string(WStr), Dest, DestLen, DestScale, IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.WStrToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  WStr := Marshal.PtrToStringUni(Source);
  Result := InternalStrToBool(string(WStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.WStrToDate(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  WStr := Marshal.PtrToStringUni(Source);
  Result := InternalStrToDate(string(WStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.WStrToTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  WStr := Marshal.PtrToStringUni(Source);
  Result := InternalStrToTime(string(WStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.WStrToDateTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  WStr := Marshal.PtrToStringUni(Source);
  Result := InternalStrToDateTime(string(WStr), Dest, IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.WStrToSQLTimeStamp(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  WStr := Marshal.PtrToStringUni(Source);
  Result := InternalStrToSQLTimeStamp(string(WStr), Dest, IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.WStrToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  WStr := Marshal.PtrToStringUni(Source);
  Result := InternalWriteAStr(AnsiString(WStr), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.WStrToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  WStr := Marshal.PtrToStringUni(Source);
  Result := InternalWriteExtAStr(StringHeap, AnsiString(WStr), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.WStrToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalWritePWChar(Source, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.WStrToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalWriteExtPWChar(StringHeap, Source, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.WStrToMemo(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Blob: TBlob;
begin
  Blob := TBlob(GetGCHandleTarget(Marshal.ReadIntPtr(Dest)));
  Blob.AsAnsiString := AnsiString(Marshal.PtrToStringUni(Source));
  Result := csSuccess;
end;

class function TDataConverters.WStrToWideMemo(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Blob: TBlob;
begin
  Blob := TBlob(GetGCHandleTarget(Marshal.ReadIntPtr(Dest)));
  Blob.AsWideString := Marshal.PtrToStringUni(Source);
  Result := csSuccess;
end;

class function TDataConverters.WStrToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  WStr := Marshal.PtrToStringUni(Source);
  Result := InternalCopyToBytes(Source, Length(WStr) * 2, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.WStrToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  WStr := Marshal.PtrToStringUni(Source);
  Result := InternalCopyToVarBytes(Source, Length(WStr) * 2, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.WStrToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  WStr := Marshal.PtrToStringUni(Source);
  Result := InternalCopyToExtVarBytes(StringHeap, Source, Length(WStr) * 2, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.WStrToGuid(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  WStr := Marshal.PtrToStringUni(Source);
  Result := InternalStrToGUID(string(WStr), Dest, IgnoreConvertErrors);
end;

class function TDataConverters.ExtAStrToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToInt8(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtAStrToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToUInt8(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtAStrToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToInt16(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtAStrToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToUInt16(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtAStrToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToInt32(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtAStrToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToUInt32(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtAStrToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToInt64(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtAStrToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToSingle(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtAStrToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToFloat(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtAStrToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToExtended(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtAStrToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToBCD(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.ExtAStrToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToFMTBCD(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.ExtAStrToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToBool(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtAStrToDate(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToDate(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtAStrToTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToTime(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtAStrToDateTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToDateTime(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.ExtAStrToSQLTimeStamp(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToSQLTimeStamp(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.ExtAStrToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToAStr(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtAStrToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToExtAStr(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtAStrToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToWStr(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtAStrToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToExtWStr(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtAStrToMemo(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToMemo(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtAStrToWideMemo(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToMemo(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtAStrToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToBytes(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtAStrToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToVarBytes(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtAStrToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToExtVarBytes(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtAStrToGuid(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := AStrToGuid(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtWStrToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToInt8(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtWStrToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToUInt8(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtWStrToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToInt16(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtWStrToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToUInt16(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtWStrToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToInt32(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtWStrToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToUInt32(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtWStrToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToInt64(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtWStrToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToSingle(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtWStrToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToFloat(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtWStrToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToExtended(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtWStrToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToBCD(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.ExtWStrToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToFMTBCD(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.ExtWStrToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToBool(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtWStrToDate(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToDate(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtWStrToTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToTime(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtWStrToDateTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToDateTime(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.ExtWStrToSQLTimeStamp(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToSQLTimeStamp(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.ExtWStrToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToAStr(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtWStrToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToExtAStr(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtWStrToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToWStr(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtWStrToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToExtWStr(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtWStrToMemo(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToMemo(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtWStrToWideMemo(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToMemo(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtWStrToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToBytes(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtWStrToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToVarBytes(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtWStrToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToExtVarBytes(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtWStrToGuid(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := WStrToGuid(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.BlobToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyFromBlob(Source, Dest, SizeOf(Shortint), IgnoreConvertErrors);
end;

class function TDataConverters.BlobToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyFromBlob(Source, Dest, SizeOf(Byte), IgnoreConvertErrors);
end;

class function TDataConverters.BlobToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyFromBlob(Source, Dest, SizeOf(Smallint), IgnoreConvertErrors);
end;

class function TDataConverters.BlobToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyFromBlob(Source, Dest, SizeOf(Word), IgnoreConvertErrors);
end;

class function TDataConverters.BlobToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyFromBlob(Source, Dest, SizeOf(Integer), IgnoreConvertErrors);
end;

class function TDataConverters.BlobToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyFromBlob(Source, Dest, SizeOf(LongWord), IgnoreConvertErrors);
end;

class function TDataConverters.BlobToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyFromBlob(Source, Dest, SizeOf(Int64), IgnoreConvertErrors);
end;

{$IFDEF VER12P}
class function TDataConverters.BlobToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyFromBlob(Source, Dest, SizeOf(UInt64), IgnoreConvertErrors);
end;
{$ENDIF}

class function TDataConverters.BlobToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyFromBlob(Source, Dest, SizeOf(Single), IgnoreConvertErrors);
end;

class function TDataConverters.BlobToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyFromBlob(Source, Dest, SizeOf(Double), IgnoreConvertErrors);
end;

class function TDataConverters.BlobToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyFromBlob(Source, Dest, SizeOf(Extended), IgnoreConvertErrors);
end;

class function TDataConverters.BlobToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyFromBlob(Source, Dest, SizeOf(Int64), IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.BlobToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyFromBlob(Source, Dest, SizeOf(TBcd), IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.BlobToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  w: Word;
  p: IntPtr;
begin
  p := AllocOrdinal(w);
  try
    Result := InternalCopyFromBlob(Source, p, SizeOf(w), IgnoreConvertErrors);
    if w = 0 then
      Marshal.WriteInt16(Dest, 0)
    else
      Marshal.WriteInt16(Dest, SmallInt(WordBool(True)));
  finally
    FreeOrdinal(p);
  end;
end;

class function TDataConverters.BlobToDate(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyFromBlob(Source, Dest, SizeOf(Integer), IgnoreConvertErrors);
end;

class function TDataConverters.BlobToTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyFromBlob(Source, Dest, SizeOf(Integer), IgnoreConvertErrors);
end;

class function TDataConverters.BlobToDateTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyFromBlob(Source, Dest, SizeOf(Int64), IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.BlobToSQLTimeStamp(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyFromBlob(Source, Dest, SizeOf(TSQLTimeStamp), IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.BlobToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyFromBlobToBytes(Source, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.BlobToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyFromBlobToVarBytes(Source, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.BlobToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyFromBlobToExtVarBytes(StringHeap, Source, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.MemoToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  InternalMemoToAStr(Source, AStr);
  Result := InternalWriteAStr(AStr, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.MemoToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  InternalMemoToWStr(Source, WStr);
  Result := InternalWriteWStr(WStr, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.MemoToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  InternalMemoToAStr(Source, AStr);
  Result := InternalWriteExtAStr(StringHeap, AStr, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.MemoToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  InternalMemoToWStr(Source, WStr);
  Result := InternalWriteExtWStr(StringHeap, WStr, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.WideMemoToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  InternalWideMemoToAStr(Source, AStr);
  Result := InternalWriteAStr(AStr, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.WideMemoToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  InternalMemoToWStr(Source, WStr);
  Result := InternalWriteWStr(WStr, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.WideMemoToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  InternalWideMemoToAStr(Source, AStr);
  Result := InternalWriteExtAStr(StringHeap, AStr, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.WideMemoToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  InternalWideMemoToWStr(Source, WStr);
  Result := InternalWriteExtWStr(StringHeap, WStr, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.BytesToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromBytes(Source, SourceLen, Dest, SizeOf(Shortint), IgnoreConvertErrors);
end;

class function TDataConverters.BytesToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromBytes(Source, SourceLen, Dest, SizeOf(Byte), IgnoreConvertErrors);
end;

class function TDataConverters.BytesToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromBytes(Source, SourceLen, Dest, SizeOf(Smallint), IgnoreConvertErrors);
end;

class function TDataConverters.BytesToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromBytes(Source, SourceLen, Dest, SizeOf(Word), IgnoreConvertErrors);
end;

class function TDataConverters.BytesToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromBytes(Source, SourceLen, Dest, SizeOf(Integer), IgnoreConvertErrors);
end;

class function TDataConverters.BytesToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromBytes(Source, SourceLen, Dest, SizeOf(LongWord), IgnoreConvertErrors);
end;

class function TDataConverters.BytesToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromBytes(Source, SourceLen, Dest, SizeOf(Int64), IgnoreConvertErrors);
end;

{$IFDEF VER12P}
class function TDataConverters.BytesToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromBytes(Source, SourceLen, Dest, SizeOf(UInt64), IgnoreConvertErrors);
end;
{$ENDIF}

class function TDataConverters.BytesToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromBytes(Source, SourceLen, Dest, SizeOf(Single), IgnoreConvertErrors);
end;

class function TDataConverters.BytesToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromBytes(Source, SourceLen, Dest, SizeOf(Double), IgnoreConvertErrors);
end;

class function TDataConverters.BytesToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromBytes(Source, SourceLen, Dest, SizeOf(Extended), IgnoreConvertErrors);
end;

class function TDataConverters.BytesToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromBytes(Source, SourceLen, Dest, SizeOf(Int64), IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.BytesToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromBytes(Source, SourceLen, Dest, SizeOf(TBcd), IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.BytesToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  w: Word;
  p: IntPtr;
begin
  p := AllocOrdinal(w);
  try
    Result := InternalExactCopyFromBytes(Source, SourceLen, p, SizeOf(w), IgnoreConvertErrors);
    if w = 0 then
      Marshal.WriteInt16(Dest, 0)
    else
      Marshal.WriteInt16(Dest, SmallInt(WordBool(True)));
  finally
    FreeOrdinal(p);
  end;
end;

class function TDataConverters.BytesToDate(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromBytes(Source, SourceLen, Dest, SizeOf(Integer), IgnoreConvertErrors);
end;

class function TDataConverters.BytesToTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromBytes(Source, SourceLen, Dest, SizeOf(Integer), IgnoreConvertErrors);
end;

class function TDataConverters.BytesToDateTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromBytes(Source, SourceLen, Dest, SizeOf(Int64), IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.BytesToSQLTimeStamp(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromBytes(Source, SourceLen, Dest, SizeOf(TSQLTimeStamp), IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.BytesToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  InternalBytesToAStr(Source, SourceLen, AStr);
  Result := InternalWriteAStr(AStr, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.BytesToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  InternalBytesToAStr(Source, SourceLen, AStr);
  Result := InternalWriteExtAStr(StringHeap, AStr, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.BytesToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  InternalBytesToWStr(Source, SourceLen, WStr);
  Result := InternalWriteWStr(WStr, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.BytesToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  InternalBytesToWStr(Source, SourceLen, WStr);
  Result := InternalWriteExtWStr(StringHeap, WStr, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.BytesToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToBytes(Source, SourceLen, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.BytesToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToVarBytes(Source, SourceLen, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.BytesToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalCopyToExtVarBytes(StringHeap, Source, SourceLen, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.BytesToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  InternalCopyToBlob(Source, SourceLen, Dest);
  Result := csSuccess;
end;

class function TDataConverters.VarBytesToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromVarBytes(Source, Dest, SizeOf(Shortint), IgnoreConvertErrors);
end;

class function TDataConverters.VarBytesToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromVarBytes(Source, Dest, SizeOf(Byte), IgnoreConvertErrors);
end;

class function TDataConverters.VarBytesToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromVarBytes(Source, Dest, SizeOf(Smallint), IgnoreConvertErrors);
end;

class function TDataConverters.VarBytesToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromVarBytes(Source, Dest, SizeOf(Word), IgnoreConvertErrors);
end;

class function TDataConverters.VarBytesToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromVarBytes(Source, Dest, SizeOf(Integer), IgnoreConvertErrors);
end;

class function TDataConverters.VarBytesToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromVarBytes(Source, Dest, SizeOf(LongWord), IgnoreConvertErrors);
end;

class function TDataConverters.VarBytesToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromVarBytes(Source, Dest, SizeOf(Int64), IgnoreConvertErrors);
end;

{$IFDEF VER12P}
class function TDataConverters.VarBytesToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromVarBytes(Source, Dest, SizeOf(UInt64), IgnoreConvertErrors);
end;
{$ENDIF}

class function TDataConverters.VarBytesToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromVarBytes(Source, Dest, SizeOf(Single), IgnoreConvertErrors);
end;

class function TDataConverters.VarBytesToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromVarBytes(Source, Dest, SizeOf(Double), IgnoreConvertErrors);
end;

class function TDataConverters.VarBytesToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromVarBytes(Source, Dest, SizeOf(Extended), IgnoreConvertErrors);
end;

class function TDataConverters.VarBytesToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromVarBytes(Source, Dest, SizeOf(Int64), IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.VarBytesToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromVarBytes(Source, Dest, SizeOf(TBcd), IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.VarBytesToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  w: Word;
  p: IntPtr;
begin
  p := AllocOrdinal(w);
  try
    Result := InternalExactCopyFromVarBytes(Source, p, SizeOf(w), IgnoreConvertErrors);
    if w = 0 then
      Marshal.WriteInt16(Dest, 0)
    else
      Marshal.WriteInt16(Dest, SmallInt(WordBool(True)));
  finally
    FreeOrdinal(p);
  end;
end;

class function TDataConverters.VarBytesToDate(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromVarBytes(Source, Dest, SizeOf(Integer), IgnoreConvertErrors);
end;

class function TDataConverters.VarBytesToTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromVarBytes(Source, Dest, SizeOf(Integer), IgnoreConvertErrors);
end;

class function TDataConverters.VarBytesToDateTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromVarBytes(Source, Dest, SizeOf(Int64), IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.VarBytesToSQLTimeStamp(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalExactCopyFromVarBytes(Source, Dest, SizeOf(TSQLTimeStamp), IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.VarBytesToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  InternalVarBytesToAStr(Source, AStr);
  Result := InternalWriteAStr(AStr, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.VarBytesToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  InternalVarBytesToAStr(Source, AStr);
  Result := InternalWriteExtAStr(StringHeap, AStr, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.VarBytesToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  InternalVarBytesToWStr(Source, WStr);
  Result := InternalWriteWStr(WStr, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.VarBytesToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  WStr: WideString;
begin
  InternalVarBytesToWStr(Source, WStr);
  Result := InternalWriteExtWStr(StringHeap, WStr, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.VarBytesToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Size: Integer;
begin
  Size := Marshal.ReadInt16(Source);
  Result := InternalCopyToBytes(PtrOffset(Source, SizeOf(Word)), Size, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.VarBytesToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Size: Integer;
begin
  Size := Marshal.ReadInt16(Source);
  Result := InternalCopyToVarBytes(PtrOffset(Source, SizeOf(Word)), Size, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.VarBytesToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Size: Integer;
begin
  Size := Marshal.ReadInt16(Source);
  Result := InternalCopyToExtVarBytes(StringHeap, PtrOffset(Source, SizeOf(Word)), Size, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.VarBytesToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  InternalCopyToBlob(PtrOffset(Source, SizeOf(Word)), Marshal.ReadInt16(Source), Dest);
  Result := csSuccess;
end;

class function TDataConverters.ExtVarBytesToInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToInt8(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtVarBytesToUInt8(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToUInt8(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtVarBytesToInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToInt16(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtVarBytesToUInt16(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToUInt16(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtVarBytesToInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToInt32(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtVarBytesToUInt32(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToUInt32(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtVarBytesToInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToInt64(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

{$IFDEF VER12P}
class function TDataConverters.ExtVarBytesToUInt64(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToUInt64(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;
{$ENDIF}

class function TDataConverters.ExtVarBytesToSingle(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToSingle(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtVarBytesToFloat(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToFloat(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtVarBytesToExtended(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToExtended(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtVarBytesToBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToBCD(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.ExtVarBytesToFMTBCD(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToFMTBCD(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.ExtVarBytesToBool(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToBool(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtVarBytesToDate(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToDate(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtVarBytesToTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToTime(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtVarBytesToDateTime(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToDateTime(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

{$IFDEF VER6P}{$IFNDEF FPC}
class function TDataConverters.ExtVarBytesToSQLTimeStamp(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToSQLTimeStamp(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;
{$ENDIF}{$ENDIF}

class function TDataConverters.ExtVarBytesToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToAStr(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtVarBytesToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToExtAStr(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtVarBytesToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToWStr(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtVarBytesToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToExtWStr(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtVarBytesToBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToBytes(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtVarBytesToVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToVarBytes(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtVarBytesToExtVarBytes(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  SourcePtr: IntPtr;
begin
  SourcePtr := Marshal.ReadIntPtr(Source);
  Result := VarBytesToExtVarBytes(StringHeap, SourcePtr, SourceLen, SourceScale, Dest, DestLen, DestScale, IgnoreConvertErrors);
end;

class function TDataConverters.ExtVarBytesToBlob(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  Buf: IntPtr;
begin
  Buf := Marshal.ReadIntPtr(Source);
  InternalCopyToBlob(PtrOffset(Buf, SizeOf(Word)), Marshal.ReadInt16(Buf), Dest);
  Result := csSuccess;
end;

class function TDataConverters.GuidToAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalWritePAChar(Source, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.GuidToWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalWriteWStr(WideString(AStr), Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.GuidToExtAStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
begin
  Result := InternalWriteExtPAChar(StringHeap, Source, Dest, DestLen, IgnoreConvertErrors);
end;

class function TDataConverters.GuidToExtWStr(StringHeap: TStringHeap; Source: IntPtr; SourceLen, SourceScale: Integer; Dest: IntPtr; DestLen, DestScale: Integer; IgnoreConvertErrors: Boolean): TConvertStatus;
var
  AStr: AnsiString;
begin
  AStr := Marshal.PtrToStringAnsi(Source);
  Result := InternalWriteExtWStr(StringHeap, WideString(AStr), Dest, DestLen, IgnoreConvertErrors);
end;

initialization
  DBTypeInfos := TDBTypeInfos.Create;

finalization
  DBTypeInfos.Free;

end.
