⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 devart.sdac.oledbintf.pas

📁 devent UniDAC 2.003 include sources
💻 PAS
📖 第 1 页 / 共 4 页
字号:
{$IFNDEF UNIDACPRO}
{$I ..\Sdac.inc}

unit Devart.Sdac.OLEDBIntf;
{$ENDIF}

interface

uses
  MemUtils, {$IFNDEF UNIDACPRO}OLEDBC{$ELSE}OLEDBCUni{$ENDIF},
  ActiveX, System.Runtime.InteropServices, Variants, Windows;

const
  STGM_READ             = $00000000;

type
  IUnknown = System.Object; // ++ should move to MemUtils
  TUintArray = array of UINT;
  PUintArray = IntPtr;
  PPByteArray = IntPtr;
  PPOleStr = IntPtr;
  PCoServerInfo = IntPtr;
  PMultiQI = IntPtr;

  PUINT = IntPtr;
  PDWORD = IntPtr;
  PLongint = IntPtr;

  OleStr = string;
  POleStrList = IntPtr;

  [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Auto)]
  DBTIMESTAMP = packed record
    year: Smallint;
    month: Word;
    day: Word;
    hour: Word;
    minute: Word;
    second: Word;
    fraction: UINT;
  end;
  TDBTimeStamp = DBTIMESTAMP;
  {$EXTERNALSYM DBTIMESTAMP}

type
  [ComImport, GuidAttribute('1CF2B120-547D-101B-8E65-08002B2BD119'), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
  IErrorInfo = interface
    [PreserveSig]
    function GetGUID(out guid: TGUID): HResult;
    [PreserveSig]
    function GetSource(out bstrSource: WideString): HResult;
    [PreserveSig]
    function GetDescription(out bstrDescription: WideString): HResult;
    [PreserveSig]
    function GetHelpFile(out bstrHelpFile: WideString): HResult;
    [PreserveSig]
    function GetHelpContext(out dwHelpContext: Longint): HResult;
  end;

  PBoid = IntPtr;
  [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Auto)]
  BOID = packed record
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.U1)]
    rgb_: array[0..15] of Byte;
  end;
  TBoid = BOID;
  {$EXTERNALSYM BOID}

  [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Auto)]
  XACTTRANSINFO = packed record
    uow: BOID;
    isoLevel: Integer;
    isoFlags: UINT;
    grfTCSupported: UINT;
    grfRMSupported: UINT;
    grfTCSupportedRetaining: UINT;
    grfRMSupportedRetaining: UINT;
  end;
  TXactTransInfo = XACTTRANSINFO;
  {$EXTERNALSYM XACTTRANSINFO}

  [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Auto)]
  XACTOPT = packed record
    ulTimeout: UINT;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 40, ArraySubType = UnmanagedType.I1)]
    szDescription: array[0..39] of Shortint;
  end;
  TXActOpt = XACTOPT;
  {$EXTERNALSYM XACTOPT}

  [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Auto)]
  XACTSTATS = packed record
    cOpen: UINT;
    cCommitting: UINT;
    cCommitted: UINT;
    cAborting: UINT;
    cAborted: UINT;
    cInDoubt: UINT;
    cHeuristicDecision: UINT;
    timeTransactionsUp: FILETIME;
  end;
  TXactStats = XACTSTATS;
  {$EXTERNALSYM XACTSTATS}

  PDBBindExt = IntPtr;
  [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Auto)]
  DBBINDEXT = packed record
    pExtension: IntPtr; // PByte;
    ulExtension: UINT;
  end;
  TDBBindExt = DBBINDEXT;
  {$EXTERNALSYM DBBINDEXT}

  [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Auto)]
  DBOBJECT = packed record
    dwFlags: UINT;
    [MarshalAs(UnmanagedType.Struct)]
    iid: TGUID;
  end;
  TDBObject = DBOBJECT;
  {$EXTERNALSYM DBOBJECT}

  PDBBinding = IntPtr;
  [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Auto)]
  DBBINDING = packed record
    iOrdinal: UINT;
    obValue: UINT;
    obLength: UINT;
    obStatus: UINT;
    pTypeInfo: IntPtr; // IUnknown;
    pObject: IntPtr; // PDBObject;
    pBindExt: IntPtr; // PDBBindExt;
    dwPart: DBPART;
    dwMemOwner: DBMEMOWNER;
    eParamIO: DBPARAMIO;
    cbMaxLen: UINT;
    dwFlags: UINT;
    wType: DBTYPE;
    bPrecision: Byte;
    bScale: Byte;
  end;
  TDBBinding = DBBINDING;
{ $IFNDEF VER125}
  { $EXTERNALSYM DBBINDING}
{ $ENDIF}

  PDBBindingArray = IntPtr;
  TDBBindingArray = packed array of TDBBinding;

  [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Auto)]
  DBIDNAME = record
    [MarshalAs(UnmanagedType.LPWStr)]
    pwszName: PWideChar;
  end;
  TDBIDName = DBIDNAME;

  [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Auto)]
  DBIDGUID = record
    guid: TGUID;
  end;
  TDBIDGuid = DBIDGUID;

  DBPROPID = UINT;
  {$EXTERNALSYM DBPROPID}
  PDBPROPID = IntPtr;
  PDBPropIDArray = IntPtr;
  TDBPropIDArray = array[0..MAXBOUND] of DBPROPID;

  PDBID = IntPtr;
  [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Auto)]
  DBID = packed record
    uGuid: DBIDGUID;
    eKind: DBKIND;
    uName: IntPtr; // DBIDNAME;
  end;
  TDBID = DBID;
  {$EXTERNALSYM DBID}

  _DBID = array [0..23] of byte;

  PDBIDArray = IntPtr;
  TDBIDArray = array[0..MAXBOUND] of TDBID;

  PDBPropIDSet = IntPtr;
  [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Auto)]
  DBPROPIDSET = packed record
    rgPropertyIDs: IntPtr; // PDBPropIDArray;
    cPropertyIDs: UINT;
    guidPropertySet: TGUID;
  end;
  TDBPropIDSet = DBPROPIDSET;
  {$EXTERNALSYM DBPROPIDSET}

  PDBPropIDSetArray = IntPtr;
  TDBPropIDSetArray = array[0..MAXBOUND] of TDBPropIDSet;

  PDBProp = packed record
  private
    Ptr: IntPtr;

    function GetdwPropertyID: DBPROPID;
    procedure SetdwPropertyID(Value: DBPROPID);

    function GetdwOptions: DBPROPOPTIONS;
    procedure SetdwOptions(Value: DBPROPOPTIONS);

    function GetdwStatus: DBPROPSTATUS;
    procedure SetdwStatus(Value: DBPROPSTATUS);

    function Getcolid: _DBID;
    procedure Setcolid(Value: _DBID);

    function GetvValue: OleVariant;
    procedure SetvValue(Value: OleVariant);

  public
    property dwPropertyID: DBPROPID read GetdwPropertyID write SetdwPropertyID;
    property dwOptions: DBPROPOPTIONS read GetdwOptions write SetdwOptions;
    property dwStatus: DBPROPSTATUS read GetdwStatus write SetdwStatus;
    property colid: _DBID read Getcolid write Setcolid;
    property vValue: OleVariant read GetvValue write SetvValue;

    class operator Implicit(AValue: IntPtr): PDBProp;
    class operator Implicit(AValue: PDBProp): IntPtr;
  end;

  [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Auto)]
  DBPROP = packed record
    dwPropertyID: DBPROPID;
    dwOptions: DBPROPOPTIONS;
    dwStatus: DBPROPSTATUS;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = UnmanagedType.U1)]
    colid: _DBID;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.U1)] // ?? 
    vValue: OleVariant;
  end;
  TDBProp = DBPROP;
  {$EXTERNALSYM DBPROP}

  PDBPropArray = IntPtr;
  TDBPropArray = array[0..MAXBOUND] of TDBProp;


  PPDBPropSet = IntPtr;

  PDBPropSet = packed record
  private
    Ptr: IntPtr;

    function GetrgProperties: PDBPropArray;
    procedure SetrgProperties(Value: PDBPropArray);

    function GetcProperties: UINT;
    procedure SetcProperties(Value: UINT);

    function GetguidPropertySet: TGUID;
    procedure SetguidPropertySet(Value: TGUID);

  public
    property rgProperties: PDBPropArray read GetrgProperties write SetrgProperties;
    property cProperties: UINT read GetcProperties write SetcProperties;
    property guidPropertySet: TGUID read GetguidPropertySet write SetguidPropertySet;

    class operator Implicit(AValue: IntPtr): PDBPropSet;
    class operator Implicit(AValue: PDBPropSet): IntPtr;
  end;

  [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Auto)]
  DBPROPSET = packed record
    rgProperties: PDBPropArray;
    cProperties: UINT;
    [MarshalAs(UnmanagedType.Struct)]
    guidPropertySet: TGUID;
  end;
  TDBPropSet = DBPROPSET;
  {$EXTERNALSYM DBPROPSET}

  PDBPropSetArray = IntPtr;
  TDBPropSetArray = array[0..MAXBOUND] of TDBPropSet;

  PDBPropInfo = IntPtr;
  [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Auto)]
  DBPROPINFO = packed record
    [MarshalAs(UnmanagedType.LPWStr)]
    pwszDescription: PWideChar;
    dwPropertyID: DBPROPID;
    dwFlags: DBPROPFLAGS;
    vtType: Word;
    vValues: OleVariant;
  end;
  TDBPropInfo = DBPROPINFO;
  {$EXTERNALSYM DBPROPINFO}

  PDBPropInfoArray = IntPtr;
  TDBPropInfoArray = array[0..MAXBOUND] of TDBPropInfo;

  PDBPropInfoSet = IntPtr;
(*
  PDBPropInfoSet = ^TDBPropInfoSet;
  [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Auto)]
  DBPROPINFOSET = packed record
    rgPropertyInfos: PDBPropInfoArray;
    cPropertyInfos: UINT;
    guidPropertySet: TGUID;
  end;
  TDBPropInfoSet = DBPROPINFOSET;
  {$EXTERNALSYM DBPROPINFOSET}
  *)

  PDBParams = IntPtr;
  [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Auto)]
  DBPARAMS = packed record
    pData: IntPtr;
    cParamSets: UINT;
    HACCESSOR: HACCESSOR;
  end;
  TDBParams = DBPARAMS;
  {$EXTERNALSYM DBPARAMS}

  PDBColumnInfo = IntPtr;
  [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Auto)]
  DBCOLUMNINFO = packed record
    [MarshalAs(UnmanagedType.LPWStr)]
    pwszName: PWideChar;
    pTypeInfo: IntPtr;
    iOrdinal: UINT;
    dwFlags: DBCOLUMNFLAGS;
    ulColumnSize: UINT;
    wType: DBTYPE;
    bPrecision: Byte;
    bScale: Byte;
    columnid: DBID;
  end;
  TDBColumnInfo = DBCOLUMNINFO;
  {$EXTERNALSYM DBCOLUMNINFO}

  PDBColumnInfoArray = IntPtr;
  TDBColumnInfoArray = array[0..MAXCOLS] of TDBColumnInfo;

  PDBLiteralInfo = IntPtr;
  [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Auto)]
  DBLITERALINFO = packed record
    [MarshalAs(UnmanagedType.LPWStr)]
    pwszLiteralValue: PWideChar;
    [MarshalAs(UnmanagedType.LPWStr)]
    pwszInvalidChars: PWideChar;
    [MarshalAs(UnmanagedType.LPWStr)]
    pwszInvalidStartingChars: PWideChar;
    lt: UINT;
    fSupported: BOOL;
    cchMaxLen: UINT;
  end;
  TDBLiteralInfo = DBLITERALINFO;
  {$EXTERNALSYM DBLITERALINFO}

  PDBLiteralInfoArray = IntPtr;
  TDBLiteralInfoArray = array[0..MAXBOUND] of TDBLiteralInfo;

  PDBColumnDesc = IntPtr;
  [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Auto)]
  DBCOLUMNDESC = packed record
    [MarshalAs(UnmanagedType.LPWStr)]
    pwszTypeName: PWideChar;
    pTypeInfo: IntPtr;
    rgPropertySets: IntPtr;
    pclsid: IntPtr;
    cPropertySets: UINT;
    ulColumnSize: UINT;
    dbcid: DBID;
    wType: DBTYPE;
    bPrecision: Byte;
    bScale: Byte;
  end;
  TDBColumnDesc = DBCOLUMNDESC;
  {$EXTERNALSYM DBCOLUMNDESC}

  PErrorInfo = IntPtr;
  [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Auto)]
  ERRORINFO = packed record
    hrError: HResult;
    dwMinor: UINT;
    clsid: TGUID;
    iid: TGUID;
    dispid: Integer;
  end;
  TErrorInfo = ERRORINFO;
  {$EXTERNALSYM ERRORINFO}

  PDBParamInfo = IntPtr;
(*  PDBParamInfo = ^TDBParamInfo;
  DBPARAMINFO = packed record
    dwFlags: DBPARAMFLAGS;
    iOrdinal: UINT;
    pwszName: PWideChar;
    pTypeInfo: ITypeInfo;
    ulParamSize: UINT;
    wType: DBTYPE;
    bPrecision: Byte;
    bScale: Byte;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -