diff --git a/source/tabletools.lfm b/source/tabletools.lfm index e45b86cf..bb881ebd 100644 --- a/source/tabletools.lfm +++ b/source/tabletools.lfm @@ -80,8 +80,8 @@ object frmTableTools: TfrmTableTools TabOrder = 0 object ResultGrid: TLazVirtualStringTree Left = 0 - Height = 189 - Top = 241 + Height = 192 + Top = 238 Width = 707 Align = alClient Header.AutoSizeIndex = -1 @@ -105,18 +105,19 @@ object frmTableTools: TfrmTableTools end object tabsTools: TPageControl Left = 0 - Height = 241 + Height = 238 Top = 0 Width = 707 ActivePage = tabMaintenance Align = alTop + AutoSize = True Images = MainForm.ImageListIcons8 TabIndex = 0 TabOrder = 1 OnChange = ValidateControls object tabMaintenance: TTabSheet Caption = 'Maintenance' - ClientHeight = 208 + ClientHeight = 205 ClientWidth = 699 ImageIndex = 39 object lblOperation: TLabel @@ -274,7 +275,7 @@ object frmTableTools: TfrmTableTools end object tabFind: TTabSheet Caption = 'Find text' - ClientHeight = 208 + ClientHeight = 205 ClientWidth = 699 ImageIndex = 30 object lblFindText: TLabel @@ -492,7 +493,7 @@ object frmTableTools: TfrmTableTools end object tabSQLexport: TTabSheet Caption = 'SQL export' - ClientHeight = 208 + ClientHeight = 205 ClientWidth = 699 ImageIndex = 9 object lblExportData: TLabel @@ -727,7 +728,7 @@ object frmTableTools: TfrmTableTools end object tabBulkTableEdit: TTabSheet Caption = 'Bulk table editor' - ClientHeight = 208 + ClientHeight = 205 ClientWidth = 699 ImageIndex = 19 object chkBulkTableEditDatabase: TCheckBox @@ -871,7 +872,7 @@ object frmTableTools: TfrmTableTools end object tabGenerateData: TTabSheet Caption = 'Generate data' - ClientHeight = 208 + ClientHeight = 205 ClientWidth = 699 ImageIndex = 130 object lblGenerateDataNumRows: TLabel diff --git a/source/tabletools.pas b/source/tabletools.pas index 301b13c6..d1d8be97 100644 --- a/source/tabletools.pas +++ b/source/tabletools.pas @@ -2227,6 +2227,7 @@ var EnumValues: TStringList; TextVal: String; BinVal: String; + NumRows, NullsAmount: Int64; begin // Generate rows if not (DBObj.NodeType in [lntTable, lntView]) then begin @@ -2258,7 +2259,10 @@ begin Randomize; - for i:=1 to StrToInt64Def(editGenerateDataNumRows.Text, 0) do begin + NumRows := StrToInt64Def(editGenerateDataNumRows.Text, 0); + NullsAmount := StrToInt64Def(editGenerateDataNullAmount.Text, 0); + + for i:=1 to NumRows do begin Values.Clear; // Generate random values. Include some NULLs for columns which allow that. for Col in Columns do begin @@ -2267,8 +2271,8 @@ begin // https://www.delphipraxis.net/31059-warscheinlichkeit-random.html if Col.AllowNull - and (StrToInt64Def(editGenerateDataNullAmount.Text, 0) > 0) // prevent division by zero - and (Random < (StrToInt64Def(editGenerateDataNullAmount.Text, 0) / 100)) + and (NullsAmount > 0) // prevent division by zero + and (Random < (NullsAmount / 100)) then begin Values.Add('NULL'); Continue;