Пример #1
0
 static void PrintStatements(GrantService service)
 {
     foreach (string statement in service.Statements)
     {
         Console.WriteLine(statement);
     }
 }
Пример #2
0
        static int RunRevokeService(RevokeOptions options)
        {
            var dbInfo = DatabaseInfo.Parse(options.Database);

            GrantService service = new GrantService();

            service.Command          = Commands.Revoke;
            service.ConnectionString = dbInfo.GetConnectionString();
            return(RunService(service, options));
        }
Пример #3
0
        static int RunGrantService(GrantOptions options)
        {
            var dbInfo = DatabaseInfo.Parse(options.Database);

            GrantService service = new GrantService();

            service.Command          = Commands.Grant;
            service.WithAdminOption  = options.WithAdminOption;
            service.ConnectionString = dbInfo.GetConnectionString();
            return(RunService(service, options));
        }
Пример #4
0
        static int RunService(GrantService service, CommonOptions options)
        {
            service.PrepareStatements(options.User, options.Role);

            if (options.Execute)
            {
                service.ExecuteStatements();
            }
            else
            {
                PrintStatements(service);
            }

            return(0);
        }