unit ImpCommon;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB,Provider,IniFiles,ICommon;
//ICommon 为自定义Interface
{---------------------------------------------
author:zhuam
date:2004/04/22
type:class
mothed:NewInstance,FreeInstance,RefCount
descripte: 定义一个TAdoConnection类型的
单态类TSingletonConnection,用于生成一个
唯一的实例
-----------------------------------------------}
{type
TSingletonConnection=class(TAdoConnection)
public
class function NewInstance:TObject;override; //覆盖基类函数
procedure FreeInstance; override;
class function RefCount:Integer; //用于引用计数
end; }
{----------------------------------------------------
author:zhuam
date:2004/05/18
type:class
methed:getInstance
descripte:定义工厂模式(TFactorySingleton)用于建造
TAdoConnection对象
-----------------------------------------------------}
type
TFactoryConnection=class(TComponent)
public
class function getInstance:TAdoConnection;
end;
{---------------------------------------------
author:zhuam
date:2004/05/13
type:class
descripte: IRecord接口的实现类
----------------------------------------------}
type
TImpRecord=class(TInterfacedObject,IRecord)
protected
sQuery:TADOQuery;
sConnection:TAdoConnection;
public
procedure DeleteRecord(sSQL:String);
procedure InsertRecord(sSQL:String);
function SelectRecord(sSQL:String):OleVariant;overload;
procedure SelectRecord(sSQL:String;AdoQry:TAdoQuery);overload;
procedure UpdateRecord(sSQL:String);
end;
{---------------------------------------------
author:zhuam
date:2004/05/13
type:class
method: CreateTable,DropTable,IsTable
descripte: ITable接口的实现类
----------------------------------------------}
type
TImpTable=class(TInterfacedObject,ITable)
protected
sQuery:TADOQuery;
sConnection:TAdoConnection;
public
procedure CreateTable(sSQL:String);
procedure DropTable(sTableName:String);
function IsTable(sTableName:String): Boolean;
end;
{-------------------------------------------------
author:zhuam
date:2004/05/13
type:class
method:getConnectionString,getODBCConnectionString
descripte:TImpDBConfig类,用于取配置文件中
连接数据库的字符串
---------------------------------------------------}
type
TImpDBConfig=class(TComponent)
public
class function getConnectionString:String;
class function getODBCConnectionString:String;
end;
{---------------------------------------------
author:zhuam
date:2004/05/17
type:class
method: WriteInfo,ShowInfo
descripte:用于书写错误信息
----------------------------------------------}
type
TImpErrorInfo=class(TComponent)
protected
ErrorFile:file;
public
class procedure WriteInfo;
class procedure ShowInfo(sInfoString:String);
end;
end.