コード例 #1
0
ファイル: UserStatements.cs プロジェクト: deveel/deveeldb
        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);
        }
コード例 #2
0
ファイル: UserStatements.cs プロジェクト: deveel/deveeldb
        private static SetPasswordAction SetPassword(PlSqlParser.AlterUserIdActionContext context)
        {
            string password = null;
            if (context.byPassword() != null) {
                password = InputString.AsNotQuoted(context.byPassword().CHAR_STRING().GetText());
            } else if (context.externalId() != null) {
                throw new NotImplementedException();
            } else if (context.globalId() != null) {
                throw new NotImplementedException();
            } else {
                throw new ParseCanceledException();
            }

            return new SetPasswordAction(SqlExpression.Constant(password));
        }