mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-15 02:54:07 +08:00
Add context menu item in data grid for inserting a column's default value. Fixes issue #2654.
This commit is contained in:
@ -2521,7 +2521,7 @@ object MainForm: TMainForm
|
|||||||
end
|
end
|
||||||
object actDataSetNull: TAction
|
object actDataSetNull: TAction
|
||||||
Category = 'Data'
|
Category = 'Data'
|
||||||
Caption = 'Set NULL'
|
Caption = 'NULL'
|
||||||
Enabled = False
|
Enabled = False
|
||||||
Hint = 'Set focused cell to NULL'
|
Hint = 'Set focused cell to NULL'
|
||||||
ImageIndex = 92
|
ImageIndex = 92
|
||||||
@ -8475,13 +8475,18 @@ object MainForm: TMainForm
|
|||||||
object Paste2: TMenuItem
|
object Paste2: TMenuItem
|
||||||
Action = actPaste
|
Action = actPaste
|
||||||
end
|
end
|
||||||
object setNULL1: TMenuItem
|
|
||||||
Action = actDataSetNull
|
|
||||||
end
|
|
||||||
object DataInsertValue: TMenuItem
|
object DataInsertValue: TMenuItem
|
||||||
Caption = 'Insert value'
|
Caption = 'Insert value'
|
||||||
ImageIndex = 80
|
ImageIndex = 80
|
||||||
OnClick = DataInsertValueClick
|
OnClick = DataInsertValueClick
|
||||||
|
object setNULL1: TMenuItem
|
||||||
|
Action = actDataSetNull
|
||||||
|
end
|
||||||
|
object DataDefaultValue: TMenuItem
|
||||||
|
Caption = 'default'
|
||||||
|
ImageIndex = 28
|
||||||
|
OnClick = InsertValue
|
||||||
|
end
|
||||||
object DataDateTime: TMenuItem
|
object DataDateTime: TMenuItem
|
||||||
Caption = 'datetime'
|
Caption = 'datetime'
|
||||||
Hint = 'Insert datetime-value'
|
Hint = 'Insert datetime-value'
|
||||||
@ -8512,9 +8517,6 @@ object MainForm: TMainForm
|
|||||||
ImageIndex = 80
|
ImageIndex = 80
|
||||||
OnClick = InsertValue
|
OnClick = InsertValue
|
||||||
end
|
end
|
||||||
object N2: TMenuItem
|
|
||||||
Caption = '-'
|
|
||||||
end
|
|
||||||
object DataGUID: TMenuItem
|
object DataGUID: TMenuItem
|
||||||
Caption = 'GUID'
|
Caption = 'GUID'
|
||||||
ImageIndex = 112
|
ImageIndex = 112
|
||||||
|
@ -307,7 +307,6 @@ type
|
|||||||
DataTime: TMenuItem;
|
DataTime: TMenuItem;
|
||||||
DataDate: TMenuItem;
|
DataDate: TMenuItem;
|
||||||
DataYear: TMenuItem;
|
DataYear: TMenuItem;
|
||||||
N2: TMenuItem;
|
|
||||||
DataGUID: TMenuItem;
|
DataGUID: TMenuItem;
|
||||||
ViewasHTML1: TMenuItem;
|
ViewasHTML1: TMenuItem;
|
||||||
InsertfilesintoBLOBfields3: TMenuItem;
|
InsertfilesintoBLOBfields3: TMenuItem;
|
||||||
@ -535,6 +534,7 @@ type
|
|||||||
Exportgridrows1: TMenuItem;
|
Exportgridrows1: TMenuItem;
|
||||||
Synchronizedatabase2: TMenuItem;
|
Synchronizedatabase2: TMenuItem;
|
||||||
QF20: TMenuItem;
|
QF20: TMenuItem;
|
||||||
|
DataDefaultValue: TMenuItem;
|
||||||
procedure actCreateDBObjectExecute(Sender: TObject);
|
procedure actCreateDBObjectExecute(Sender: TObject);
|
||||||
procedure menuConnectionsPopup(Sender: TObject);
|
procedure menuConnectionsPopup(Sender: TObject);
|
||||||
procedure actExitApplicationExecute(Sender: TObject);
|
procedure actExitApplicationExecute(Sender: TObject);
|
||||||
@ -5604,6 +5604,8 @@ var
|
|||||||
Uid: TGuid;
|
Uid: TGuid;
|
||||||
UnixTimestamp: Int64;
|
UnixTimestamp: Int64;
|
||||||
SystemTime: TSystemTime;
|
SystemTime: TSystemTime;
|
||||||
|
ColNum: TColumnIndex;
|
||||||
|
Col: TTableColumn;
|
||||||
begin
|
begin
|
||||||
DecodeDateTime(Now, y, m, d, h, i, s, ms);
|
DecodeDateTime(Now, y, m, d, h, i, s, ms);
|
||||||
DataDateTime.Caption := 'DATETIME: ' + Format('%.4d-%.2d-%.2d %.2d:%.2d:%.2d', [y,m,d,h,i,s]);
|
DataDateTime.Caption := 'DATETIME: ' + Format('%.4d-%.2d-%.2d %.2d:%.2d:%.2d', [y,m,d,h,i,s]);
|
||||||
@ -5615,6 +5617,19 @@ begin
|
|||||||
DataUNIXtimestamp.Caption := 'UNIX Timestamp: ' + IntToStr(UnixTimestamp);
|
DataUNIXtimestamp.Caption := 'UNIX Timestamp: ' + IntToStr(UnixTimestamp);
|
||||||
CreateGuid(Uid);
|
CreateGuid(Uid);
|
||||||
DataGUID.Caption := 'GUID: ' + GuidToString(Uid);
|
DataGUID.Caption := 'GUID: ' + GuidToString(Uid);
|
||||||
|
|
||||||
|
ColNum := DataGrid.FocusedColumn;
|
||||||
|
DataDefaultValue.Caption := 'Default: ?';
|
||||||
|
DataDefaultValue.Enabled := False;
|
||||||
|
if ColNum <> NOCOLUMN then begin
|
||||||
|
for Col in SelectedTableColumns do begin
|
||||||
|
if (Col.Name = DataGrid.Header.Columns[ColNum].Text) and (Col.DefaultType = cdtText) then begin
|
||||||
|
DataDefaultValue.Caption := 'Default: '+Col.DefaultText;
|
||||||
|
DataDefaultValue.Enabled := True;
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user