SynEdit: add SQL dialect for MSSQL 2022. Issue #41543 Patch by paweld

This commit is contained in:
Martin 2025-03-23 11:14:05 +01:00
parent 822c0a1667
commit 84a59bc88a

View File

@ -69,7 +69,7 @@ type
TSQLDialect = (sqlStandard, sqlInterbase6, sqlMSSQL7, sqlMySQL, sqlOracle, TSQLDialect = (sqlStandard, sqlInterbase6, sqlMSSQL7, sqlMySQL, sqlOracle,
sqlSybase, sqlIngres, sqlMSSQL2K, sqlPostgres, sqlSQLite, // JJV 2000-11-16 sqlSybase, sqlIngres, sqlMSSQL2K, sqlPostgres, sqlSQLite, // JJV 2000-11-16
sqlFirebird25, sqlFirebird30, sqlFirebird40, sqlMSSQL); sqlFirebird25, sqlFirebird30, sqlFirebird40, sqlMSSQL2022);
type type
PIdentifierTable = ^TIdentifierTable; PIdentifierTable = ^TIdentifierTable;
@ -1729,7 +1729,7 @@ var
i: integer; i: integer;
begin begin
// MS SQL uses @@ to indicate system functions/variables // MS SQL uses @@ to indicate system functions/variables
if (fDialect in [sqlMSSQL7, sqlMSSQL2K, sqlMSSQL]) and (fLine[Run] = '@') and (fLine[Run + 1] = '@') if (fDialect in [sqlMSSQL7, sqlMSSQL2K, sqlMSSQL2022]) and (fLine[Run] = '@') and (fLine[Run + 1] = '@')
then then
IdentProc IdentProc
{begin} //JDR 2000-25-2000 {begin} //JDR 2000-25-2000
@ -1919,7 +1919,7 @@ end;
function TSynSQLSyn.GetIdentChars: TSynIdentChars; function TSynSQLSyn.GetIdentChars: TSynIdentChars;
begin begin
Result := TSynValidStringChars; Result := TSynValidStringChars;
if (fDialect in [sqlMSSQL7, sqlMSSQL2K, sqlMSSQL]) then if (fDialect in [sqlMSSQL7, sqlMSSQL2K, sqlMSSQL2022]) then
Include(Result, '@') Include(Result, '@')
{begin} // DJLP 2000-08-11 {begin} // DJLP 2000-08-11
else if fDialect = sqlOracle then begin else if fDialect = sqlOracle then begin
@ -1977,7 +1977,7 @@ end;
procedure TSynSQLSyn.InitializeKeywordLists; procedure TSynSQLSyn.InitializeKeywordLists;
begin begin
fKeywords.Clear; fKeywords.Clear;
if (fDialect in [sqlMSSQL7, sqlMSSQL2K, sqlMSSQL]) then if (fDialect in [sqlMSSQL7, sqlMSSQL2K, sqlMSSQL2022]) then
begin begin
fIdentifiersPtr := @IdentifiersMSSQL7; fIdentifiersPtr := @IdentifiersMSSQL7;
fmHashTablePtr := @mHashTableMSSQL7; fmHashTablePtr := @mHashTableMSSQL7;
@ -2035,7 +2035,7 @@ begin
EnumerateKeywords(ord(tkDataType), MSSQL2000Types, IdentChars, @DoAddKeyword); EnumerateKeywords(ord(tkDataType), MSSQL2000Types, IdentChars, @DoAddKeyword);
EnumerateKeywords(ord(tkFunction), MSSQL2000Functions, IdentChars, @DoAddKeyword); EnumerateKeywords(ord(tkFunction), MSSQL2000Functions, IdentChars, @DoAddKeyword);
end; end;
sqlMSSQL: sqlMSSQL2022:
begin begin
EnumerateKeywords(Ord(tkKey), MSSQLKW, IdentChars, @DoAddKeyword); EnumerateKeywords(Ord(tkKey), MSSQLKW, IdentChars, @DoAddKeyword);
EnumerateKeywords(Ord(tkDatatype), MSSQLTypes, IdentChars, @DoAddKeyword); EnumerateKeywords(Ord(tkDatatype), MSSQLTypes, IdentChars, @DoAddKeyword);
@ -2215,7 +2215,7 @@ begin
#13#10 + #13#10 +
' SELECT SCOPE_IDENTITY()'#13#10 + ' SELECT SCOPE_IDENTITY()'#13#10 +
'GO'; 'GO';
sqlMSSQL: sqlMSSQL2022:
Result := '/* SQL Server example source */'#13#10 + Result := '/* SQL Server example source */'#13#10 +
'SET QUOTED_IDENTIFIER OFF'#13#10 + 'SET QUOTED_IDENTIFIER OFF'#13#10 +
'GO'#13#10 + 'GO'#13#10 +