Delphi面向对象编程

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值