From bdaddea7ea0d848d1370aef4a1f1bed864a3d415 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Mon, 11 Jan 2016 20:59:34 +0000 Subject: [PATCH] Revert r5038 - quoting all columns again now. Reserved words like "interval" are not detected in EscapeString(), so this just a source of new bugs. Thanks to Vadim for his hint! --- source/main.pas | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/main.pas b/source/main.pas index ff0a3bd1..1d355598 100644 --- a/source/main.pas +++ b/source/main.pas @@ -4787,16 +4787,16 @@ begin and ((ColLen > GRIDMAXDATA) or (ColLen = 0)) // No need to blow SQL with LEFT() if column is shorter anyway then begin case DBObj.Connection.Parameters.NetTypeGroup of - ngMSSQL: Select := Select + ' LEFT(CAST(' + DBObj.Connection.QuoteIdent(c.Name, False) + ' AS NVARCHAR('+IntToStr(GRIDMAXDATA)+')), ' + IntToStr(GRIDMAXDATA) + '), '; - ngMySQL: Select := Select + ' LEFT(' + DBObj.Connection.QuoteIdent(c.Name, False) + ', ' + IntToStr(GRIDMAXDATA) + '), '; - ngPgSQL: Select := Select + ' SUBSTR(' + DBObj.Connection.QuoteIdent(c.Name, False) + ', 1, ' + IntToStr(GRIDMAXDATA) + '), '; + ngMSSQL: Select := Select + ' LEFT(CAST(' + DBObj.Connection.QuoteIdent(c.Name) + ' AS NVARCHAR('+IntToStr(GRIDMAXDATA)+')), ' + IntToStr(GRIDMAXDATA) + '), '; + ngMySQL: Select := Select + ' LEFT(' + DBObj.Connection.QuoteIdent(c.Name) + ', ' + IntToStr(GRIDMAXDATA) + '), '; + ngPgSQL: Select := Select + ' SUBSTR(' + DBObj.Connection.QuoteIdent(c.Name) + ', 1, ' + IntToStr(GRIDMAXDATA) + '), '; end; end else if DBObj.Connection.Parameters.IsMSSQL and (c.DataType.Index=dtTimestamp) then begin - Select := Select + ' CAST(' + DBObj.Connection.QuoteIdent(c.Name, False) + ' AS INT), '; + Select := Select + ' CAST(' + DBObj.Connection.QuoteIdent(c.Name) + ' AS INT), '; end else if DBObj.Connection.Parameters.IsMSSQL and (c.DataType.Index=dtHierarchyid) then begin - Select := Select + ' CAST(' + DBObj.Connection.QuoteIdent(c.Name, False) + ' AS NVARCHAR('+IntToStr(GRIDMAXDATA)+')), '; + Select := Select + ' CAST(' + DBObj.Connection.QuoteIdent(c.Name) + ' AS NVARCHAR('+IntToStr(GRIDMAXDATA)+')), '; end else begin - Select := Select + ' ' + DBObj.Connection.QuoteIdent(c.Name, False) + ', '; + Select := Select + ' ' + DBObj.Connection.QuoteIdent(c.Name) + ', '; Inc(FullColumnCount); end; WantedColumns.Add(c);