📄 udbaseintf.pas
字号:
unit uDBaseIntf;
interface
{$I Main.inc}
uses
ADODB, DBClient, fcTreeView, Classes, Forms, DB;
const
IID_ADOConnection:TGUID='{2B12FBE7-E5A5-423E-A8A7-193E63404914}';
IID_GetDataProgress:TGUID='{AA7C74FE-F53A-4F0F-A660-6DDC30F96A82}';
IID_DBase:TGUID='{4DA7AE65-31AE-4458-BE9B-21E0D05EF2FF}';
IID_SQLParser:TGUID='{E6420460-7CDA-47BC-AB13-8D84D275F148}';
IID_RSTreeView:TGUID='{EA2A50F9-48BE-49EB-A043-0D1CCFABAB24}';
IID_Security:TGUID='{E918C064-3168-4062-8AF2-A037607B4F23}';
type
IADOConnection=interface
['{2B12FBE7-E5A5-423E-A8A7-193E63404914}']
function GetADOConnection:TADOConnection;
function Connected:Boolean;
end;
IGetDataProgress=interface
['{AA7C74FE-F53A-4F0F-A660-6DDC30F96A82}']
procedure GetDataProgress(Min, Max, Current, PacketRecords:Integer);
end;
TGetDataProgress=procedure(Min, Max, Current, PacketRecords:Integer) of object;
IDBase=interface
['{4DA7AE65-31AE-4458-BE9B-21E0D05EF2FF}']
function ExecSQL(const strSQL:string):Boolean;
function GetData(const strSQL:string):OleVariant; overload;
function UpdateDelta(ACds:TClientDataSet):Boolean;
{描述:用于SELECT语句获取数据的进度
AGetDataProgress:GetDataProgress的回调函数
}
procedure GetDataProgress(AGetDataProgress:TGetDataProgress);
procedure BeginGetData;
{描述:多个数据集获取数据获取数据串行获取数据时候使用, 调用
getData要用beginGetDat与endGetData封装
strSQL:获取数据的SQL句
ACDS:保存由strSQL获取数据的数据集组件
}
procedure GetData(strSQL:string; ACds:TClientDataSet); overload;
procedure EndGetData;
procedure SaveSQL(SaveSQL:Boolean; Path:string='');
end;
TTreeType=(ttDept, ttLinkTab);
IRSTreeView=interface
['{EA2A50F9-48BE-49EB-A043-0D1CCFABAB24}']
procedure BuildTree(fctv: TfcTreeView; strSQL: string='';
RootText:string=''; TreeType:TTreeType=ttDept);
procedure setDataSet(dataSet:TDataSet);
function getDataSet:TDataSet;
procedure setKeyField(const KeyField:string);
function getKeyField:string;
property DataSet:TDataSet read getDataSet write setDataSet;
property KeyField:string read getKeyField write setKeyField;
end;
TSQLType=(stSelect, stDelete, stUpdate, stInsert);
ISQLParser=interface
['{E6420460-7CDA-47BC-AB13-8D84D275F148}']
function GetRecordsCount(strSQL:string; var ASQLType:TSQLType):Integer;overload;
function GetRecordsCount(AString:TStrings):Integer; overload;
function SyntaxParser(strSQL:string):Boolean;
end;
ISecurity=interface
['{E918C064-3168-4062-8AF2-A037607B4F23}']
procedure checkRight(functionID:string; DataSet:TDataSet);overload;
procedure checkRight(functionID:string; DataSetLists:TStrings);overload;
procedure beforeEdit(DataSet:TDataSet);
procedure beforeInsert(DataSet:TDataSet);
procedure beforeDelete(DataSet:TDataSet);
end;
{$IFNDEF DllProject}
const RSDBaseDll='RSDBase.dll';
function InitRSDBase(const HostApp:TApplication; const HostScree:TScreen):Boolean; stdcall;
{描述:初始化 RSDBase.dll, 必须在调用该DLL中的函数或过程之前调用,
并且只需要调用1次
HostApp: 宿主的Application对象
HostScree:宿主Screen对象
}
function DBase:IDBase; stdcall;
{描述:初始化 DBase, 返回IDBase接口引用
}
function ADOConnection:IADOConnection; stdcall;
{描述:初始化 ADOConnection, 返回IADOConnection的接口引用
}
function fcTreeView:IfcTreeView; stdcall;
{描述:初始化 fcTreeView, 返回IfcTreeView的接口引用
}
function Security:ISecurity; stdcall;
{$ENDIF}
implementation
{$IFNDEF DllProject}
function DBase; external RSDBaseDll name 'DBase';
function ADOConnection; external RSDBaseDll name 'ADOConnection';
function fcTreeView; external RSDBaseDll name 'fcTreeView';
function InitRSDBase; external RSDBaseDll name 'InitRSDBase';
function Security; external RSDBaseDll name 'Security';
{$ENDIF}
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -