当前位置: 首页>>代码示例>>C#>>正文


C# tgDynamicQuerySerializable类代码示例

本文整理汇总了C#中tgDynamicQuerySerializable的典型用法代码示例。如果您正苦于以下问题:C# tgDynamicQuerySerializable类的具体用法?C# tgDynamicQuerySerializable怎么用?C# tgDynamicQuerySerializable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


tgDynamicQuerySerializable类属于命名空间,在下文中一共展示了tgDynamicQuerySerializable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateFullName

        static public string CreateFullName(tgDynamicQuerySerializable query)
        {
            IDynamicQuerySerializableInternal iQuery = query as IDynamicQuerySerializableInternal;

            tgMetadata meta = query;

            string name = String.Empty;

            string catalog = meta.Catalog ?? null;
            string schema = meta.Schema ?? null;

            if (catalog != null && schema != null)
            {
                name += Delimiters.TableOpen + catalog + Delimiters.TableClose + ".";
            }

            if (schema != null)
            {
                name += Delimiters.TableOpen + schema + Delimiters.TableClose + ".";
            }

            name += Delimiters.TableOpen;

            if (query.tg.QuerySource != null)
                name += query.tg.QuerySource;
            else
                name += meta.Destination;
            name += Delimiters.TableClose;

            return name;
        }
开发者ID:BrewDawg,项目名称:Tiraggo.EF,代码行数:31,代码来源:Shared.cs

示例2: ApplyWhereSubOperations

        protected static string ApplyWhereSubOperations(StandardProviderParameters std, tgDynamicQuerySerializable query, tgComparison.tgComparisonData comparisonData)
        {
            string sql = string.Empty;

            if (comparisonData.HasExpression)
            {
                sql += GetMathmaticalExpressionColumn(std, query, comparisonData.Expression);

                if (comparisonData.SubOperators != null && comparisonData.SubOperators.Count > 0)
                {
                    sql = BuildSubOperationsSql(std, sql, comparisonData.SubOperators);
                }

                return sql;
            }

            string delimitedColumnName = GetColumnName(comparisonData.Column);

            if (comparisonData.SubOperators != null)
            {
                sql = BuildSubOperationsSql(std, delimitedColumnName, comparisonData.SubOperators);
            }
            else
            {
                sql = delimitedColumnName;
            }

            return sql;
        }
开发者ID:BrewDawg,项目名称:Tiraggo,代码行数:29,代码来源:QueryBuilder.cs

示例3: BuildQuery

        protected static string BuildQuery(StandardProviderParameters std, tgDynamicQuerySerializable query)
        {
            IDynamicQuerySerializableInternal iQuery = query as IDynamicQuerySerializableInternal;

            string select = GetSelectStatement(std, query);
            string from = GetFromStatement(std, query);
            string join = GetJoinStatement(std, query);
            string where = GetComparisonStatement(std, query, iQuery.InternalWhereItems, " WHERE ");
            string groupBy = GetGroupByStatement(std, query);
            string having = GetComparisonStatement(std, query, iQuery.InternalHavingItems, " HAVING ");
            string orderBy = GetOrderByStatement(std, query);
            string setOperation = GetSetOperationStatement(std, query);

            string sql = "SELECT " + select + " FROM " + from + join + where + setOperation + groupBy + having + orderBy;

            return sql;
        }
开发者ID:BrewDawg,项目名称:Tiraggo,代码行数:17,代码来源:QueryBuilder.cs

示例4: tgJoinItem

 /// <summary>
 /// The Constructor
 /// </summary>
 public tgJoinItem(tgDynamicQuerySerializable parentQuery)
 {
     this.parentQuery = parentQuery;
 }
开发者ID:BrewDawg,项目名称:Tiraggo,代码行数:7,代码来源:tgJoinItem.cs

示例5: GetSelectStatement

        protected static string GetSelectStatement(StandardProviderParameters std, tgDynamicQuerySerializable query)
        {
            string sql = String.Empty;
            string comma = String.Empty;
            bool selectAll = true;

            IDynamicQuerySerializableInternal iQuery = query as IDynamicQuerySerializableInternal;

            if (query.tg.Distinct) sql += " DISTINCT ";
            if (query.tg.Top >= 0) sql += " TOP " + query.tg.Top.ToString() + " ";

            if (iQuery.InternalSelectColumns != null)
            {
                selectAll = false;

                foreach (tgExpression expressionItem in iQuery.InternalSelectColumns)
                {
                    if (expressionItem.Query != null)
                    {
                        IDynamicQuerySerializableInternal iSubQuery = expressionItem.Query as IDynamicQuerySerializableInternal;

                        sql += comma;

                        if (iSubQuery.SubQueryAlias == string.Empty)
                        {
                            sql += iSubQuery.JoinAlias + ".*";
                        }
                        else
                        {
                            iSubQuery.IsInSubQuery = true;
                            sql += " (" + BuildQuery(std, expressionItem.Query as tgDynamicQuerySerializable) + ") AS " + iSubQuery.SubQueryAlias;
                            iSubQuery.IsInSubQuery = false;
                        }

                        comma = ",";
                    }
                    else
                    {
                        sql += comma;

                        string columnName = expressionItem.Column.Name;

                        if (columnName != null && columnName[0] == '<')
                            sql += columnName.Substring(1, columnName.Length - 2);
                        else
                            sql += GetExpressionColumn(std, query, expressionItem, false, true);

                        comma = ",";
                    }
                }
                sql += " ";
            }

            if (query.tg.CountAll)
            {
                selectAll = false;

                sql += comma;
                sql += "COUNT(*)";

                if (query.tg.CountAllAlias != null)
                {
                    // Need DBMS string delimiter here
                    sql += " AS " + Delimiters.StringOpen + query.tg.CountAllAlias + Delimiters.StringClose;
                }
            }

            if (selectAll)
            {
                sql += "*";
            }

            return sql;
        }
开发者ID:BrewDawg,项目名称:Tiraggo,代码行数:74,代码来源:QueryBuilder.cs

示例6: GetMathmaticalExpressionColumn

        protected static string GetMathmaticalExpressionColumn(StandardProviderParameters std, tgDynamicQuerySerializable query, tgMathmaticalExpression mathmaticalExpression)
        {
            string sql = "(";

            if (mathmaticalExpression.ItemFirst)
            {
                sql += GetExpressionColumn(std, query, mathmaticalExpression.SelectItem1, true, true);
                sql += esArithmeticOperatorToString(mathmaticalExpression.Operator);

                if (mathmaticalExpression.SelectItem2 != null)
                {
                    sql += GetExpressionColumn(std, query, mathmaticalExpression.SelectItem2, true, true);
                }
                else
                {
                    sql += GetMathmaticalExpressionLiteralType(std, mathmaticalExpression);
                }
            }
            else
            {
                if (mathmaticalExpression.SelectItem2 != null)
                {
                    sql += GetExpressionColumn(std, query, mathmaticalExpression.SelectItem2, true, true);
                }
                else
                {
                    sql += GetMathmaticalExpressionLiteralType(std, mathmaticalExpression);
                }

                sql += esArithmeticOperatorToString(mathmaticalExpression.Operator);
                sql += GetExpressionColumn(std, query, mathmaticalExpression.SelectItem1, true, true);
            }

            sql += ")";

            return sql;
        }
开发者ID:BrewDawg,项目名称:Tiraggo,代码行数:37,代码来源:QueryBuilder.cs

示例7: GetGroupByStatement

        protected static string GetGroupByStatement(StandardProviderParameters std, tgDynamicQuerySerializable query)
        {
            string sql = String.Empty;
            string comma = String.Empty;

            IDynamicQuerySerializableInternal iQuery = query as IDynamicQuerySerializableInternal;

            if (iQuery.InternalGroupByItems != null)
            {
                sql += " GROUP BY ";

                foreach (tgGroupByItem groupBy in iQuery.InternalGroupByItems)
                {
                    sql += comma;

                    string columnName = groupBy.Expression.Column.Name;

                    if (columnName != null && columnName[0] == '<')
                        sql += columnName.Substring(1, columnName.Length - 2);
                    else
                        sql += GetExpressionColumn(std, query, groupBy.Expression, false, false);

                    comma = ",";
                }

                if (query.tg.WithRollup)
                {
                    sql += " WITH ROLLUP";
                }
            }

            return sql;
        }
开发者ID:BrewDawg,项目名称:Tiraggo,代码行数:33,代码来源:QueryBuilder.cs

示例8: GetExpressionColumn

        protected static string GetExpressionColumn(StandardProviderParameters std, tgDynamicQuerySerializable query, tgExpression expression, bool inExpression, bool useAlias)
        {
            string sql = String.Empty;

            if (expression.CaseWhen != null)
            {
                return GetCaseWhenThenEnd(std, query, expression.CaseWhen);
            }

            if (expression.HasMathmaticalExpression)
            {
                sql += GetMathmaticalExpressionColumn(std, query, expression.MathmaticalExpression);
            }
            else
            {
                sql += GetColumnName(expression.Column);
            }

            if (expression.SubOperators != null)
            {
                if (expression.Column.Distinct)
                {
                    sql = BuildSubOperationsSql(std, "DISTINCT " + sql, expression.SubOperators);
                }
                else
                {
                    sql = BuildSubOperationsSql(std, sql, expression.SubOperators);
                }
            }

            if (!inExpression && useAlias)
            {
                if (expression.SubOperators != null || expression.Column.HasAlias)
                {
                    sql += " AS " + Delimiters.StringOpen + expression.Column.Alias + Delimiters.StringClose;
                }
            }

            return sql;
        }
开发者ID:BrewDawg,项目名称:Tiraggo,代码行数:40,代码来源:QueryBuilder.cs

示例9: GetComparisonStatement

        protected static string GetComparisonStatement(StandardProviderParameters std, tgDynamicQuerySerializable query, List<tgComparison> items, string prefix)
        {
            string sql = String.Empty;
            string comma = String.Empty;

            IDynamicQuerySerializableInternal iQuery = query as IDynamicQuerySerializableInternal;

            //=======================================
            // WHERE
            //=======================================
            if (items != null)
            {
                sql += prefix;

                string compareTo = String.Empty;
                foreach (tgComparison comparisonItem in items)
                {
                    tgComparison.tgComparisonData comparisonData = (tgComparison.tgComparisonData)comparisonItem;
                    tgDynamicQuerySerializable subQuery = null;

                    bool requiresParam = true;
                    bool needsStringParameter = false;

                    if (comparisonData.IsParenthesis)
                    {
                        if (comparisonData.Parenthesis == tgParenthesis.Open)
                            sql += "(";
                        else
                            sql += ")";

                        continue;
                    }

                    if (comparisonData.IsConjunction)
                    {
                        switch (comparisonData.Conjunction)
                        {
                            case tgConjunction.And: sql += " AND "; break;
                            case tgConjunction.Or: sql += " OR "; break;
                            case tgConjunction.AndNot: sql += " AND NOT "; break;
                            case tgConjunction.OrNot: sql += " OR NOT "; break;
                        }
                        continue;
                    }

                    Dictionary<string, VistaDBParameter> types = null;
                    if (comparisonData.Column.Query != null)
                    {
                        IDynamicQuerySerializableInternal iLocalQuery = comparisonData.Column.Query as IDynamicQuerySerializableInternal;
                        types = Cache.GetParameters(iLocalQuery.DataID, (tgProviderSpecificMetadata)iLocalQuery.ProviderMetadata, (tgColumnMetadataCollection)iLocalQuery.Columns);
                    }

                    if (comparisonData.IsLiteral)
                    {
                        sql += comparisonData.Column.Name.Substring(1, comparisonData.Column.Name.Length - 2);
                        continue;
                    }

                    if (comparisonData.ComparisonColumn.Name == null)
                    {
                        subQuery = comparisonData.Value as tgDynamicQuerySerializable;

                        if (subQuery == null)
                        {
                            if (comparisonData.Column.Name != null)
                            {
                                IDynamicQuerySerializableInternal iColQuery = comparisonData.Column.Query as IDynamicQuerySerializableInternal;
                                tgColumnMetadataCollection columns = (tgColumnMetadataCollection)iColQuery.Columns;
                                compareTo = Delimiters.Param + columns[comparisonData.Column.Name].PropertyName + (++std.pindex).ToString();
                            }
                            else
                            {
                                compareTo = Delimiters.Param + "Expr" + (++std.pindex).ToString();
                            }
                        }
                        else
                        {
                            // It's a sub query
                            compareTo = GetSubquerySearchCondition(subQuery) + " (" + BuildQuery(std, subQuery) + ") ";
                            requiresParam = false;
                        }
                    }
                    else
                    {
                        compareTo = GetColumnName(comparisonData.ComparisonColumn);
                        requiresParam = false;
                    }

                    switch (comparisonData.Operand)
                    {
                        case tgComparisonOperand.Exists:
                            sql += " EXISTS" + compareTo;
                            break;
                        case tgComparisonOperand.NotExists:
                            sql += " NOT EXISTS" + compareTo;
                            break;

                        //-----------------------------------------------------------
                        // Comparison operators, left side vs right side
                        //-----------------------------------------------------------
//.........这里部分代码省略.........
开发者ID:BrewDawg,项目名称:Tiraggo,代码行数:101,代码来源:QueryBuilder.cs

示例10: GetSubquerySearchCondition

        private static string GetSubquerySearchCondition(tgDynamicQuerySerializable query)
        {
            string searchCondition = String.Empty;

            IDynamicQuerySerializableInternal iQuery = query as IDynamicQuerySerializableInternal;

            switch (iQuery.SubquerySearchCondition)
            {
                case tgSubquerySearchCondition.All: searchCondition = "ALL"; break;
                case tgSubquerySearchCondition.Any: searchCondition = "ANY"; break;
                case tgSubquerySearchCondition.Some: searchCondition = "SOME"; break;
            }

            return searchCondition;
        }
开发者ID:BrewDawg,项目名称:Tiraggo,代码行数:15,代码来源:QueryBuilder.cs

示例11: tgSetOperation

 /// <summary>
 /// The Constructor
 /// </summary>
 public tgSetOperation(tgDynamicQuerySerializable query)
 {
     this.Query = query;
 }
开发者ID:BrewDawg,项目名称:Tiraggo,代码行数:7,代码来源:tgSetOperation.cs

示例12: GetJoinStatement

        protected static string GetJoinStatement(StandardProviderParameters std, tgDynamicQuerySerializable query)
        {
            string sql = String.Empty;

            IDynamicQuerySerializableInternal iQuery = query as IDynamicQuerySerializableInternal;

            if (iQuery.InternalJoinItems != null)
            {
                foreach (tgJoinItem joinItem in iQuery.InternalJoinItems)
                {
                    tgJoinItem.tgJoinItemData joinData = (tgJoinItem.tgJoinItemData)joinItem;

                    switch (joinData.JoinType)
                    {
                        case tgJoinType.InnerJoin:
                            sql += " INNER JOIN ";
                            break;
                        case tgJoinType.LeftJoin:
                            sql += " LEFT JOIN ";
                            break;
                        case tgJoinType.RightJoin:
                            sql += " RIGHT JOIN ";
                            break;
                        case tgJoinType.FullJoin:
                            sql += " FULL JOIN ";
                            break;
                    }

                    IDynamicQuerySerializableInternal iSubQuery = joinData.Query as IDynamicQuerySerializableInternal;

                    sql += Shared.CreateFullName((tgProviderSpecificMetadata)iSubQuery.ProviderMetadata);
                    sql += " " + iSubQuery.JoinAlias + " ON ";

                    foreach (tgComparison comparisonItem in joinData.WhereItems)
                    {
                        tgComparison.tgComparisonData comparisonData = (tgComparison.tgComparisonData)comparisonItem;

                        if (comparisonData.IsParenthesis)
                        {
                            if (comparisonData.Parenthesis == tgParenthesis.Open)
                                sql += "(";
                            else
                                sql += ")";

                            continue;
                        }

                        if (comparisonData.IsConjunction)
                        {
                            if (comparisonData.Conjunction == tgConjunction.And)
                                sql += " AND ";
                            else
                                sql += " OR ";

                            continue;
                        }

                        sql += GetColumnName(comparisonData.Column);

                        switch (comparisonData.Operand)
                        {
                            case tgComparisonOperand.Equal:
                                sql += " = ";
                                break;
                            case tgComparisonOperand.NotEqual:
                                sql += " <> ";
                                break;
                            case tgComparisonOperand.GreaterThan:
                                sql += " > ";
                                break;
                            case tgComparisonOperand.LessThan:
                                sql += " < ";
                                break;
                            case tgComparisonOperand.LessThanOrEqual:
                                sql += " <= ";
                                break;
                            case tgComparisonOperand.GreaterThanOrEqual:
                                sql += " >= ";
                                break;
                            case tgComparisonOperand.IsNull:
                                sql += " IS NULL ";
                                break;
                            case tgComparisonOperand.IsNotNull:
                                sql += " IS NOT NULL ";
                                break;
                            case tgComparisonOperand.In:
                                sql += " IN ";
                                break;
                            case tgComparisonOperand.NotIn:
                                sql += " NOT IN ";
                                break;
                        }

                        if (comparisonData.ComparisonColumn.Name != null)
                        {
                            sql += GetColumnName(comparisonData.ComparisonColumn);
                        }
                        else
                        {
                            tgDynamicQuerySerializable subQuery = comparisonData.Value as tgDynamicQuerySerializable;
//.........这里部分代码省略.........
开发者ID:BrewDawg,项目名称:Tiraggo,代码行数:101,代码来源:QueryBuilder.cs

示例13: tgCase

 /// <summary>
 /// The Constructor
 /// </summary>
 public tgCase(tgDynamicQuerySerializable query)
 {
     this.data.Query = query;
 }
开发者ID:BrewDawg,项目名称:Tiraggo,代码行数:7,代码来源:tgCase.cs

示例14: tgQueryItem

 /// <summary>
 /// The tgQueryItem class is dynamically created by your
 /// BusinessEntity's DynamicQuery mechanism.
 /// </summary>
 /// <param name="query">The esDynamicQueryTransport passed in via DynamicQuery</param>
 /// <param name="columnName">The columnName passed in via DynamicQuery</param>
 /// <param name="datatype">The tgSystemType</param>
 public tgQueryItem(tgDynamicQuerySerializable query, string columnName, tgSystemType datatype)
 {
     this.query = query;
     this.Column.Query = query;
     this.Column.Name = columnName;
     this.Column.Query.tg.JoinAlias = query.tg.JoinAlias;
     this.Column.Datatype = datatype;
 }
开发者ID:BrewDawg,项目名称:Tiraggo.EF,代码行数:15,代码来源:tgQueryItem.cs

示例15: GetSetOperationStatement

        protected static string GetSetOperationStatement(StandardProviderParameters std, tgDynamicQuerySerializable query)
        {
            string sql = String.Empty;

            IDynamicQuerySerializableInternal iQuery = query as IDynamicQuerySerializableInternal;

            if (iQuery.InternalSetOperations != null)
            {
                foreach (tgSetOperation setOperation in iQuery.InternalSetOperations)
                {
                    switch (setOperation.SetOperationType)
                    {
                        case tgSetOperationType.Union: sql += " UNION "; break;
                        case tgSetOperationType.UnionAll: sql += " UNION ALL "; break;
                        case tgSetOperationType.Intersect: sql += " INTERSECT "; break;
                        case tgSetOperationType.Except: sql += " EXCEPT "; break;
                    }

                    sql += BuildQuery(std, setOperation.Query);
                }
            }

            return sql;
        }
开发者ID:BrewDawg,项目名称:Tiraggo,代码行数:24,代码来源:QueryBuilder.cs


注:本文中的tgDynamicQuerySerializable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。