public void Select(string tableName, string fieldName, SelectFunction selectFunction, string alias = null)
        {
            string selectionString = null;

            if (string.IsNullOrEmpty(alias))
            {
                selectionString = string.Format("{0}({1})", selectFunction.ToString(), Adapter.Field(tableName, fieldName));
            }
            else
            {
                selectionString = string.Format("{0}({1}) AS {2}", selectFunction.ToString(), Adapter.Field(tableName, fieldName), alias);
            }
            _selectionList.Add(selectionString);
        }
示例#2
0
        public string AddHaving(string tableName, string fieldName, SelectFunction selectFunction, string opr, string parameter)
        {
            var func = selectFunction.ToString();

            _componentList.Add(string.Format("{2}({0}.{1}) {3} {4}", tableName, fieldName, func, opr, _adapter.Parameter(parameter)));
            return(parameter);
        }
示例#3
0
        internal void Aggregate(LambdaExpression expression, SelectFunction selectFunction)
        {
            expression.ThrowIfNull(nameof(expression));

            var fieldName  = TableInfo.GetColumnName(expression.Body.GetMemberExpression());
            var memberNode = new MemberNode {
                TableName = TableName, FieldName = fieldName
            };
            var selectionString = SqlFormatter.SelectAggregate(memberNode, selectFunction.ToString());

            Context.Selection.Add(selectionString);
        }
        public void Select(string tableName, string fieldName, SelectFunction selectFunction, string aliasName)
        {
            string name = string.IsNullOrEmpty(aliasName) ? fieldName : aliasName;

            name = _adapter.Field(name);

            var fname = fieldName;

            if (fieldName != "*")
            {
                fname = _adapter.Field(tableName, fieldName);
            }
            var selectionString = string.Format("{0}({1}) AS {2}", selectFunction.ToString(), fname, name);

            _selectionList.Add(selectionString);
        }
示例#5
0
        internal void Select(string tableName, string columnName, SelectFunction selectFunction, string tableAlias, string columnAlias)
        {
            var functionNoHasColumnName  = !String.IsNullOrEmpty(columnName);
            var functionName             = selectFunction.ToString();
            var existsAlias              = !String.IsNullOrEmpty(columnAlias);
            var tableNameToUse           = String.IsNullOrEmpty(tableAlias) ? tableName : tableAlias;
            var columnNameToUserFunction = functionNoHasColumnName ? _sqlAdapter.GetColumnName(tableNameToUse, columnName) : "1";
            var functionClause           = new StringBuilder($"{functionName.ToUpper()}({columnNameToUserFunction}) ");

            if (existsAlias)
            {
                functionClause.Append($"AS {columnAlias} ");
            }

            _sqlQueryBuilderExtension.AddFunctionsName(functionClause.ToString());
        }
示例#6
0
        public void Select(string tableName, string fieldName, SelectFunction selectFunction)
        {
            var selectionString = string.Format("{0}({1})", selectFunction.ToString(), Adapter.Field(tableName, fieldName));

            _selectionList.Add(selectionString);
        }
示例#7
0
        private void AddHavingClause(ClauseInput clauseInput, SelectFunction selectFunction)
        {
            var havingEpression = $"{selectFunction.ToString().ToUpper()}({clauseInput.Column}) {clauseInput.Operation} {clauseInput.ParameterFormated}";

            _havingClause.Add(havingEpression);
        }
        public void Select(SelectFunction selectFunction, string fieldName)
        {
            var selectionString = string.Format("{0}({1})", selectFunction.ToString(), fieldName);

            _selectionList.Add(selectionString);
        }
 public void Select(string tableName, string fieldName, SelectFunction selectFunction)
 {
     var selectionString = string.Format("{0}({1})", selectFunction.ToString(), Adapter.Field(tableName, fieldName));
     _selectionList.Add(selectionString);
 }
        public void Select(string tableName, string fieldName, SelectFunction selectFunction)
        {
            var selectionString = $"{selectFunction.ToString()}({Adapter.Field(tableName, fieldName)})";

            SelectionList.Add(selectionString);
        }