Delphi object-oriented programming

zhaozj2021-02-16  137

Unit Impcommon;

Interface

Uses Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DB, AdoDB, Provider, Inifiles, ICOMMON; // iCommon for custom interface {------------ --------------------------------

Author: Zhuam Date: 2004/04/22 TYPE: CLASS MOTHED: NewInstance, FreeInstance, Refcount Descripte: Define a tadoconnection type single Tsingletonconnection for generating a unique instance ----------- ------------------------------------} {TYPE TSINGETONCONNECTION = Class (Tadoconnection) Public Class Function NewInstance: TOBJECT; OVERRIDE; // Overwrite base class function procedure freeInstance; override; class function refcount: integer; // Used to reference count End;}

{------------------------------------- - Author: Zhuam Date: 2004/05/18 type: Class Methed: GetInstance Descripte: Defining Factory Mode (TFactorySingleton) Used to build Tadoconnection objects ------------------ -----------------------------------} Type tFActoryConnection = Class (TComponent) public class function GetInstance: tadoconnection; END;

{-------------------------------------------- AUTHOR: ZHUAM DATE : 2004/05/13 TYPE: CLASS DESCRIPTE: IRECORD interface implementation class -------------------------------------------------------------------------------------------------------------------------------------------------------- ------------} 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);

{-------------------------------------------- AUTHOR: ZHUAM DATE : 2004/05/13 TYPE: CLASS Method: CreateTable, DROPTABLE, ISTABLE DESCRIPTE: ITABLE interface implementation class --------------------------- -------------------} 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 class, configured to get the character to connect to the database in the configuration file string------------------------------------------------- -} Type Timpdbconfig = Class (Tcomponent) Public Class Function GetConnectionstring: String; Class function getodbcconnectionstring: String;

{-------------------------------------------- AUTHOR: ZHUAM DATE : 2004/05/17 TYPE: Class method: WriteInfo, Showinfo Descripte: Used to write error information ------------------------------------------- -----------------} Type Timperrorinfo = Class (tComponent) protected errorfile: file; public class procedure writeInfo; Class Procedure ShowInfo (SINFSTRING: STRING); end; end;

转载请注明原文地址:https://www.9cbs.com/read-7899.html

New Post(0)