Example #1
0
        public void SqlSelectClauseBuilderTest()
        {
            var selectBuilder = new SqlSelectClauseBuilder(this._tableName, SelectClauseBuildMode.StringWithAlias);

            foreach (var field in this._fields)
            {
                selectBuilder.AddField(field.Item1, field.Item2);
            }

            var selectResult = selectBuilder.ToString();

            Assert.IsTrue(String.IsNullOrWhiteSpace(selectResult), selectResult);
        }
Example #2
0
        public void SqlClauseBuilderTest()
        {
            var selectBuilder = new SqlSelectClauseBuilder(this._tableName, SelectClauseBuildMode.StringWithAlias);

            foreach (var field in this._fields)
            {
                selectBuilder.AddField(field.Item1, field.Item2);
            }

            var whereBuilder = new SqlWhereClauseBuilder();

            this._operators.ForEach(o =>
            {
                whereBuilder.AddParameterValue(o.Item1, o.Item2, o.Item3);
            });

            var sqlResult = selectBuilder.ToString() + whereBuilder.ToString();

            Assert.IsNull(sqlResult, sqlResult);
        }
        /// <summary>
        /// 重写,将元素的 SQL 转换查询数据数量的 SQL 语句
        /// </summary>
        /// <returns><see cref="System.String"/></returns>
        public override string ToString()
        {
            var sqlClauseBuilder = new SqlSelectClauseBuilder(this._sqlQuery);

            return(sqlClauseBuilder.BuildSelectCountClause());
        }
 /// <summary>
 /// 重写,将元素的 SQL 转换查询数据数量的 SQL 语句
 /// </summary>
 /// <returns><see cref="System.String"/></returns>
 public override string ToString()
 {
     var sqlClauseBuilder = new SqlSelectClauseBuilder(this._sqlQuery);
     return sqlClauseBuilder.BuildSelectCountClause();
 }