public static void SinglePrivilege_WithNoGrantOption()
        {
            var statement = new GrantPrivilegesStatement("user1", Privileges.Select, ObjectName.Parse("t1"));

            var sql = statement.ToString();
            var expected = "GRANT SELECT TO user1 ON t1";
            Assert.AreEqual(expected, sql);
        }
Exemple #2
0
        public static void SinglePrivilege_WithNoGrantOption()
        {
            var statement = new GrantPrivilegesStatement("user1", Privileges.Select, ObjectName.Parse("t1"));

            var sql      = statement.ToString();
            var expected = "GRANT SELECT TO user1 ON t1";

            Assert.AreEqual(expected, sql);
        }
Exemple #3
0
        public static void MultiplePrivileges_WithGrantOption()
        {
            var privs     = Privileges.Update | Privileges.Insert;
            var statement = new GrantPrivilegesStatement("admin", privs, true, ObjectName.Parse("APP.test1"));

            var sql      = statement.ToString();
            var expected = "GRANT UPDATE, INSERT TO admin ON APP.test1 WITH GRANT OPTION";

            Assert.AreEqual(expected, sql);
        }
        public static void MultiplePrivileges_WithGrantOption()
        {
            var privs = Privileges.Update | Privileges.Insert;
            var statement = new GrantPrivilegesStatement("admin", privs, true, ObjectName.Parse("APP.test1"));

            var sql = statement.ToString();
            var expected = "GRANT UPDATE, INSERT TO admin ON APP.test1 WITH GRANT OPTION";

            Assert.AreEqual(expected, sql);
        }
Exemple #5
0
 protected virtual SqlStatement VisitGrantPrivilege(GrantPrivilegesStatement statement)
 {
     return new GrantPrivilegesStatement(statement.Grantee, statement.Privilege, statement.WithGrant, statement.ObjectName,
         statement.Columns);
 }
        public void GrantPrivilegesNoOption()
        {
            var privs = Privileges.Insert | Privileges.Update;
            var objName = ObjectName.Parse("APP.test_table1");
            var statement = new GrantPrivilegesStatement("user1", privs, objName);

            SerializeAndAssert(statement, (serialized, deserialized) => {
                Assert.IsNotNull(deserialized);
                Assert.IsNotNull(deserialized.ObjectName);
                Assert.IsNotNull(deserialized.Grantee);
                Assert.AreEqual(objName, deserialized.ObjectName);
                Assert.AreEqual("user1", deserialized.Grantee);
                Assert.AreEqual(privs, deserialized.Privilege);
                Assert.IsFalse(deserialized.WithGrant);
                Assert.IsNull(deserialized.Columns);
            });
        }
Exemple #7
0
 protected virtual SqlStatement VisitGrantPrivilege(GrantPrivilegesStatement statement)
 {
     return(new GrantPrivilegesStatement(statement.Grantee, statement.Privilege, statement.WithGrant, statement.ObjectName,
                                         statement.Columns));
 }