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

📄 fs_iadortti.pas

📁 报表控件。FastReport 是非常强大的报表控件
💻 PAS
字号:

{******************************************}
{                                          }
{             FastScript v1.9              }
{        ADO classes and functions         }
{                                          }
{  (c) 2003-2005 by Alexander Tzyganenko,  }
{             Fast Reports Inc             }
{                                          }
{******************************************}

unit fs_iadortti;

interface

{$i fs.inc}

uses
  SysUtils, Classes, fs_iinterpreter, fs_itools, fs_idbrtti,
  DB, ADODB, ADOInt;

type
  TfsADORTTI = class(TComponent); // fake component


implementation

type
  TFunctions = class(TfsRTTIModule)
  private
    function CallMethod(Instance: TObject; ClassType: TClass;
      const MethodName: String; Caller: TfsMethodHelper): Variant;
  public
    constructor Create(AScript: TfsScript); override;
  end;


{ TFunctions }

constructor TFunctions.Create(AScript: TfsScript);
begin
  inherited Create(AScript);
  with AScript do
  begin
    AddType('TDataType', fvtInt);
    AddClass(TADOConnection, 'TComponent');
    AddClass(TParameter, 'TCollectionItem');
    with AddClass(TParameters, 'TCollection') do
    begin
      AddMethod('function AddParameter: TParameter', CallMethod);
      AddDefaultProperty('Items', 'Integer', 'TParameter', CallMethod, True);
    end;
    AddClass(TCustomADODataSet, 'TDataSet');
    AddClass(TADOTable, 'TCustomADODataSet');
    with AddClass(TADOQuery, 'TCustomADODataSet') do
      AddMethod('procedure ExecSQL', CallMethod);
    with AddClass(TADOStoredProc, 'TCustomADODataSet') do
      AddMethod('procedure ExecProc', CallMethod);
  end;
end;

function TFunctions.CallMethod(Instance: TObject; ClassType: TClass;
  const MethodName: String; Caller: TfsMethodHelper): Variant;
begin
  Result := 0;

  if ClassType = TParameters then
  begin
    if MethodName = 'ADDPARAMETER' then
      Result := Integer(TParameters(Instance).AddParameter)
    else if MethodName = 'ITEMS.GET' then
      Result := Integer(TParameters(Instance).Items[Caller.Params[0]])
  end
  else if ClassType = TADOQuery then
  begin
    if MethodName = 'EXECSQL' then
      TADOQuery(Instance).ExecSQL
  end
  else if ClassType = TADOStoredProc then
  begin
    if MethodName = 'EXECPROC' then
      TADOStoredProc(Instance).ExecProc
  end
end;


initialization
  fsRTTIModules.Add(TFunctions);

finalization
  fsRTTIModules.Remove(TFunctions);

end.

⌨️ 快捷键说明

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