⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uconndbfactory.pas

📁 用DELPH写的DAO访问模块.有连接池.应用了各种模块,把数据库操作
💻 PAS
字号:
{*******************************************************}
{                                                       }
{       数据库连接工厂对象基类                          }
{       通过该抽象工厂创建数据库实例                    }
{                                                       }
{       版权所有 (C) 2009 大道网络                      }
{                                                       }
{*******************************************************}
unit uConnDBFactory;

interface

uses
  Classes, uConnDatabase, uDatabasePublic;

type
  //数据库连接工厂对象基类
  TConnDBFactory = class(TPersistent)
  private
  
  protected
    fConnConfig : TConndbConfig;
    function getConnConfig : TConndbConfig;
    procedure setConndbConfig(pConndbconfig: TConndbConfig);

  public
    function getConndbFactory : TConndbFactory;
    function CreatorConnDB :IConnDataBase;  virtual; abstract;
  published
    property connConfig : TConndbConfig read getConnConfig write setConndbConfig;
  end;

implementation

uses
  uConnDBFactory_ACCESS, uConnDBFactory_MSSQL, uConnDBFactory_Oralce;


{ TConnDBFactory }

function TConnDBFactory.getConnConfig;
begin
  result := fConnconfig;
end;

//根据配置文件创建相应的数据库工厂
function TConnDBFactory.getConndbFactory : TConndbFactory;
begin
  case fConnConfig.ConnDBKind of
    dbMSSQL:
      result := TConnADODBFactory_MSSQL.Create;

    dbORACLE:
      result := TConnDBADOFactory_ORALCE.Create;

    dbACCESS:
      result := TConnADODBFactory_ACCESS.Create;
    else
      result := nil;
  end;
end;

procedure TConnDBFactory.setConndbConfig(pConndbconfig: TConndbConfig);
begin
  fConnConfig := pConndbconfig;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -