mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-16 11:42:12 +08:00
Use table name from helper TDBObject in TDBQuery.PrepareEditing, as TMySQLQuery.TableName does not return the VIEW's name when the VIEW contains aggregated columns. Fixes issue #3284.
This commit is contained in:
@ -4416,7 +4416,7 @@ end;
|
|||||||
|
|
||||||
procedure TDBQuery.PrepareEditing;
|
procedure TDBQuery.PrepareEditing;
|
||||||
var
|
var
|
||||||
CreateCode, Dummy, DB, Schema: String;
|
CreateCode, Dummy, DB, ObjName, Schema: String;
|
||||||
DBObjects: TDBObjectList;
|
DBObjects: TDBObjectList;
|
||||||
Obj: TDBObject;
|
Obj: TDBObject;
|
||||||
ObjType: TListNodeType;
|
ObjType: TListNodeType;
|
||||||
@ -4429,6 +4429,7 @@ begin
|
|||||||
if FDBObject <> nil then begin
|
if FDBObject <> nil then begin
|
||||||
Schema := FDBObject.Schema;
|
Schema := FDBObject.Schema;
|
||||||
ObjType := FDBObject.NodeType;
|
ObjType := FDBObject.NodeType;
|
||||||
|
ObjName := FDBObject.Name;
|
||||||
end else begin
|
end else begin
|
||||||
DB := DatabaseName;
|
DB := DatabaseName;
|
||||||
if DB = '' then
|
if DB = '' then
|
||||||
@ -4439,12 +4440,13 @@ begin
|
|||||||
for Obj in DBObjects do begin
|
for Obj in DBObjects do begin
|
||||||
if (Obj.NodeType in [lntTable, lntView]) and (Obj.Name = TableName) then begin
|
if (Obj.NodeType in [lntTable, lntView]) and (Obj.Name = TableName) then begin
|
||||||
ObjType := Obj.NodeType;
|
ObjType := Obj.NodeType;
|
||||||
|
ObjName := Obj.Name;
|
||||||
Schema := Obj.Schema;
|
Schema := Obj.Schema;
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
CreateCode := Connection.GetCreateCode(DatabaseName, Schema, TableName, ObjType);
|
CreateCode := Connection.GetCreateCode(DatabaseName, Schema, ObjName, ObjType);
|
||||||
FColumns := TTableColumnList.Create;
|
FColumns := TTableColumnList.Create;
|
||||||
FKeys := TTableKeyList.Create;
|
FKeys := TTableKeyList.Create;
|
||||||
FForeignKeys := TForeignKeyList.Create;
|
FForeignKeys := TForeignKeyList.Create;
|
||||||
@ -4452,7 +4454,7 @@ begin
|
|||||||
lntTable:
|
lntTable:
|
||||||
Connection.ParseTableStructure(CreateCode, FColumns, FKeys, FForeignKeys);
|
Connection.ParseTableStructure(CreateCode, FColumns, FKeys, FForeignKeys);
|
||||||
lntView:
|
lntView:
|
||||||
Connection.ParseViewStructure(CreateCode, TableName, FColumns, Dummy, Dummy, Dummy, Dummy, Dummy);
|
Connection.ParseViewStructure(CreateCode, ObjName, FColumns, Dummy, Dummy, Dummy, Dummy, Dummy);
|
||||||
end;
|
end;
|
||||||
FreeAndNil(FUpdateData);
|
FreeAndNil(FUpdateData);
|
||||||
FUpdateData := TUpdateData.Create(True);
|
FUpdateData := TUpdateData.Create(True);
|
||||||
|
Reference in New Issue
Block a user