mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 11:17:57 +08:00
Ensure SQL list has the same number of items as result list has, to avoid AVs when SELECT returned an error. See http://www.heidisql.com/forum.php?t=6824
This commit is contained in:
@ -554,9 +554,9 @@ procedure TfrmTableTools.DoFind(DBObj: TDBObject);
|
|||||||
var
|
var
|
||||||
Columns: TTableColumnList;
|
Columns: TTableColumnList;
|
||||||
Col: TTableColumn;
|
Col: TTableColumn;
|
||||||
SQL, ResultSQL, Dummy: String;
|
SQL, Dummy: String;
|
||||||
begin
|
begin
|
||||||
ResultSQL := '';
|
FFindSeeResultSQL.Add('');
|
||||||
Columns := TTableColumnList.Create(True);
|
Columns := TTableColumnList.Create(True);
|
||||||
case DBObj.NodeType of
|
case DBObj.NodeType of
|
||||||
lntTable: DBObj.Connection.ParseTableStructure(DBObj.CreateCode, Columns, nil, nil);
|
lntTable: DBObj.Connection.ParseTableStructure(DBObj.CreateCode, Columns, nil, nil);
|
||||||
@ -575,7 +575,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
if SQL <> '' then begin
|
if SQL <> '' then begin
|
||||||
Delete(SQL, Length(SQL)-3, 3);
|
Delete(SQL, Length(SQL)-3, 3);
|
||||||
ResultSQL := 'SELECT * FROM '+Mainform.mask(DBObj.Database)+'.'+Mainform.mask(DBObj.Name)+' WHERE ' + SQL;
|
FFindSeeResultSQL[FFindSeeResultSQL.Count-1] := 'SELECT * FROM '+Mainform.mask(DBObj.Database)+'.'+Mainform.mask(DBObj.Name)+' WHERE ' + SQL;
|
||||||
SQL := 'SELECT '''+DBObj.Database+''' AS `Database`, '''+DBObj.Name+''' AS `Table`, COUNT(*) AS `Found rows`, '
|
SQL := 'SELECT '''+DBObj.Database+''' AS `Database`, '''+DBObj.Name+''' AS `Table`, COUNT(*) AS `Found rows`, '
|
||||||
+ 'CONCAT(ROUND(100 / '+IntToStr(Max(DBObj.Rows,1))+' * COUNT(*), 1), ''%'') AS `Relevance` FROM '+Mainform.mask(DBObj.Database)+'.'+Mainform.mask(DBObj.Name)+' WHERE '
|
+ 'CONCAT(ROUND(100 / '+IntToStr(Max(DBObj.Rows,1))+' * COUNT(*), 1), ''%'') AS `Relevance` FROM '+Mainform.mask(DBObj.Database)+'.'+Mainform.mask(DBObj.Name)+' WHERE '
|
||||||
+ SQL;
|
+ SQL;
|
||||||
@ -584,7 +584,6 @@ begin
|
|||||||
AddNotes(DBObj.Database, DBObj.Name, STRSKIPPED+DBObj.ObjType+' doesn''t have columns of selected type ('+comboDatatypes.Text+').', '');
|
AddNotes(DBObj.Database, DBObj.Name, STRSKIPPED+DBObj.ObjType+' doesn''t have columns of selected type ('+comboDatatypes.Text+').', '');
|
||||||
end;
|
end;
|
||||||
Columns.Free;
|
Columns.Free;
|
||||||
FFindSeeResultSQL.Add(ResultSQL);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user