1 /** 2 * This file has no copyright assigned and is placed in the Public Domain. 3 * This file is part of the mingw-w64 runtime package. 4 * No warranty is given; refer to the file DISCLAIMER.PD within this package. 5 */ 6 #ifndef _ICRSINT_H_ 7 #define _ICRSINT_H_ 8 9 #include <olectl.h> 10 #include <stddef.h> 11 12 class CADORecordBinding; 13 14 #define classoffset(base,derived) ((DWORD_PTR)(static_cast<base*>((derived*)8))-8) 15 16 enum ADOFieldStatusEnum { 17 adFldOK = 0,adFldBadAccessor = 1,adFldCantConvertValue = 2,adFldNull = 3,adFldTruncated = 4,adFldSignMismatch = 5,adFldDataOverFlow = 6, 18 adFldCantCreate = 7,adFldUnavailable = 8,adFldPermissionDenied = 9,adFldIntegrityViolation = 10,adFldSchemaViolation = 11,adFldBadStatus = 12, 19 adFldDefault = 13 20 }; 21 22 typedef struct stADO_BINDING_ENTRY { 23 ULONG_PTR ulOrdinal; 24 WORD wDataType; 25 BYTE bPrecision; 26 BYTE bScale; 27 ULONG_PTR ulSize; 28 ULONG_PTR ulBufferOffset; 29 ULONG_PTR ulStatusOffset; 30 ULONG_PTR ulLengthOffset; 31 ULONG_PTR ulADORecordBindingOffSet; 32 WINBOOL fModify; 33 } ADO_BINDING_ENTRY; 34 35 #define BEGIN_ADO_BINDING(cls) public: typedef cls ADORowClass; \ 36 const ADO_BINDING_ENTRY *WINAPI GetADOBindingEntries() { static const ADO_BINDING_ENTRY rgADOBindingEntries[] = { 37 #define ADO_FIXED_LENGTH_ENTRY(Ordinal,DataType,Buffer,Status,Modify) {Ordinal,DataType,0,0,0,offsetof(ADORowClass,Buffer),offsetof(ADORowClass,Status),0,classoffset(CADORecordBinding,ADORowClass),Modify}, 38 #define ADO_FIXED_LENGTH_ENTRY2(Ordinal,DataType,Buffer,Modify) {Ordinal,DataType,0,0,0,offsetof(ADORowClass,Buffer),0,0,classoffset(CADORecordBinding,ADORowClass),Modify}, 39 #define ADO_NUMERIC_ENTRY(Ordinal,DataType,Buffer,Precision,Scale,Status,Modify) {Ordinal,DataType,Precision,Scale,0,offsetof(ADORowClass,Buffer),offsetof(ADORowClass,Status),0,classoffset(CADORecordBinding,ADORowClass),Modify}, 40 #define ADO_NUMERIC_ENTRY2(Ordinal,DataType,Buffer,Precision,Scale,Modify) {Ordinal,DataType,Precision,Scale,0,offsetof(ADORowClass,Buffer),0,0,classoffset(CADORecordBinding,ADORowClass),Modify}, 41 #define ADO_VARIABLE_LENGTH_ENTRY(Ordinal,DataType,Buffer,Size,Status,Length,Modify) {Ordinal,DataType,0,0,Size,offsetof(ADORowClass,Buffer),offsetof(ADORowClass,Status),offsetof(ADORowClass,Length),classoffset(CADORecordBinding,ADORowClass),Modify}, 42 #define ADO_VARIABLE_LENGTH_ENTRY2(Ordinal,DataType,Buffer,Size,Status,Modify) {Ordinal,DataType,0,0,Size,offsetof(ADORowClass,Buffer),offsetof(ADORowClass,Status),0,classoffset(CADORecordBinding,ADORowClass),Modify}, 43 #define ADO_VARIABLE_LENGTH_ENTRY3(Ordinal,DataType,Buffer,Size,Length,Modify) {Ordinal,DataType,0,0,Size,offsetof(ADORowClass,Buffer),0,offsetof(ADORowClass,Length),classoffset(CADORecordBinding,ADORowClass),Modify}, 44 #define ADO_VARIABLE_LENGTH_ENTRY4(Ordinal,DataType,Buffer,Size,Modify) {Ordinal,DataType,0,0,Size,offsetof(ADORowClass,Buffer),0,0,classoffset(CADORecordBinding,ADORowClass),Modify}, 45 #define END_ADO_BINDING() {0,adEmpty,0,0,0,0,0,0,0,FALSE}}; return rgADOBindingEntries;} 46 47 class CADORecordBinding { 48 public: 49 STDMETHOD_(const ADO_BINDING_ENTRY*,GetADOBindingEntries) (VOID) PURE; 50 }; 51 52 struct __declspec(uuid("00000544-0000-0010-8000-00aa006d2ea4")) IADORecordBinding; 53 DECLARE_INTERFACE_(IADORecordBinding,IUnknown) { 54 public: 55 STDMETHOD(BindToRecordset) (CADORecordBinding *pAdoRecordBinding) PURE; 56 STDMETHOD(AddNew) (CADORecordBinding *pAdoRecordBinding) PURE; 57 STDMETHOD(Update) (CADORecordBinding *pAdoRecordBinding) PURE; 58 }; 59 #endif 60