Exemple #1
0
        public void testOrderByClauseUnspecified()
        {
            var transformer = new StandardPagingTransformer(5, 10, null);
            var parser      = new DomaSqlParser("select * from emp");
            var ex          = Assert.Throws <SqlTransformException>(() => transformer.Transform(parser.Parse()));

            ex.IsNotNull();
            ex.MessageId.Is(ExceptionMessageId.Esp2201);
        }
Exemple #2
0
        public void testLimitOnly()
        {
            var expected =
                "select * from ( select temp_.*, row_number() over( order by temp_.id ) as esp_rownumber_ from ( select emp.id from emp ) as temp_ ) as temp2_ where esp_rownumber_ <= 10";
            var transformer = new StandardPagingTransformer(-1, 10, null);
            var parser      = new DomaSqlParser("select emp.id from emp order by emp.id");
            var node        = transformer.Transform(parser.Parse());
            var parameters  = new List <ParameterEmulator>();
            var builder     = new DomaSqlBuilder(node, parameters, _config);
            var result      = builder.Build();

            result.ParsedSql.Is(expected);
        }
        internal virtual ISqlNode ToPagingSqlNode(ISqlNode node, long offset, long limit, string rowNumberColumn)
        {
            var transformer = new StandardPagingTransformer(offset, limit, rowNumberColumn);

            return(transformer.Transform(node));
        }