From 216f097d9c6f2bf564d9d29519e32bcbe6793d64 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Wed, 9 Feb 2011 23:22:48 +0000 Subject: [PATCH] Servers up to 5.0.6 do not support the object type in a GRANT or REVOKE query. See http://www.heidisql.com/forum.php?t=7753 --- source/usermanager.pas | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/source/usermanager.pas b/source/usermanager.pas index c646f3ef..54d7dc05 100644 --- a/source/usermanager.pas +++ b/source/usermanager.pas @@ -911,6 +911,15 @@ var P: TPrivObj; i: Integer; PasswordSet: Boolean; + + function GetObjectType(ObjType: String): String; + begin + // Decide if object type can be part of a GRANT or REVOKE query + Result := ''; + if Conn.ServerVersionInt >= 50006 then + Result := UpperCase(ObjType) + ' '; + end; + begin // Save changes Conn := MainForm.ActiveConnection; @@ -954,9 +963,9 @@ begin lntDb: OnObj := QuoteIdent(P.DBObj.Database) + '.*'; lntTable, lntFunction, lntProcedure: - OnObj := UpperCase(P.DBObj.ObjType) + ' ' + QuoteIdent(P.DBObj.Database) + '.' + QuoteIdent(P.DBObj.Name); + OnObj := GetObjectType(P.DBObj.ObjType) + QuoteIdent(P.DBObj.Database) + '.' + QuoteIdent(P.DBObj.Name); lntColumn: - OnObj := 'TABLE ' + QuoteIdent(P.DBObj.Database) + '.' + QuoteIdent(P.DBObj.Name); + OnObj := GetObjectType('TABLE') + QuoteIdent(P.DBObj.Database) + '.' + QuoteIdent(P.DBObj.Name); else raise Exception.Create('Unhandled privilege object: '+P.DBObj.ObjType); end;