Refactor "Copy table" dialog:

* Replace checkboxes, radio buttons and checklistbox by a VirtualTree using checkbox support
* Support selecting/deselecting single indexes
* Support foreign keys
* Place a SynMemo at the bottom in which the user can type an optional WHERE clause to filter incoming data. Fixes issue #2000.
* Move code for SQL generation into TTableColumn etc.
This commit is contained in:
Ansgar Becker
2010-06-14 00:21:33 +00:00
parent 15d73678c6
commit c0da6e5a21
8 changed files with 474 additions and 491 deletions

View File

@ -39,13 +39,6 @@ type
TLineBreaks = (lbsNone, lbsWindows, lbsUnix, lbsMac, lbsWide, lbsMixed);
TMyKey = record
Name : String;
_type : String;
Columns : TStringList;
SubParts : TStringList;
end;
TDBObjectEditor = class(TFrame)
private
FModified: Boolean;
@ -171,6 +164,8 @@ type
procedure HandlePortableSettings(StartupMode: Boolean);
function LoadConnectionParams(Session: String): TConnectionParameters;
function CompareAnyNode(Text1, Text2: String): Integer;
function GetColumnDefaultType(var Text: String): TColumnDefaultType;
function GetColumnDefaultClause(DefaultType: TColumnDefaultType; Text: String): String;
var
MainReg: TRegistry;
@ -3368,6 +3363,30 @@ begin
end;
end;
function GetColumnDefaultType(var Text: String): TColumnDefaultType;
begin
Result := TColumnDefaultType(MakeInt(Copy(Text, 1, 1)));
Text := Copy(Text, 2, Length(Text)-1);
end;
function GetColumnDefaultClause(DefaultType: TColumnDefaultType; Text: String): String;
begin
case DefaultType of
cdtNothing: Result := '';
cdtText: Result := 'DEFAULT '+esc(Text);
cdtTextUpdateTS: Result := 'DEFAULT '+esc(Text)+' ON UPDATE CURRENT_TIMESTAMP';
cdtNull: Result := 'DEFAULT NULL';
cdtNullUpdateTS: Result := 'DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP';
cdtCurTS: Result := 'DEFAULT CURRENT_TIMESTAMP';
cdtCurTSUpdateTS: Result := 'DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP';
cdtAutoInc: Result := 'AUTO_INCREMENT';
end;
end;
end.