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


C# ITable.FindColumn方法代码示例

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


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

示例1: Update

        public static int Update(this IMutableTable mutableTable, IQueryContext context, ITable table,
			IEnumerable<SqlAssignExpression> assignList, int limit)
        {
            // Get the rows from the input table.
            var rowSet = new List<int>();
            var e = table.GetEnumerator();
            while (e.MoveNext()) {
                rowSet.Add(e.Current.RowId.RowNumber);
            }

            // HACKY: Find the first column of this table in the search table.  This
            //   will allow us to generate a row set of only the rows in the search
            //   table.
            int firstColumn = table.FindColumn(mutableTable.GetResolvedColumnName(0));
            if (firstColumn == -1)
                throw new InvalidOperationException("Search table does not contain any " +
                                            "reference to table being updated from");

            // Convert the row_set to this table's domain.
            rowSet = table.ResolveRows(firstColumn, rowSet, mutableTable).ToList();

            // NOTE: Assume there's no duplicate rows.

            // If limit less than zero then limit is whole set.
            if (limit < 0)
                limit = Int32.MaxValue;

            // Update each row in row set in turn up to the limit.
            int len = System.Math.Min(rowSet.Count, limit);

            int updateCount = 0;
            for (int i = 0; i < len; ++i) {
                int toUpdate = rowSet[i];

                // Make a row object from this row (plus keep the original intact
                // in case we need to roll back to it).
                var row = mutableTable.GetRow(toUpdate);
                row.SetFromTable();

                // Run each assignment on the row.
                foreach (var assignment in assignList) {
                    row.EvaluateAssignment(assignment, context);
                }

                // Update the row
                mutableTable.UpdateRow(row);

                ++updateCount;
            }

            if (updateCount > 0)
                // Perform a referential integrity check on any changes to the table.
                mutableTable.AssertConstraints();

            return updateCount;
        }
开发者ID:prepare,项目名称:deveeldb,代码行数:56,代码来源:MutableTableExtensions.cs


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