Example #1
0
        public async Task <int> Count(SqlessCountRequest request)
        {
            await OpenSqlConnection();

            SqlessCountSqlBuilder selectSqlProducer = new SqlessCountSqlBuilder(this, request);

            return(await selectSqlProducer.ExecuteScalarAsync <int>());
        }
Example #2
0
        public async Task CountDistinctSqlTest()
        {
            using Sqless sqless = new Sqless(Global.AllowUnspecifiedConfig);
            SqlessCountSqlBuilder producer = new SqlessCountSqlBuilder(sqless, SqlessCountDistinctRequest);
            var sqlStr = await producer.GetSqlStrTest();

            Assert.AreEqual(sqlStr.Replace("  ", " ").Trim(), "SELECT COUNT(DISTINCT [Uid]) FROM [User]");
        }