Skip to content
Permalink
Browse files

Fix some crashes, where the caller frees the result of GetTableColumn…

…s/Keys/ForeignKeys. Probably fixes #849 and #848
  • Loading branch information
ansgarbecker committed Jan 13, 2020
1 parent 6f314a2 commit 094f65e573988b996713d2061fffa26d071224f4
Showing with 10 additions and 7 deletions.
  1. +10 −7 source/dbconnection.pas
@@ -4661,7 +4661,7 @@ function TAdoDBConnection.GetTableColumns(Table: TDBObject): TTableColumnList;
for TableCol in Result do begin
if TableCol.Name = Comments.Col('column') then begin
TableCol.Comment := Comments.Col('comment');
Break;
Break;
end;
end;
Comments.Next;
@@ -8589,28 +8589,31 @@ procedure TDBObject.Drop;
function TDBObject.GetTableColumns: TTableColumnList;
begin
// Return columns from table object
if not Assigned(FTableColumns) then begin
Result := Connection.GetTableColumns(Self);
{if not Assigned(FTableColumns) then begin
FTableColumns := Connection.GetTableColumns(Self);
end;
Result := FTableColumns;
Result := FTableColumns;}
end;

function TDBObject.GetTableKeys: TTableKeyList;
begin
// Return keys from table object
if not Assigned(FTableKeys) then begin
Result := Connection.GetTableKeys(Self);
{if not Assigned(FTableKeys) then begin
FTableKeys := Connection.GetTableKeys(Self);
end;
Result := FTableKeys;
Result := FTableKeys;}
end;

function TDBObject.GetTableForeignKeys: TForeignKeyList;
begin
// Return foreign keys from table object
if not Assigned(FTableForeignKeys) then begin
Result := Connection.GetTableForeignKeys(Self);
{if not Assigned(FTableForeignKeys) then begin
FTableForeignKeys := Connection.GetTableForeignKeys(Self);
end;
Result := FTableForeignKeys;
Result := FTableForeignKeys;}
end;


0 comments on commit 094f65e

Please sign in to comment.
You can’t perform that action at this time.