Skip to content

Commit e33ea1d

Browse files
committed
fix: two more exception causes found in uploaded reports
1 parent c9eb765 commit e33ea1d

2 files changed

Lines changed: 24 additions & 18 deletions

File tree

source/exportgrid.pas

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,10 @@ procedure TfrmExportGrid.CalcSize(Sender: TObject);
473473
CalculatedCount, SelectedCount, AllCount: Int64;
474474
begin
475475
GridData := Mainform.GridResult(Grid);
476+
if not Assigned(GridData) then begin
477+
MainForm.LogSQL('Failed to get current results');
478+
Exit;
479+
end;
476480
AllSize := 0;
477481
SelectedSize := 0;
478482
chkIncludeAutoIncrement.Enabled := GridData.AutoIncrementColumn > -1;

source/main.pas

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7567,24 +7567,26 @@ procedure TMainForm.QuickFilterClick(Sender: TObject);
75677567
if ExecRegExpr('Prompt\d+$', Act.Name) then begin
75687568
// Item needs prompt
75697569
TableCol := SelectedTableFocusedColumn;
7570-
Col := Conn.QuoteIdent(TableCol.Name, False);
7571-
7572-
if (TableCol.DataType.Index = dbdtJson)
7573-
and (Conn.Parameters.NetTypeGroup = ngPgSQL) then begin
7574-
Col := Col + '::text';
7575-
end;
7576-
Val := DataGrid.Text[DataGrid.FocusedNode, DataGrid.FocusedColumn];
7577-
if InputQuery(_('Specify filter-value...'), Act.Caption, Val) then begin
7578-
if Act = actQuickFilterPrompt1 then
7579-
Filter := Col + ' = ' + Conn.EscapeString(Val, TableCol.DataType)
7580-
else if Act = actQuickFilterPrompt2 then
7581-
Filter := Col + ' != ' + Conn.EscapeString(Val, TableCol.DataType)
7582-
else if Act = actQuickFilterPrompt3 then
7583-
Filter := Col + ' > ' + Conn.EscapeString(Val, TableCol.DataType)
7584-
else if Act = actQuickFilterPrompt4 then
7585-
Filter := Col + ' < ' + Conn.EscapeString(Val, TableCol.DataType)
7586-
else if Act = actQuickFilterPrompt5 then
7587-
Filter := Conn.SqlProvider.GetSql(qLikeCompare, [Col, Conn.EscapeString('%'+Val+'%', TableCol.DataType)]);
7570+
if Assigned(TableCol) then begin
7571+
Col := Conn.QuoteIdent(TableCol.Name, False);
7572+
7573+
if (TableCol.DataType.Index = dbdtJson)
7574+
and (Conn.Parameters.NetTypeGroup = ngPgSQL) then begin
7575+
Col := Col + '::text';
7576+
end;
7577+
Val := DataGrid.Text[DataGrid.FocusedNode, DataGrid.FocusedColumn];
7578+
if InputQuery(_('Specify filter-value...'), Act.Caption, Val) then begin
7579+
if Act = actQuickFilterPrompt1 then
7580+
Filter := Col + ' = ' + Conn.EscapeString(Val, TableCol.DataType)
7581+
else if Act = actQuickFilterPrompt2 then
7582+
Filter := Col + ' != ' + Conn.EscapeString(Val, TableCol.DataType)
7583+
else if Act = actQuickFilterPrompt3 then
7584+
Filter := Col + ' > ' + Conn.EscapeString(Val, TableCol.DataType)
7585+
else if Act = actQuickFilterPrompt4 then
7586+
Filter := Col + ' < ' + Conn.EscapeString(Val, TableCol.DataType)
7587+
else if Act = actQuickFilterPrompt5 then
7588+
Filter := Conn.SqlProvider.GetSql(qLikeCompare, [Col, Conn.EscapeString('%'+Val+'%', TableCol.DataType)]);
7589+
end;
75887590
end;
75897591
end
75907592
else begin

0 commit comments

Comments
 (0)