mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Quote db and table name in new function TDBObject.QuotedDbAndTableName, which also adds "dbo" for MS SQL inbetween. Plus, run SELECT in SQL export through ApplyLimitClause, to fix an SQL error on MS SQL. See http://www.heidisql.com/forum.php?t=11956
This commit is contained in:
@ -36,6 +36,7 @@ type
|
||||
function IsSameAs(CompareTo: TDBObject): Boolean;
|
||||
function QuotedDatabase(AlwaysQuote: Boolean=True): String;
|
||||
function QuotedName(AlwaysQuote: Boolean=True): String;
|
||||
function QuotedDbAndTableName(AlwaysQuote: Boolean=True): String;
|
||||
function QuotedColumn(AlwaysQuote: Boolean=True): String;
|
||||
property ObjType: String read GetObjType;
|
||||
property ImageIndex: Integer read GetImageIndex;
|
||||
@ -4642,9 +4643,13 @@ var
|
||||
db: String;
|
||||
begin
|
||||
// Return `db`.`table` if necessairy, otherwise `table`
|
||||
Result := '';
|
||||
db := DatabaseName;
|
||||
if Connection.Database <> db then
|
||||
if Connection.Database <> db then begin
|
||||
Result := Connection.QuoteIdent(db)+'.';
|
||||
if Connection.Parameters.NetTypeGroup = ngMSSQL then
|
||||
Result := Result + Connection.QuoteIdent('dbo')+'.';
|
||||
end;
|
||||
Result := Result + Connection.QuoteIdent(TableName);
|
||||
end;
|
||||
|
||||
@ -4964,6 +4969,14 @@ begin
|
||||
Result := Connection.QuoteIdent(Name, AlwaysQuote);
|
||||
end;
|
||||
|
||||
function TDBObject.QuotedDbAndTableName(AlwaysQuote: Boolean=True): String;
|
||||
begin
|
||||
Result := QuotedDatabase(AlwaysQuote) + '.';
|
||||
if Connection.Parameters.NetTypeGroup = ngMSSQL then
|
||||
Result := Result + Connection.QuoteIdent('dbo', AlwaysQuote) + '.';
|
||||
Result := Result + QuotedName(AlwaysQuote);
|
||||
end;
|
||||
|
||||
function TDBObject.QuotedColumn(AlwaysQuote: Boolean=True): String;
|
||||
begin
|
||||
Result := Connection.QuoteIdent(Column, AlwaysQuote);
|
||||
|
Reference in New Issue
Block a user