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


C# TableName.Equals方法代码示例

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


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

示例1: RebuildIndexes

        internal void RebuildIndexes(TableName tableName)
        {
            if (tableName.Equals(SystemTableNames.Index) ||
                tableName.Equals(SystemTableNames.Tables)) {
                throw new ApplicationException("Cannot rebuild index on " + tableName);
            }

            // All indexes on the table,
            IIndexSetDataSource[] idxs = GetTableIndexes(tableName);
            // Rebuild each index
            foreach (IIndexSetDataSource idx in idxs) {
                RebuildIndex(tableName, idx);
            }
        }
开发者ID:ikvm,项目名称:deveelsql,代码行数:14,代码来源:SystemTransaction_Indexes.cs

示例2: AddIndex

        internal void AddIndex(long indexId, TableName onTable, string indexName, string type, IndexCollation collation)
        {
            IMutableTable indexTable = GetTable(SystemTableNames.Index);
            TableRow row = indexTable.NewRow();
            row.SetValue(0, indexId);
            row.SetValue(1, onTable.Schema);
            row.SetValue(2, onTable.Name);
            row.SetValue(3, indexName);
            row.SetValue(4, type);
            row.SetValue(5, collation.Function);
            row.SetValue(6, collation.Type.ToString());
            row.SetValue(7, user.Name);
            indexTable.Insert(row);
            indexTable.Commit();

            RowId insertRowId = row.Id;

            IMutableTable indexColumnTable = GetTable(SystemTableNames.ColumnSet);
            for (int i = 0; i < collation.Columns.Length; i++) {
                CollationColumn column = collation.Columns[i];

                row = indexColumnTable.NewRow();
                row.SetValue(0, indexId);
                row.SetValue(1, onTable.Schema);
                row.SetValue(2, onTable.Name);
                row.SetValue(3, indexName);
                row.SetValue(4, i);
                row.SetValue(5, column.ColumnName);
                row.SetValue(6, column.Ascending);
                indexColumnTable.Insert(row);
            }

            indexColumnTable.Commit();

            // If this isn't an index on the INDEXES or TABLES tables,););););
            if (!onTable.Equals(SystemTableNames.Tables) &&
                !onTable.Equals(SystemTableNames.Index)) {
                // Update the indexes
                IIndexSetDataSource[] idxs = GetTableIndexes(SystemTableNames.Index);
                foreach (IIndexSetDataSource i in idxs) {
                    i.Insert(insertRowId);
                }
            }
        }
开发者ID:ikvm,项目名称:deveelsql,代码行数:44,代码来源:SystemTransaction_Indexes.cs

示例3: GetIndexId

        internal long GetIndexId(TableName onTable, string indexName)
        {
            // Handle fetching the index definition entry specially,
            if (onTable.Equals(SystemTableNames.Index) &&
                indexName.Equals("index_composite_idx")) {
                // The index table,
                ITable indexTable = GetTable(SystemTableNames.Index);
                // Iterate until we find it (it should be found after only a few
                // iterations).
                IRowCursor cursor = indexTable.GetRowCursor();
                bool found = false;
                SqlObject indexId = null;
                while (cursor.MoveNext()) {
                    RowId rowId = cursor.Current;
                    indexId = indexTable.GetValue(0, rowId);
                    SqlObject schem = indexTable.GetValue(1, rowId);
                    SqlObject table = indexTable.GetValue(2, rowId);
                    SqlObject iname = indexTable.GetValue(3, rowId);

                    if (schem.ToString().Equals(onTable.Schema) &&
                        table.ToString().Equals(onTable.Name) &&
                        iname.ToString().Equals(indexName)) {
                        found = true;
                        break;
                    }
                }
                // If found
                return found ? indexId.ToInt64() : -1;
            } else {
                // No, so fetch it
                IIndexSetDataSource index = GetIndex(SystemTableNames.Index, "index_composite_idx");
                SqlObject val = SqlObject.CompositeString(new string[] { onTable.Schema, onTable.Name, indexName });

                // Query the index
                IRowCursor cursor = index.Select(SelectableRange.Is(val));

                // Should only be 1 value or none,
                if (cursor.Count > 1)
                    throw new ApplicationException("System index definition table invalid");

                // If no data in iterator, return null
                if (cursor.Count == 0)
                    return -1;

                // The index table,
                SystemTable indexTable = GetTable(SystemTableNames.Index);
                if (!cursor.MoveNext())
                    throw new ApplicationException();

                return indexTable.GetValue(0, cursor.Current);
            }
        }
开发者ID:ikvm,项目名称:deveelsql,代码行数:52,代码来源:SystemTransaction_Indexes.cs

示例4: InternalGetTable

        private SystemTable InternalGetTable(TableName tableName)
        {
            // Is it in the cache?
            SystemTable table;
            if (!tableNameMap.TryGetValue(tableName, out table)) {
                // Directory table is special case,
                if (tableName.Equals(SystemTableNames.Tables)) {
                    ITable t = state.GetTable(tableName);
                    if (t == null)
                        return null;

                    table = new SystemTable(this, t, -1);
                }
                    // Index tables are special cases
                else if (tableName.Equals(SystemTableNames.Index)) {
                    ITable t = state.GetTable(tableName);
                    if (t == null)
                        return null;

                    table = new SystemTable(this, t, -1);
                }
                    // Not a special case table,
                else {
                    // If the table is in the table id map
                    long tableId;
                    if (tableIdMap.TryGetValue(tableName, out tableId)) {
                        // Simply fetch if it is,
                        table = GetTable(tableId);
                    } else {
                        // Otherwise we need to resolve the table name to an id
                        // Discover the id for this table name from a query on the directory
                        // table.
                        // This is probably going to be a very heavy operation for what is a
                        // simple TableName to id lookup, and I think ultimately this
                        // operation will be backed by a cache.

                        // first check if we have the system TABLES table, that means
                        // we have a full setup
                        if (!TableExists(SystemTableNames.Tables)) {
                            // we have not a full setup: try to get the table
                            // directly from the state
                            ITable t = state.GetTable(tableName);
                            if (t == null)
                                return null;

                            tableId = state.CreateUniqueId(SystemTableNames.Tables);
                            table = new SystemTable(this, t, tableId);
                            tableIdMap[tableName] = tableId;
                        } else {
                            // Query the composite index
                            SystemTable tables = GetTable(SystemTableNames.Tables);
                            // Find the RowIndex that represents the set of all schema/name
                            // items in the table
                            IRowCursor i = GetNames(tables, tableName);
                            // Fail conditions
                            if (i.Count == 0)
                                return null;

                            if (i.Count > 1)
                                throw new ApplicationException("Multiple '" + tableName + "' tables.");

                            if (!i.MoveNext())
                                throw new ArgumentException();

                            // Read the result
                            RowId rowid = i.Current;
                            tableId = tables.GetValue(0, rowid);
                            string tableType = tables.GetValue(3, rowid);

                            // Fetch the table info
                            if (tableType.Equals("TABLE")) {
                                // Handle table_id overflow gracefully
                                if (tableId > Int32.MaxValue)
                                    throw new ApplicationException("table_id overflow (" + tableId + ")");

                                // Put the table id in the map
                                tableIdMap[tableName] = tableId;
                                // Fetch the table,
                                table = GetTable(tableId);
                            }

                                // Sequences
                            else if (tableType.Equals("SEQUENCE")) {
                                // NOTE, this doesn't get put on the table cache!
                                //TODO:
                            }

                                // Table primitives
                            else if (tableType.StartsWith("PRIMITIVE:")) {
                                // The name of the primitive
                                string tableOb = tableType.Substring(10);
                                if (tableOb.Equals("EmptyTable"))
                                    return SystemTable.Empty;
                                if (tableOb.Equals("OneRowTable"))
                                    return SystemTable.OneRow;
                            }

                                // Dynamically created tables created via reflection
                            else if (tableType.StartsWith("DYN:")) {
                                // A dynamic table type
//.........这里部分代码省略.........
开发者ID:ikvm,项目名称:deveelsql,代码行数:101,代码来源:SystemTransaction_Tables.cs


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