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

📄 frxmysqleditor.pas

📁 MYSQL 连接控件 MYSQL 连接控件
💻 PAS
字号:

{******************************************}
{                                          }
{             FastReport v3.0              }
{      MYSQL components design editors       }
{                                          }

// Created by: SciBit
// E-mail: support@scibit.com

{                                          }
{******************************************}

unit frxMYSQLEditor;

interface

{$I frx.inc}

implementation

uses
  Windows, Classes, SysUtils, Forms, Dialogs, frxMYSQLComponents, frxCustomDB,
  frxDsgnIntf, frxRes, MySQLServer,MySQLDataset
{$IFDEF Delphi6}
, Variants
{$ENDIF};


type
  TfrxDatabaseNameProperty = class(TfrxStringProperty)
  public
    function GetAttributes: TfrxPropertyAttributes; override;
    procedure GetValues; override;
  end;

  TfrxTableNameProperty = class(TfrxStringProperty)
  public
    function GetAttributes: TfrxPropertyAttributes; override;
    procedure GetValues; override;
  end;

  TfrxIndexNameProperty = class(TfrxStringProperty)
  public
    function GetAttributes: TfrxPropertyAttributes; override;
    procedure GetValues; override;
  end;


{ TfrxDatabaseNameProperty }

function TfrxDatabaseNameProperty.GetAttributes: TfrxPropertyAttributes;
begin
  Result := [paValueList];
end;

procedure TfrxDatabaseNameProperty.GetValues;
var
  SaveConnected: Boolean;
begin
  inherited;
  with TfrxMYSQLDatabase(Component).Database do begin
    SaveConnected := Connected;
    Connected := False;
    GetDatabaseNames(Values);
    Connected := SaveConnected;
  end;
end;

{ TfrxTableNameProperty }

function TfrxTableNameProperty.GetAttributes: TfrxPropertyAttributes;
begin
  Result := [paValueList];
end;

procedure TfrxTableNameProperty.GetValues;
begin
  inherited;
  with TfrxMYSQLTable(Component){.Table} do
    if TfrxMYSQLTable(Component).Database <> nil then Database.Database.GetTableNames(Database.DatabaseName,Values);
end;


{ TfrxIndexProperty }

function TfrxIndexNameProperty.GetAttributes: TfrxPropertyAttributes;
begin
  Result := [paMultiSelect, paValueList];
end;

procedure TfrxIndexNameProperty.GetValues;
var
  i: Integer;
begin
  inherited;
  try
    with TfrxMYSQLTable(Component).Table do
      if (TableName <> '') and (IndexDefs <> nil) then
      begin
        IndexDefs.Update;
        for i := 0 to IndexDefs.Count - 1 do
          if IndexDefs[i].Name <> '' then
            Values.Add(IndexDefs[i].Name);
      end;
  except
  end;
end;


initialization
  frxPropertyEditors.Register(TypeInfo(String), TfrxMYSQLDataBase, 'DatabaseName',
    TfrxDataBaseNameProperty);
  frxPropertyEditors.Register(TypeInfo(String), TfrxMYSQLTable, 'TableName',
    TfrxTableNameProperty);
  frxPropertyEditors.Register(TypeInfo(String), TfrxMYSQLTable, 'IndexName',
    TfrxIndexNameProperty);

end.

⌨️ 快捷键说明

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