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


C# ITable.GetVariableResolver方法代码示例

本文整理汇总了C#中ITable.GetVariableResolver方法的典型用法代码示例。如果您正苦于以下问题:C# ITable.GetVariableResolver方法的具体用法?C# ITable.GetVariableResolver怎么用?C# ITable.GetVariableResolver使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITable的用法示例。


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

示例1: FunctionTable

        public FunctionTable(ITable table, SqlExpression[] functionList, string[] columnNames, IRequest queryContext)
            : base(queryContext.Context)
        {
            // Make sure we are synchronized over the class.
            lock (typeof(FunctionTable)) {
                uniqueId = uniqueKeySeq;
                ++uniqueKeySeq;
            }

            uniqueId = (uniqueId & 0x0FFFFFFF) | 0x010000000;

            context = queryContext;

            ReferenceTable = table;
            varResolver = table.GetVariableResolver();
            varResolver = varResolver.ForRow(0);

            // Create a DataTableInfo object for this function table.
            funTableInfo = new TableInfo(FunctionTableName);

            expList = new SqlExpression[functionList.Length];
            expInfo = new byte[functionList.Length];

            // Create a new DataColumnInfo for each expression, and work out if the
            // expression is simple or not.
            for (int i = 0; i < functionList.Length; ++i) {
                var expr = functionList[i];
                // Examine the expression and determine if it is simple or not
                if (expr.IsConstant() && !expr.HasAggregate(context)) {
                    // If expression is a constant, solve it
                    var result = expr.Evaluate(context, null);
                    if (result.ExpressionType != SqlExpressionType.Constant)
                        throw new InvalidOperationException();

                    expr = result;
                    expList[i] = expr;
                    expInfo[i] = 1;
                } else {
                    // Otherwise must be dynamic
                    expList[i] = expr;
                    expInfo[i] = 0;
                }

                // Make the column info
                funTableInfo.AddColumn(columnNames[i], expr.ReturnType(context, varResolver));
            }

            // Make sure the table info isn't changed from this point on.
            funTableInfo = funTableInfo.AsReadOnly();

            // routine tables are the size of the referring table.
            rowCount = table.RowCount;

            // Set schemes to 'blind search'.
            SetupIndexes(DefaultIndexTypes.BlindSearch);
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:56,代码来源:FunctionTable.cs

示例2: SimpleJoin

        public static ITable SimpleJoin(this ITable thisTable, IQueryContext context, ITable other, SqlBinaryExpression binary)
        {
            var objRef = binary.Left as SqlReferenceExpression;
            if (objRef == null)
                throw new ArgumentException();

            // Find the row with the name given in the condition.
            int lhsColumn = thisTable.FindColumn(objRef.ReferenceName);

            if (lhsColumn == -1)
                throw new Exception("Unable to find the LHS column specified in the condition: " + objRef.ReferenceName);

            // Create a variable resolver that can resolve columns in the destination
            // table.
            var resolver = other.GetVariableResolver();

            // The join algorithm.  It steps through the RHS expression, selecting the
            // cells that match the relation from the LHS table (this table).

            var thisRowSet = new List<int>();
            var tableRowSet = new List<int>();

            var e = other.GetEnumerator();

            while (e.MoveNext()) {
                int rowIndex = e.Current.RowId.RowNumber;

                // Select all the rows in this table that match the joining condition.
                var selectedSet = thisTable.SelectRows(resolver, context, binary);

                var selectList = selectedSet.ToList();

                var size = selectList.Count;
                // Include in the set.
                for (int i = 0; i < size; i++) {
                    tableRowSet.Add(rowIndex);
                }

                thisRowSet.AddRange(selectList);
            }

            // Create the new VirtualTable with the joined tables.

            var tabs = new[] {thisTable, other};
            var rowSets = new IList<int>[] {thisRowSet, tableRowSet};

            return new VirtualTable(tabs, rowSets);
        }
开发者ID:furesoft,项目名称:deveeldb,代码行数:48,代码来源:TableQueryExtensions.cs


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