Inheritance: IPreparable, ISerializable
        public CreateUserStatement(string userName, SqlUserIdentifier identifier)
        {
            if (identifier == null)
                throw new ArgumentNullException("identifier");
            if (String.IsNullOrEmpty(userName))
                throw new ArgumentNullException("userName");

            UserName = userName;
            Identifier = identifier;
        }
        public CreateUserStatement(string userName, SqlUserIdentifier identifier)
        {
            if (identifier == null)
            {
                throw new ArgumentNullException("identifier");
            }
            if (String.IsNullOrEmpty(userName))
            {
                throw new ArgumentNullException("userName");
            }

            UserName   = userName;
            Identifier = identifier;
        }
Exemple #3
0
        public static SqlStatement Create(PlSqlParser.CreateUserStatementContext context)
        {
            var userName = context.userName().GetText();
            SqlExpression arg;
            SqlIdentificationType type;
            if (context.byPassword() != null) {
                arg = SqlExpression.Constant(InputString.AsNotQuoted(context.byPassword().CHAR_STRING().GetText()));
                type = SqlIdentificationType.Password;
            } else if (context.externalId() != null) {
                arg = SqlExpression.Constant(InputString.AsNotQuoted(context.externalId().CHAR_STRING()));
                type = SqlIdentificationType.External;
            } else if (context.globalId() != null) {
                arg = SqlExpression.Constant(InputString.AsNotQuoted(context.globalId().CHAR_STRING()));
                type = SqlIdentificationType.Global;
            } else {
                throw new ParseCanceledException();
            }

            var id = new SqlUserIdentifier(type, arg);
            return new CreateUserStatement(userName, id);
        }