-
без кода xxx_tlb.pas не разберешься. Недавно тут была подобная тема, когда ОЛЕ-сервер работал в C#, но не работал в делфи. такое впечатление, что в C# расширено множество OLE-совместимых типов. Весь код не надо, можно только обїявления типов.
-
unit deObjDBLib_TLB;
interface
uses Windows, ActiveX, Classes, Graphics, MSXML_TLB, OleServer, StdVCL, Variants;
const
deObjDBLibMajorVersion = 1;
deObjDBLibMinorVersion = 0;
LIBID_deObjDBLib: TGUID = '';
IID_IObjDB: TGUID = '';
IID_IObjDBConnection: TGUID = '';
IID_IObjDBTransaction: TGUID = '';
IID_IObjDBDataObject: TGUID = '';
IID_IObjDBMetaObject: TGUID = '';
IID_IObjDBMetaAttribute: TGUID = '';
IID_IObjDBMetaAttributeIterator: TGUID = '';
IID_IObjDBDataObjectList: TGUID = '';
IID_IObjDBDataObjectIterator: TGUID = '';
IID_IObjDBQuery: TGUID = '';
IID_IObjDBQueryField: TGUID = '';
IID_IObjDBFieldIterator: TGUID = '';
IID_IObjDBSubQueryIterator: TGUID = '';
IID_IObjDBMetadata: TGUID = '';
IID_IObjDBMetaObjectIterator: TGUID = '';
IID_IObjDBAdminConnection: TGUID = '';
IID_IObjDBMetadataAdmin: TGUID = '';
IID_IObjDBMetaObjectAdmin: TGUID = '';
IID_IObjDBMetaAttributeAdmin: TGUID = '';
DIID__IObjDBEvents: TGUID = '';
CLASS_ObjDB: TGUID = '';
IID_IObjDBImportTransaction: TGUID = '';
IID_IObjDBRiskyTransaction: TGUID = '';
DIID__IObjDBTransactionEvents: TGUID = '';
DIID__IObjDBConnectionEvents: TGUID = '';
DIID__IObjDBAdminConnectionEvents: TGUID = '';
IID_IObjDBConnectionLifeControl: TGUID = '';
CLASS_ObjDBMetaObjectAdmin: TGUID = '';
IID_IObjDBQueryFieldInfo: TGUID = '';
IID_IObjDBQueryFieldTimestamp: TGUID = '';
IID_IObjDBQueryFieldInteger: TGUID = '';
IID_IObjDBQueryFieldDouble: TGUID = '';
IID_IObjDBQueryFieldString: TGUID = '';
IID_IObjDBQueryFieldBLOB: TGUID = '';
IID_IObjDBQueryFieldGUID: TGUID = '';
IID_IObjDBQueryFieldBoolean: TGUID = '';
IID_IObjDBQueryFieldShape: TGUID = '';
-
type
EODBTransactionType = TOleEnum;
const
ODBTrReadReport = $00000000;
ODBTrReadCommited = $00000001;
ODBTrWriteMassUpdate = $00000002;
ODBTrWriteSingleUpdate = $00000003;
type
EODBAttributeType = TOleEnum;
const
ODBAttrTypeID = $00000001;
ODBAttrTypeVersion = $00000002;
ODBAttrTypeVersionList = $00000003;
ODBAttrTypeParentID = $00000004;
ODBAttrTypeUpdateTime = $00000005;
ODBAttrTypeUpdateUser = $00000006;
ODBAttrTypeVComments = $00000007;
ODBAttrTypeName = $00000008;
ODBAttrTypeInt = $00000064;
ODBAttrTypeDouble = $00000065;
ODBAttrTypeString = $00000066;
ODBAttrTypeBLOB = $00000067;
ODBAttrTypeGUID = $00000068;
ODBAttrTypeBool = $00000069;
ODBAttrTypeTimestamp = $0000006A;
ODBAttrTypeShape = $0000006B;
ODBAttrTypeDictRef = $000001F4;
ODBAttrTypeSubObject = $000001F5;
type
EODBQueryVersionScope = TOleEnum;
const
ODBQVSActual = $00000000;
ODBQVSAllVersions = $00000001;
ODBQVSDeleted = $00000002;
type
EODBTransactionCloseReason = TOleEnum;
const
ODBTrCloseByCommit = $00000000;
ODBTrCloseByRollback = $00000001;
ODBTrCloseByDisconnect = $00000002;
type
IObjDB = interface;
IObjDBConnection = interface;
IObjDBTransaction = interface;
IObjDBDataObject = interface;
IObjDBMetaObject = interface;
IObjDBMetaAttribute = interface;
IObjDBMetaAttributeIterator = interface;
IObjDBDataObjectList = interface;
IObjDBDataObjectIterator = interface;
IObjDBQuery = interface;
IObjDBQueryField = interface;
IObjDBFieldIterator = interface;
IObjDBSubQueryIterator = interface;
IObjDBMetadata = interface;
IObjDBMetaObjectIterator = interface;
IObjDBAdminConnection = interface;
IObjDBMetadataAdmin = interface;
IObjDBMetaObjectAdmin = interface;
IObjDBMetaAttributeAdmin = interface;
_IObjDBEvents = dispinterface;
IObjDBImportTransaction = interface;
IObjDBRiskyTransaction = interface;
_IObjDBTransactionEvents = dispinterface;
_IObjDBConnectionEvents = dispinterface;
_IObjDBAdminConnectionEvents = dispinterface;
IObjDBConnectionLifeControl = interface;
IObjDBQueryFieldInfo = interface;
IObjDBQueryFieldTimestamp = interface;
IObjDBQueryFieldInteger = interface;
IObjDBQueryFieldDouble = interface;
IObjDBQueryFieldString = interface;
IObjDBQueryFieldBLOB = interface;
IObjDBQueryFieldGUID = interface;
IObjDBQueryFieldBoolean = interface;
IObjDBQueryFieldShape = interface;
-
ObjDB = IObjDB;
ObjDBMetaObjectAdmin = IObjDBMetaObjectAdmin;
PUserType1 = ^TGUID;
IObjDB = interface(IUnknown)
['']
function Connect(const pXMLConnection: IXMLDOMNode; const bstrUserLogin: WideString;
const bstrUserPassword: WideString; out ppNewConnection: IObjDBConnection): HResult; stdcall;
function ConnectAdmin(const pXMLConnection: IXMLDOMNode; const bstrUserLogin: WideString;
const bstrUserPassword: WideString; const bstrDBALogin: WideString;
const bstrDBAPassword: WideString; bCreateBase: WordBool;
out ppNewConnection: IObjDBAdminConnection): HResult; stdcall;
end;
IObjDBConnection = interface(IUnknown)
['']
function StartTransaction(eTrType: EODBTransactionType; out ppNewTransaction: IObjDBTransaction): HResult; stdcall;
function Get_Metadata(out pVal: IObjDBMetadata): HResult; stdcall;
function SetUpdateUserLogon(const bstrUserLogon: WideString): HResult; stdcall;
function BackupDatabaseUser(const bstrBackupFile: WideString; const bstrDBALogin: WideString;
const bstrDBAPassword: WideString): HResult; stdcall;
function SuggestBackupFileName(out pVal: WideString): HResult; stdcall;
end;
IObjDBTransaction = interface(IUnknown)
['']
function Commit: HResult; stdcall;
function Rollback: HResult; stdcall;
function Insert(const pDataObject: IObjDBDataObject): HResult; stdcall;
function Update(const pDataObject: IObjDBDataObject): HResult; stdcall;
function Delete(const pDataObject: IObjDBDataObject): HResult; stdcall;
function DeleteByID(const pMetaObject: IObjDBMetaObject; nDataObjectID: SYSINT): HResult; stdcall;
function Retrieve(const pMetaObject: IObjDBMetaObject; nDataObjectID: SYSINT;
out ppDataObject: IObjDBDataObject): HResult; stdcall;
function RetrieveVersion(const pMetaObject: IObjDBMetaObject; nDataObjectVersion: SYSINT;
out ppDataObject: IObjDBDataObject): HResult; stdcall;
function ExecuteQuery(const pQuery: IObjDBQuery): HResult; stdcall;
function SetLock(const pDataObject: IObjDBDataObject): HResult; stdcall;
function CommitRetaining: HResult; stdcall;
function GetServerTime(out pVal: TDateTime): HResult; stdcall;
function StartNestedTransaction(out pVal: IObjDBTransaction): HResult; stdcall;
function RestoreByID(const pMetaObject: IObjDBMetaObject; nDataObjectID: SYSINT): HResult; stdcall;
end;
-
IObjDBDataObject = interface(IUnknown)
['']
function GetMetaObject(out ppMetaObject: IObjDBMetaObject): HResult; stdcall;
function GetID(out pVal: SYSINT): HResult; stdcall;
function GetParentID(out pVal: SYSINT): HResult; stdcall;
function GetVersion(out pVal: SYSINT): HResult; stdcall;
function GetVComments(out pVal: WideString): HResult; stdcall;
function GetUpdTime(out pVal: TDateTime): HResult; stdcall;
function GetUpdUser(out pVal: WideString): HResult; stdcall;
function GetName(out pVal: WideString): HResult; stdcall;
function GetIntegerValue(const bstrAttrCode: WideString; out pVal: SYSINT): HResult; stdcall;
function SetIntegerValue(const bstrAttrCode: WideString; nVal: SYSINT): HResult; stdcall;
function GetDoubleValue(const bstrAttrCode: WideString; out pVal: Double): HResult; stdcall;
function SetDoubleValue(const bstrAttrCode: WideString; dVal: Double): HResult; stdcall;
function GetStringValue(const bstrAttrCode: WideString; out pVal: WideString): HResult; stdcall;
function SetStringValue(const bstrAttrCode: WideString; const bstrVal: WideString): HResult; stdcall;
function GetBLOBValue(const bstrAttrCode: WideString; out pVal: PSafeArray): HResult; stdcall;
function SetBLOBValue(const bstrAttrCode: WideString; saVal: PSafeArray): HResult; stdcall;
function GetBLOBValueVariant(const bstrAttrCode: WideString; out pVal: OleVariant): HResult; stdcall;
function SetBLOBValueVariant(const bstrAttrCode: WideString; vVal: OleVariant): HResult; stdcall;
function GetGUIDValue(const bstrAttrCode: WideString; out pVal: TGUID): HResult; stdcall;
function SetGUIDValue(const bstrAttrCode: WideString; var guidVal: TGUID): HResult; stdcall;
function GetGUIDValueText(const bstrAttrCode: WideString; out pVal: WideString): HResult; stdcall;
function SetGUIDValueText(const bstrAttrCode: WideString; const bstrVal: WideString): HResult; stdcall;
function GetBooleanValue(const bstrAttrCode: WideString; out pVal: WordBool): HResult; stdcall;
function SetBooleanValue(const bstrAttrCode: WideString; bVal: WordBool): HResult; stdcall;
function GetTimestampValue(const bstrAttrCode: WideString; out pVal: TDateTime): HResult; stdcall;
function SetTimestampValue(const bstrAttrCode: WideString; tmVal: TDateTime): HResult; stdcall;
function GetShapeValue(const bstrAttrCode: WideString; out pXMin: SYSINT; out pXMax: SYSINT;
out pYMin: SYSINT; out pYMax: SYSINT; out pVal: PSafeArray): HResult; stdcall;
function SetShapeValue(const bstrAttrCode: WideString; nXMin: SYSINT; nXMax: SYSINT;
nYMin: SYSINT; nYMax: SYSINT; saVal: PSafeArray): HResult; stdcall;
function GetShapeValueVariant(const bstrAttrCode: WideString; out pXMin: SYSINT;
out pXMax: SYSINT; out pYMin: SYSINT; out pYMax: SYSINT;
out pVal: OleVariant): HResult; stdcall;
function SetShapeValueVariant(const bstrAttrCode: WideString; nXMin: SYSINT; nXMax: SYSINT;
nYMin: SYSINT; nYMax: SYSINT; vVal: OleVariant): HResult; stdcall;
function GetDictRefValue(const bstrAttrCode: WideString; out pVal: SYSINT): HResult; stdcall;
function SetDictRefValue(const bstrAttrCode: WideString; nVal: SYSINT): HResult; stdcall;
function GetSubObjValue(const bstrAttrCode: WideString; out pVal: IObjDBDataObjectList): HResult; stdcall;
function IsNullValue(const bstrAttrCode: WideString; out pVal: WordBool): HResult; stdcall;
function SetNullValue(const bstrAttrCode: WideString): HResult; stdcall;
function GetMetaAttribute(const bstrAttrCode: WideString; out pVal: IObjDBMetaAttribute): HResult; stdcall;
function Get_ReadOnly(out pVal: WordBool): HResult; stdcall;
end;
IObjDBMetaObject = interface(IUnknown)
['']
function GetName(out pVal: WideString): HResult; stdcall;
function GetCode(out pVal: WideString): HResult; stdcall;
function IsRequired(out pVal: WordBool): HResult; stdcall;
function IsVersioned(out pVal: WordBool): HResult; stdcall;
function GetNameExpression(out pVal: WideString): HResult; stdcall;
function GetAttribute(const bstrCode: WideString; out ppMetaAttribute: IObjDBMetaAttribute): HResult; stdcall;
function GetAttributeIterator(out pVal: IObjDBMetaAttributeIterator): HResult; stdcall;
function MakeEmptyDataObject(out ppDataObject: IObjDBDataObject): HResult; stdcall;
end;
-
IObjDBMetaAttribute = interface(IUnknown)
['']
function GetName(out pVal: WideString): HResult; stdcall;
function GetCode(out pVal: WideString): HResult; stdcall;
function GetType(out pVal: EODBAttributeType): HResult; stdcall;
function IsRequired(out pVal: WordBool): HResult; stdcall;
function IsNullable(out pVal: WordBool): HResult; stdcall;
function GetLength(out pVal: SYSINT): HResult; stdcall;
function GetModuleParameters(out pVal: WideString): HResult; stdcall;
function GetRefObject(out ppMetaObject: IObjDBMetaObject): HResult; stdcall;
function IsIndexed(out pVal: WordBool): HResult; stdcall;
function IsForeignKeyPresent(out pVal: WordBool): HResult; stdcall;
function GetOwner(out pVal: IObjDBMetaObject): HResult; stdcall;
end;
IObjDBMetaAttributeIterator = interface(IUnknown)
['']
function GetNextAttribute(out ppMetaAttribute: IObjDBMetaAttribute): HResult; stdcall;
end;
IObjDBDataObjectList = interface(IUnknown)
['']
function GetDataObjectIterator(out pVal: IObjDBDataObjectIterator): HResult; stdcall;
function AddNewDataObject(out ppDataObject: IObjDBDataObject): HResult; stdcall;
function RemoveDataObject(const pDataObject: IObjDBDataObject): HResult; stdcall;
end;
IObjDBDataObjectIterator = interface(IUnknown)
['']
function GetNextDataObject(out ppDataObject: IObjDBDataObject): HResult; stdcall;
end;
-
IObjDBQuery = interface(IUnknown)
['']
function Fetch(out pAvailable: WordBool): HResult; stdcall;
function Close: HResult; stdcall;
function GetField(const bstrFieldName: WideString; out ppField: IObjDBQueryField): HResult; stdcall;
function GetSubQuery(const bstrFieldName: WideString; out ppSubQuery: IObjDBQuery): HResult; stdcall;
function GetMetaObject(out ppMetaObject: IObjDBMetaObject): HResult; stdcall;
function GetName(out pName: WideString): HResult; stdcall;
function IsPartOfParentQuery(out pPart: WordBool): HResult; stdcall;
function GetFieldIterator(out ppVal: IObjDBFieldIterator): HResult; stdcall;
function GetSubQueryIterator(out ppVal: IObjDBSubQueryIterator): HResult; stdcall;
function GetVersionScope(out pVal: EODBQueryVersionScope): HResult; stdcall;
function GetPositionInParentQuery(out pVal: SYSINT): HResult; stdcall;
function GetInnerQueryString(out pVal: WideString): HResult; stdcall;
function GetFullName(out pFullName: WideString): HResult; stdcall;
function GetParentQuery(out pVal: IObjDBQuery): HResult; stdcall;
end;
IObjDBQueryField = interface(IUnknown)
['']
function GetName(out pName: WideString): HResult; stdcall;
function IsNullValue(out pVal: WordBool): HResult; stdcall;
function GetMetaAttribute(out pVal: IObjDBMetaAttribute): HResult; stdcall;
function GetPositionInQuery(out pVal: SYSINT): HResult; stdcall;
end;
IObjDBFieldIterator = interface(IUnknown)
['']
function GetNextField(out ppField: IObjDBQueryField): HResult; stdcall;
end;
IObjDBSubQueryIterator = interface(IUnknown)
['']
function GetNextSubQuery(out ppQuery: IObjDBQuery): HResult; stdcall;
end;
IObjDBMetadata = interface(IUnknown)
['']
function GetMetaObject(const bstrCode: WideString; out ppMetaObject: IObjDBMetaObject): HResult; stdcall;
function GetMetaObjectIterator(out pVal: IObjDBMetaObjectIterator): HResult; stdcall;
function PrepareQuery(const bstrQuery: WideString; out ppQueryObject: IObjDBQuery): HResult; stdcall;
end;
-
IObjDBMetaObjectIterator = interface(IUnknown)
['']
function GetNextMetaObject(out ppMetaObject: IObjDBMetaObject): HResult; stdcall;
end;
IObjDBAdminConnection = interface(IObjDBConnection)
['']
function BackupDatabase(const bstrBackupFile: WideString): HResult; stdcall;
function RestoreIndices: HResult; stdcall;
end;
IObjDBMetadataAdmin = interface(IObjDBMetadata)
['']
function AddMetaObject(const pMetaObject: IObjDBMetaObjectAdmin): HResult; stdcall;
function RemoveMetaObject(const pMetaObject: IObjDBMetaObjectAdmin): HResult; stdcall;
function ApplyObjectStructure(const pXMLObjStruct: IXMLDOMNode): HResult; stdcall;
end;
IObjDBMetaObjectAdmin = interface(IObjDBMetaObject)
['']
function SetName(const newVal: WideString): HResult; stdcall;
function SetCode(const newVal: WideString): HResult; stdcall;
function SetRequired(newVal: WordBool): HResult; stdcall;
function SetVersioned(newVal: WordBool): HResult; stdcall;
function SetNameExpression(const newVal: WideString): HResult; stdcall;
function AddIntegerAttribute(const bstrCode: WideString; const bstrName: WideString;
bIsRequired: WordBool; bIsNullable: WordBool;
const bstrModPar: WideString;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult; stdcall;
function AddDoubleAttribute(const bstrCode: WideString; const bstrName: WideString;
bIsRequired: WordBool; bIsNullable: WordBool;
const bstrModPar: WideString;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult; stdcall;
function AddStringAttribute(const bstrCode: WideString; const bstrName: WideString;
nLength: SYSINT; bIsRequired: WordBool;
const bstrModPar: WideString;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult; stdcall;
function AddBLOBAttribute(const bstrCode: WideString; const bstrName: WideString;
bIsRequired: WordBool; bIsNullable: WordBool; nLength: SYSINT;
const bstrModPar: WideString;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult; stdcall;
function AddGUIDAttribute(const bstrCode: WideString; const bstrName: WideString;
bIsRequired: WordBool; bIsNullable: WordBool;
const bstrModPar: WideString;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult; stdcall;
function AddBooleanAttribute(const bstrCode: WideString; const bstrName: WideString;
bIsRequired: WordBool; const bstrModPar: WideString;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult; stdcall;
function AddTimestampAttribute(const bstrCode: WideString; const bstrName: WideString;
bIsRequired: WordBool; bIsNullable: WordBool;
const bstrModPar: WideString;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult; stdcall;
function AddShapeAttribute(const bstrCode: WideString; const bstrName: WideString;
bIsRequired: WordBool; nLength: SYSINT;
const bstrModPar: WideString;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult; stdcall;
function AddDictRefAttribute(const bstrCode: WideString; const bstrName: WideString;
bIsRequired: WordBool; bIsNullable: WordBool;
const bstrModPar: WideString; const pRefObject: IObjDBMetaObject;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult; stdcall;
function AddSubObjectAttribute(const bstrCode: WideString; const bstrName: WideString;
bIsRequired: WordBool; const bstrModPar: WideString;
const pRefObject: IObjDBMetaObject;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult; stdcall;
function RemoveAttribute(const pMetaAttribute: IObjDBMetaAttributeAdmin): HResult; stdcall;
end;
-
IObjDBMetaAttributeAdmin = interface(IObjDBMetaAttribute)
['']
function SetName(const newVal: WideString): HResult; stdcall;
function SetRequired(newVal: WordBool): HResult; stdcall;
function SetNullable(newVal: WordBool): HResult; stdcall;
function SetLength(newVal: SYSINT): HResult; stdcall;
function SetModuleParameters(const newVal: WideString): HResult; stdcall;
function SetIndexed(newVal: WordBool): HResult; stdcall;
function SetForeignKeyPresent(newVal: WordBool): HResult; stdcall;
end;
_IObjDBEvents = dispinterface
['']
end;
IObjDBImportTransaction = interface(IUnknown)
['']
function Get_Generator(const pMetaObject: IObjDBMetaObject; out pVal: Integer): HResult; stdcall;
function Set_Generator(const pMetaObject: IObjDBMetaObject; pVal: Integer): HResult; stdcall;
function Insert(const pDataObject: IObjDBDataObject; nId: Integer; nVersion: Integer): HResult; stdcall;
end;
IObjDBRiskyTransaction = interface(IUnknown)
['']
function Insert(const pDataObject: IObjDBDataObject; nId: Integer): HResult; stdcall;
end;
_IObjDBTransactionEvents = dispinterface
['']
procedure TransactionClosed(eCloseReason: EODBTransactionCloseReason); dispid 1;
end;
_IObjDBConnectionEvents = dispinterface
['']
end;
_IObjDBAdminConnectionEvents = dispinterface
['']
end;
-
IObjDBConnectionLifeControl = interface(IUnknown)
['']
function CloseConnection: HResult; stdcall;
end;
IObjDBQueryFieldInfo = interface(IUnknown)
['']
function GetName(out pName: WideString): HResult; stdcall;
function GetMetaAttribute(out pVal: IObjDBMetaAttribute): HResult; stdcall;
function GetQuery(out pVal: IObjDBQuery): HResult; stdcall;
function GetPositionInQuery(out pVal: SYSINT): HResult; stdcall;
end;
IObjDBQueryFieldTimestamp = interface(IObjDBQueryField)
['']
function GetValue(out pVal: TDateTime): HResult; stdcall;
function SetParam(val1: TDateTime): HResult; stdcall;
function SetBetweenParams(val1: TDateTime; val2: TDateTime): HResult; stdcall;
end;
IObjDBQueryFieldInteger = interface(IObjDBQueryField)
['']
function GetValue(out pVal: SYSINT): HResult; stdcall;
function SetParam(val1: SYSINT): HResult; stdcall;
function SetBetweenParams(val1: SYSINT; val2: SYSINT): HResult; stdcall;
end;
IObjDBQueryFieldDouble = interface(IObjDBQueryField)
['']
function GetValue(out pVal: Double): HResult; stdcall;
function SetParam(val1: Double): HResult; stdcall;
function SetBetweenParams(val1: Double; val2: Double): HResult; stdcall;
end;
IObjDBQueryFieldString = interface(IObjDBQueryField)
['']
function GetValue(out pVal: WideString): HResult; stdcall;
function SetParam(const val1: WideString): HResult; stdcall;
function SetBetweenParams(const val1: WideString; const val2: WideString): HResult; stdcall;
end;
-
IObjDBQueryFieldBLOB = interface(IObjDBQueryField)
['']
function GetValue(out pVal: PSafeArray): HResult; stdcall;
function GetValueVariant(out pVal: OleVariant): HResult; stdcall;
end;
IObjDBQueryFieldGUID = interface(IObjDBQueryField)
['']
function GetValue(out pVal: TGUID): HResult; stdcall;
function GetValueText(out pVal: WideString): HResult; stdcall;
function SetParam(var val1: TGUID): HResult; stdcall;
function SetParamText(const val1: WideString): HResult; stdcall;
end;
IObjDBQueryFieldBoolean = interface(IObjDBQueryField)
['']
function GetValue(out pVal: WordBool): HResult; stdcall;
function SetParam(val1: WordBool): HResult; stdcall;
end;
IObjDBQueryFieldShape = interface(IObjDBQueryField)
['']
function GetValue(out pXMin: SYSINT; out pXMax: SYSINT; out pYMin: SYSINT; out pYMax: SYSINT;
out pVal: PSafeArray): HResult; stdcall;
function GetValueVariant(out pXMin: SYSINT; out pXMax: SYSINT; out pYMin: SYSINT;
out pYMax: SYSINT; out pVal: OleVariant): HResult; stdcall;
function SetIntersectParam(nXMin: SYSINT; nXMax: SYSINT; nYMin: SYSINT; nYMax: SYSINT): HResult; stdcall;
end;
CoObjDB = class
class function Create: IObjDB;
class function CreateRemote(const MachineName: string): IObjDB;
end;
-
TObjDBProperties= class;
TObjDB = class(TOleServer)
private
FIntf: IObjDB;
FProps: TObjDBProperties;
function GetServerProperties: TObjDBProperties;
function GetDefaultInterface: IObjDB;
protected
procedure InitServerData; override;
procedure InvokeEvent(DispID: TDispID; var Params: TVariantArray); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Connect; override;
procedure ConnectTo(svrIntf: IObjDB);
procedure Disconnect; override;
function Connect1(const pXMLConnection: IXMLDOMNode; const bstrUserLogin: WideString;
const bstrUserPassword: WideString; out ppNewConnection: IObjDBConnection): HResult;
function ConnectAdmin(const pXMLConnection: IXMLDOMNode; const bstrUserLogin: WideString;
const bstrUserPassword: WideString; const bstrDBALogin: WideString;
const bstrDBAPassword: WideString; bCreateBase: WordBool;
out ppNewConnection: IObjDBAdminConnection): HResult;
property DefaultInterface: IObjDB read GetDefaultInterface;
published
property Server: TObjDBProperties read GetServerProperties;
end;
TObjDBProperties = class(TPersistent)
private
FServer: TObjDB;
function GetDefaultInterface: IObjDB;
constructor Create(AServer: TObjDB);
protected
public
property DefaultInterface: IObjDB read GetDefaultInterface;
published
end;
CoObjDBMetaObjectAdmin = class
class function Create: IObjDBMetaObjectAdmin;
class function CreateRemote(const MachineName: string): IObjDBMetaObjectAdmin;
end;
-
TObjDBMetaObjectAdminProperties= class;
TObjDBMetaObjectAdmin = class(TOleServer)
private
FIntf: IObjDBMetaObjectAdmin;
FProps: TObjDBMetaObjectAdminProperties;
function GetServerProperties: TObjDBMetaObjectAdminProperties;
function GetDefaultInterface: IObjDBMetaObjectAdmin;
protected
procedure InitServerData; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Connect; override;
procedure ConnectTo(svrIntf: IObjDBMetaObjectAdmin);
procedure Disconnect; override;
function GetName(out pVal: WideString): HResult;
function GetCode(out pVal: WideString): HResult;
function IsRequired(out pVal: WordBool): HResult;
function IsVersioned(out pVal: WordBool): HResult;
function GetNameExpression(out pVal: WideString): HResult;
function GetAttribute(const bstrCode: WideString; out ppMetaAttribute: IObjDBMetaAttribute): HResult;
function GetAttributeIterator(out pVal: IObjDBMetaAttributeIterator): HResult;
function MakeEmptyDataObject(out ppDataObject: IObjDBDataObject): HResult;
function SetName(const newVal: WideString): HResult;
function SetCode(const newVal: WideString): HResult;
function SetRequired(newVal: WordBool): HResult;
function SetVersioned(newVal: WordBool): HResult;
function SetNameExpression(const newVal: WideString): HResult;
function AddIntegerAttribute(const bstrCode: WideString; const bstrName: WideString;
bIsRequired: WordBool; bIsNullable: WordBool;
const bstrModPar: WideString;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult;
function AddDoubleAttribute(const bstrCode: WideString; const bstrName: WideString;
bIsRequired: WordBool; bIsNullable: WordBool;
const bstrModPar: WideString;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult;
function AddStringAttribute(const bstrCode: WideString; const bstrName: WideString;
nLength: SYSINT; bIsRequired: WordBool;
const bstrModPar: WideString;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult;
function AddBLOBAttribute(const bstrCode: WideString; const bstrName: WideString;
bIsRequired: WordBool; bIsNullable: WordBool; nLength: SYSINT;
const bstrModPar: WideString;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult;
function AddGUIDAttribute(const bstrCode: WideString; const bstrName: WideString;
bIsRequired: WordBool; bIsNullable: WordBool;
const bstrModPar: WideString;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult;
function AddBooleanAttribute(const bstrCode: WideString; const bstrName: WideString;
bIsRequired: WordBool; const bstrModPar: WideString;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult;
function AddTimestampAttribute(const bstrCode: WideString; const bstrName: WideString;
bIsRequired: WordBool; bIsNullable: WordBool;
const bstrModPar: WideString;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult;
function AddShapeAttribute(const bstrCode: WideString; const bstrName: WideString;
bIsRequired: WordBool; nLength: SYSINT;
const bstrModPar: WideString;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult;
function AddDictRefAttribute(const bstrCode: WideString; const bstrName: WideString;
bIsRequired: WordBool; bIsNullable: WordBool;
const bstrModPar: WideString; const pRefObject: IObjDBMetaObject;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult;
function AddSubObjectAttribute(const bstrCode: WideString; const bstrName: WideString;
bIsRequired: WordBool; const bstrModPar: WideString;
const pRefObject: IObjDBMetaObject;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult;
function RemoveAttribute(const pMetaAttribute: IObjDBMetaAttributeAdmin): HResult;
property DefaultInterface: IObjDBMetaObjectAdmin read GetDefaultInterface;
published
property Server: TObjDBMetaObjectAdminProperties read GetServerProperties;
end;
-
// of the properties of this server)
// *********************************************************************//
TObjDBMetaObjectAdminProperties = class(TPersistent)
private
FServer: TObjDBMetaObjectAdmin;
function GetDefaultInterface: IObjDBMetaObjectAdmin;
constructor Create(AServer: TObjDBMetaObjectAdmin);
protected
public
property DefaultInterface: IObjDBMetaObjectAdmin read GetDefaultInterface;
published
end;
procedure Register;
resourcestring
dtlServerPage = 'geObjDB';
dtlOcxPage = 'geObjDB';
implementation
uses ComObj;
class function CoObjDB.Create: IObjDB;
begin
Result := CreateComObject(CLASS_ObjDB) as IObjDB;
end;
class function CoObjDB.CreateRemote(const MachineName: string): IObjDB;
begin
Result := CreateRemoteComObject(MachineName, CLASS_ObjDB) as IObjDB;
end;
procedure TObjDB.InitServerData;
const
CServerData: TServerData = (
ClassID: '';
IntfIID: '';
EventIID: '';
LicenseKey: nil;
Version: 500);
begin
ServerData := @CServerData;
end;
procedure TObjDB.Connect;
var
punk: IUnknown;
begin
if FIntf = nil then
begin
punk := GetServer;
ConnectEvents(punk);
Fintf:= punk as IObjDB;
end;
end;
procedure TObjDB.ConnectTo(svrIntf: IObjDB);
begin
Disconnect;
FIntf := svrIntf;
ConnectEvents(FIntf);
end;
procedure TObjDB.DisConnect;
begin
if Fintf <> nil then
begin
DisconnectEvents(FIntf);
FIntf := nil;
end;
end;
function TObjDB.GetDefaultInterface: IObjDB;
begin
if FIntf = nil then
Connect;
Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call "Connect" or "ConnectTo" before this operation');
Result := FIntf;
end;
constructor TObjDB.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FProps := TObjDBProperties.Create(Self);
end;
destructor TObjDB.Destroy;
begin
FProps.Free;
inherited Destroy;
end;
-
function TObjDB.GetServerProperties: TObjDBProperties;
begin
Result := FProps;
end;
procedure TObjDB.InvokeEvent(DispID: TDispID; var Params: TVariantArray);
begin
case DispID of
-1: Exit; end;
end;
function TObjDB.Connect1(const pXMLConnection: IXMLDOMNode; const bstrUserLogin: WideString;
const bstrUserPassword: WideString; out ppNewConnection: IObjDBConnection): HResult;
begin
Result := DefaultInterface.Connect(pXMLConnection, bstrUserLogin, bstrUserPassword,
ppNewConnection);
end;
function TObjDB.ConnectAdmin(const pXMLConnection: IXMLDOMNode; const bstrUserLogin: WideString;
const bstrUserPassword: WideString; const bstrDBALogin: WideString;
const bstrDBAPassword: WideString; bCreateBase: WordBool;
out ppNewConnection: IObjDBAdminConnection): HResult;
begin
Result := DefaultInterface.ConnectAdmin(pXMLConnection, bstrUserLogin, bstrUserPassword,
bstrDBALogin, bstrDBAPassword, bCreateBase,
ppNewConnection);
end;
constructor TObjDBProperties.Create(AServer: TObjDB);
begin
inherited Create;
FServer := AServer;
end;
function TObjDBProperties.GetDefaultInterface: IObjDB;
begin
Result := FServer.DefaultInterface;
end;
-
class function CoObjDBMetaObjectAdmin.Create: IObjDBMetaObjectAdmin;
begin
Result := CreateComObject(CLASS_ObjDBMetaObjectAdmin) as IObjDBMetaObjectAdmin;
end;
class function CoObjDBMetaObjectAdmin.CreateRemote(const MachineName: string): IObjDBMetaObjectAdmin;
begin
Result := CreateRemoteComObject(MachineName, CLASS_ObjDBMetaObjectAdmin) as IObjDBMetaObjectAdmin;
end;
procedure TObjDBMetaObjectAdmin.InitServerData;
const
CServerData: TServerData = (
ClassID: '';
IntfIID: '';
EventIID: '';
LicenseKey: nil;
Version: 500);
begin
ServerData := @CServerData;
end;
procedure TObjDBMetaObjectAdmin.Connect;
var
punk: IUnknown;
begin
if FIntf = nil then
begin
punk := GetServer;
Fintf:= punk as IObjDBMetaObjectAdmin;
end;
end;
procedure TObjDBMetaObjectAdmin.ConnectTo(svrIntf: IObjDBMetaObjectAdmin);
begin
Disconnect;
FIntf := svrIntf;
end;
procedure TObjDBMetaObjectAdmin.DisConnect;
begin
if Fintf <> nil then
begin
FIntf := nil;
end;
end;
function TObjDBMetaObjectAdmin.GetDefaultInterface: IObjDBMetaObjectAdmin;
begin
if FIntf = nil then
Connect;
Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call \"Connect\" or \"ConnectTo\" before this operation');
Result := FIntf;
end;
constructor TObjDBMetaObjectAdmin.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FProps := TObjDBMetaObjectAdminProperties.Create(Self);
end;
destructor TObjDBMetaObjectAdmin.Destroy;
begin
FProps.Free;
inherited Destroy;
end;
-
function TObjDBMetaObjectAdmin.GetServerProperties: TObjDBMetaObjectAdminProperties;
begin
Result := FProps;
end;
function TObjDBMetaObjectAdmin.GetName(out pVal: WideString): HResult;
begin
Result := DefaultInterface.GetName(pVal);
end;
function TObjDBMetaObjectAdmin.GetCode(out pVal: WideString): HResult;
begin
Result := DefaultInterface.GetCode(pVal);
end;
function TObjDBMetaObjectAdmin.IsRequired(out pVal: WordBool): HResult;
begin
Result := DefaultInterface.IsRequired(pVal);
end;
function TObjDBMetaObjectAdmin.IsVersioned(out pVal: WordBool): HResult;
begin
Result := DefaultInterface.IsVersioned(pVal);
end;
function TObjDBMetaObjectAdmin.GetNameExpression(out pVal: WideString): HResult;
begin
Result := DefaultInterface.GetNameExpression(pVal);
end;
function TObjDBMetaObjectAdmin.GetAttribute(const bstrCode: WideString;
out ppMetaAttribute: IObjDBMetaAttribute): HResult;
begin
Result := DefaultInterface.GetAttribute(bstrCode, ppMetaAttribute);
end;
function TObjDBMetaObjectAdmin.GetAttributeIterator(out pVal: IObjDBMetaAttributeIterator): HResult;
begin
Result := DefaultInterface.GetAttributeIterator(pVal);
end;
function TObjDBMetaObjectAdmin.MakeEmptyDataObject(out ppDataObject: IObjDBDataObject): HResult;
begin
Result := DefaultInterface.MakeEmptyDataObject(ppDataObject);
end;
function TObjDBMetaObjectAdmin.SetName(const newVal: WideString): HResult;
begin
Result := DefaultInterface.SetName(newVal);
end;
function TObjDBMetaObjectAdmin.SetCode(const newVal: WideString): HResult;
begin
Result := DefaultInterface.SetCode(newVal);
end;
function TObjDBMetaObjectAdmin.SetRequired(newVal: WordBool): HResult;
begin
Result := DefaultInterface.SetRequired(newVal);
end;
function TObjDBMetaObjectAdmin.SetVersioned(newVal: WordBool): HResult;
begin
Result := DefaultInterface.SetVersioned(newVal);
end;
function TObjDBMetaObjectAdmin.SetNameExpression(const newVal: WideString): HResult;
begin
Result := DefaultInterface.SetNameExpression(newVal);
end;
-
function TObjDBMetaObjectAdmin.AddIntegerAttribute(const bstrCode: WideString;
const bstrName: WideString;
bIsRequired: WordBool; bIsNullable: WordBool;
const bstrModPar: WideString;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult;
begin
Result := DefaultInterface.AddIntegerAttribute(bstrCode, bstrName, bIsRequired, bIsNullable,
bstrModPar, ppMetaAttribute);
end;
function TObjDBMetaObjectAdmin.AddDoubleAttribute(const bstrCode: WideString;
const bstrName: WideString;
bIsRequired: WordBool; bIsNullable: WordBool;
const bstrModPar: WideString;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult;
begin
Result := DefaultInterface.AddDoubleAttribute(bstrCode, bstrName, bIsRequired, bIsNullable,
bstrModPar, ppMetaAttribute);
end;
function TObjDBMetaObjectAdmin.AddStringAttribute(const bstrCode: WideString;
const bstrName: WideString; nLength: SYSINT;
bIsRequired: WordBool;
const bstrModPar: WideString;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult;
begin
Result := DefaultInterface.AddStringAttribute(bstrCode, bstrName, nLength, bIsRequired,
bstrModPar, ppMetaAttribute);
end;
function TObjDBMetaObjectAdmin.AddBLOBAttribute(const bstrCode: WideString;
const bstrName: WideString; bIsRequired: WordBool;
bIsNullable: WordBool; nLength: SYSINT;
const bstrModPar: WideString;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult;
begin
Result := DefaultInterface.AddBLOBAttribute(bstrCode, bstrName, bIsRequired, bIsNullable,
nLength, bstrModPar, ppMetaAttribute);
end;
function TObjDBMetaObjectAdmin.AddGUIDAttribute(const bstrCode: WideString;
const bstrName: WideString; bIsRequired: WordBool;
bIsNullable: WordBool;
const bstrModPar: WideString;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult;
begin
Result := DefaultInterface.AddGUIDAttribute(bstrCode, bstrName, bIsRequired, bIsNullable,
bstrModPar, ppMetaAttribute);
end;
function TObjDBMetaObjectAdmin.AddBooleanAttribute(const bstrCode: WideString;
const bstrName: WideString;
bIsRequired: WordBool;
const bstrModPar: WideString;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult;
begin
Result := DefaultInterface.AddBooleanAttribute(bstrCode, bstrName, bIsRequired, bstrModPar,
ppMetaAttribute);
end;
-
function TObjDBMetaObjectAdmin.AddTimestampAttribute(const bstrCode: WideString;
const bstrName: WideString;
bIsRequired: WordBool; bIsNullable: WordBool;
const bstrModPar: WideString;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult;
begin
Result := DefaultInterface.AddTimestampAttribute(bstrCode, bstrName, bIsRequired, bIsNullable,
bstrModPar, ppMetaAttribute);
end;
function TObjDBMetaObjectAdmin.AddShapeAttribute(const bstrCode: WideString;
const bstrName: WideString; bIsRequired: WordBool;
nLength: SYSINT; const bstrModPar: WideString;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult;
begin
Result := DefaultInterface.AddShapeAttribute(bstrCode, bstrName, bIsRequired, nLength,
bstrModPar, ppMetaAttribute);
end;
function TObjDBMetaObjectAdmin.AddDictRefAttribute(const bstrCode: WideString;
const bstrName: WideString;
bIsRequired: WordBool; bIsNullable: WordBool;
const bstrModPar: WideString;
const pRefObject: IObjDBMetaObject;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult;
begin
Result := DefaultInterface.AddDictRefAttribute(bstrCode, bstrName, bIsRequired, bIsNullable,
bstrModPar, pRefObject, ppMetaAttribute);
end;
function TObjDBMetaObjectAdmin.AddSubObjectAttribute(const bstrCode: WideString;
const bstrName: WideString;
bIsRequired: WordBool;
const bstrModPar: WideString;
const pRefObject: IObjDBMetaObject;
out ppMetaAttribute: IObjDBMetaAttributeAdmin): HResult;
begin
Result := DefaultInterface.AddSubObjectAttribute(bstrCode, bstrName, bIsRequired, bstrModPar,
pRefObject, ppMetaAttribute);
end;
function TObjDBMetaObjectAdmin.RemoveAttribute(const pMetaAttribute: IObjDBMetaAttributeAdmin): HResult;
begin
Result := DefaultInterface.RemoveAttribute(pMetaAttribute);
end;
constructor TObjDBMetaObjectAdminProperties.Create(AServer: TObjDBMetaObjectAdmin);
begin
inherited Create;
FServer := AServer;
end;
function TObjDBMetaObjectAdminProperties.GetDefaultInterface: IObjDBMetaObjectAdmin;
begin
Result := FServer.DefaultInterface;
end;
procedure Register;
begin
RegisterComponents(dtlServerPage, [TObjDB, TObjDBMetaObjectAdmin]);
end;
end.
|