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

📄 xqreg.pas

📁 TxQuery is an SQL engine implemented in a TDataSet descendant component, that can parse SQL syntax,
💻 PAS
字号:
unit xqreg;

{$I XQ_FLAG.INC}
interface
{Thanks to : Steve Garland who created most of this unit
 Date: Jun 30, 2002}

{$R xqresour.dcr}

procedure Register;

implementation

uses
   Classes, xquery, db, sysutils, syntaxhi, xqbase
{$IFDEF LEVEL6}
   , DesignIntf, DesignEditors, Variants
{$ELSE}
   , DsgnIntf
{$ENDIF}
{$IFDEF LEVEL3}   , DBTables, FmxParam, Forms{$ENDIF}   ;type  TDataSetsPropEditor = class(TComponentProperty)  private    FProc : TGetStrProc;    procedure getProc(const s : string);  public    procedure GetValues(Proc : TGetStrProc); override;  end;{$IFDEF FALSE}  TExFunctionsPropEditor = class(TComponentProperty)  private    FProc : TGetStrProc;    procedure getProc(const s : string);  public    procedure GetValues(Proc : TGetStrProc); override;  end;{$ENDIF}{$IFDEF LEVEL3}  TParamsPropEditor = class(TClassProperty)  public
     function GetAttributes: TPropertyAttributes; override;
     //function GetValue: string; override;
     procedure Edit; override;
  end;
{$ELSE}  TParamPropEditor = class(TComponentProperty)  private    FProc : TGetStrProc;    procedure getProc(const s : string);  public    procedure GetValues(Proc : TGetStrProc); override;  end;{$ENDIF}procedure Register;begin
   RegisterComponents('XQuery', [TxQuery, TSyntaxHighlighter]);
   RegisterPropertyEditor(TypeInfo(TComponent), TxDataSetItem,
      'DataSets', TDataSetsPropEditor);
{$IFDEF LEVEL3}
  RegisterPropertyEditor(TypeInfo(TParams), TxQuery, 'Params', TParamsPropEditor);
{$ELSE}
  RegisterPropertyEditor(TypeInfo(TComponent), TParam,
      'Params', TParamPropEditor);
{$ENDIF}
end;

{TDataSetsPropEditor - class implementation}
procedure TDataSetsPropEditor.getProc(const s : string);
var  i    : integer;  item : TxDataSetItem;begin  item := TxDataSetItem(GetComponent(0));  with item, Collection do    for i := 0 to Count - 1 do      if Assigned(TxDataSetItem(Items[i]).DataSet) and         (CompareText(s, TxDataSetItem(Items[i]).DataSet.Name) = 0) then        exit;  FProc(s);end;procedure TDataSetsPropEditor.GetValues(Proc : TGetStrProc);begin  FProc := Proc;  inherited GetValues(getProc);end;{$IFDEF FALSE}{TExFunctionsPropEditor - class implementation}procedure TExFunctionsPropEditor.getProc(const s : string);var  i    : integer;  item : TExFunctionItem;begin  item := TExFunctionItem(GetComponent(0));  with item, Collection do    for i := 0 to Count - 1 do      if CompareText(s, TExFunctionItem(Items[i]).Name) = 0 then        exit;  FProc(s);end;procedure TExFunctionsPropEditor.GetValues(Proc : TGetStrProc);begin  FProc := Proc;  inherited GetValues(getProc);end;{$ENDIF}{TParamPropEditor - class implementation}{$IFDEF LEVEL3}function TParamsPropEditor.GetAttributes: TPropertyAttributes;begin
  Result := inherited GetAttributes + [paDialog, paReadOnly] - [paSubProperties];
end;

{function TParamsPropEditor.GetValue: String;
begin
  Result := '(Params)';
end;}

procedure TParamsPropEditor.Edit;
begin
  with TfrmParams.Create(Application) do
    try
      Enter((GetComponent(0) as TxQuery).Params);
    finally
      Free;
    end;
end;
{$ELSE}procedure TParamPropEditor.getProc(const s : string);var  i    : integer;  item : TParam;begin  item := TParam(GetComponent(0));  with item, Collection do    for i := 0 to Count - 1 do      if CompareText(s, TParam(Items[i]).Name) = 0 then        exit;  FProc(s);end;procedure TParamPropEditor.GetValues(Proc : TGetStrProc);begin  FProc := Proc;  inherited GetValues(getProc);end;{$ENDIF}

end.

⌨️ 快捷键说明

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