escape value of current column before following to foreign key

This commit is contained in:
DungSaga
2022-04-29 07:13:42 +07:00
parent c6c6497b07
commit 85e86787f6

View File

@@ -11284,12 +11284,12 @@ var
Results: TDBQuery;
RowNum: PInt64;
FocusedValue, FocusedColumnName, ForeignColumnName, ReferenceTable: String;
HasNulls: Boolean;
ForeignKey: TForeignKey;
i: Integer;
PDBObj: PDBObject;
DBObj: TDBObject;
Node: PVirtualNode;
Datatype: TDBDatatype;
begin
CurrentControl := Screen.ActiveControl;
Grid := CurrentControl as TVirtualStringTree;
@@ -11302,7 +11302,7 @@ begin
//find foreign key for current column
for ForeignKey in ActiveDBObj.TableForeignKeys do begin
i := ForeignKey.Columns.IndexOf(DataGrid.Header.Columns[Grid.FocusedColumn].Text);
i := ForeignKey.Columns.IndexOf(Grid.Header.Columns[Grid.FocusedColumn].Text);
if i > -1 then begin
ForeignColumnName := ForeignKey.ForeignColumns[i];
ReferenceTable := ForeignKey.ReferenceTable;
@@ -11324,9 +11324,10 @@ begin
end;
Node := GetNextNode(ListTables, Node);
end;
Datatype := ActiveDBObj.TableColumns[Grid.FocusedColumn].DataType;
// filter to show only rows linked by the foreign key
SynMemoFilter.UndoList.AddGroupBreak;
SynMemoFilter.Text := ForeignColumnName + ' = "' + FocusedValue + '"';
SynMemoFilter.Text := Results.Connection.QuoteIdent(ForeignColumnName, False) + '=' + Results.Connection.EscapeString(FocusedValue, Datatype);
ToggleFilterPanel(True);
actApplyFilter.Execute;
// SynMemoFilter will be cleared and set value of asFilter (in HandleDataGridAttributes from DataGridBeforePaint)