Esempio n. 1
0
        private static void log(Compiler compiler, Query query)
        {
            SqlResult compiled = compiler.Compile(query);

            Console.WriteLine(compiled.ToString());
            Console.WriteLine(JsonConvert.SerializeObject(compiled.Bindings));
        }
        public void OffsetSqlServer_Should_Be_Ignored_If_Zero_Or_Negative(int offset)
        {
            Query     query  = new Query().From("users").Offset(offset);
            SqlResult result = Compilers.CompileFor(EngineCodes.SqlServer, query);

            Assert.Equal("SELECT * FROM [users]", result.ToString());
        }
Esempio n. 3
0
        private static string ToRawSQL(Query query)
        {
            var       compiler = new PostgresCompiler();
            SqlResult result   = compiler.Compile(query);

            return(result.ToString());
        }
        public void OffsetSqlServer_Should_Be_Incremented_By_One(int offset)
        {
            Query     query  = new Query().From("users").Offset(offset);
            SqlResult result = Compilers.CompileFor(EngineCodes.SqlServer, query);

            Assert.Equal(
                "SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY (SELECT 0)) AS [row_num] FROM [users]) AS [results_wrapper] WHERE [row_num] >= " +
                (offset + 1), result.ToString());
        }