mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 03:49:30 +02:00
Sqldb, show strings editor for SQL properties in case database connection do not support metadata extraction
git-svn-id: trunk@16667 -
This commit is contained in:
parent
09983c4aa0
commit
4cd081d380
@ -38,7 +38,7 @@ unit registersqldb;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, LResources, sqldb, ibconnection, odbcconn,
|
Classes, SysUtils, LResources, db, sqldb, ibconnection, odbcconn,
|
||||||
{$IFDEF HASPQCONNECTION}
|
{$IFDEF HASPQCONNECTION}
|
||||||
pqconnection,
|
pqconnection,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -61,10 +61,12 @@ uses
|
|||||||
Type
|
Type
|
||||||
{ TSQLStringsPropertyEditor }
|
{ TSQLStringsPropertyEditor }
|
||||||
|
|
||||||
TSQLStringsPropertyEditor = class(TClassPropertyEditor)
|
TSQLStringsPropertyEditor = class(TStringsPropertyEditor)
|
||||||
|
private
|
||||||
|
procedure EditSQL;
|
||||||
public
|
public
|
||||||
procedure Edit; override;
|
procedure Edit; override;
|
||||||
function CreateDlg(s: TStrings): TSQLStringsPropertyEditorDlg; virtual;
|
function CreateEnhancedDlg(s: TStrings): TSQLStringsPropertyEditorDlg; virtual;
|
||||||
function GetAttributes: TPropertyAttributes; override;
|
function GetAttributes: TPropertyAttributes; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -127,8 +129,7 @@ end;
|
|||||||
|
|
||||||
{ TSQLStringsPropertyEditor }
|
{ TSQLStringsPropertyEditor }
|
||||||
|
|
||||||
//-------------------------------------//
|
procedure TSQLStringsPropertyEditor.EditSQL;
|
||||||
procedure TSQLStringsPropertyEditor.Edit;
|
|
||||||
var
|
var
|
||||||
TheDialog:TSQLStringsPropertyEditorDlg;
|
TheDialog:TSQLStringsPropertyEditorDlg;
|
||||||
Strings :TStrings;
|
Strings :TStrings;
|
||||||
@ -136,7 +137,7 @@ var
|
|||||||
begin
|
begin
|
||||||
Strings := TStrings(GetObjectValue);
|
Strings := TStrings(GetObjectValue);
|
||||||
|
|
||||||
TheDialog := CreateDlg(Strings);
|
TheDialog := CreateEnhancedDlg(Strings);
|
||||||
try
|
try
|
||||||
TheDialog.Caption := Format(SSQLStringsPropertyEditorDlgTitle, [GetPropInfo^.Name]);
|
TheDialog.Caption := Format(SSQLStringsPropertyEditorDlgTitle, [GetPropInfo^.Name]);
|
||||||
if(GetComponent(0) is TSQLQuery)then
|
if(GetComponent(0) is TSQLQuery)then
|
||||||
@ -156,8 +157,20 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSQLStringsPropertyEditor.Edit;
|
||||||
|
begin
|
||||||
|
try
|
||||||
|
EditSQL;
|
||||||
|
except
|
||||||
|
on E:EDatabaseError do
|
||||||
|
begin
|
||||||
|
inherited Edit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------//
|
//------------------------------------------------------------------------------------//
|
||||||
function TSQLStringsPropertyEditor.CreateDlg(s: TStrings): TSQLStringsPropertyEditorDlg;
|
function TSQLStringsPropertyEditor.CreateEnhancedDlg(s: TStrings): TSQLStringsPropertyEditorDlg;
|
||||||
begin
|
begin
|
||||||
Result := TSQLStringsPropertyEditorDlg.Create(Application);
|
Result := TSQLStringsPropertyEditorDlg.Create(Application);
|
||||||
Result.SQLEditor.Text := s.Text;
|
Result.SQLEditor.Text := s.Text;
|
||||||
|
Loading…
Reference in New Issue
Block a user