internal void CopyIndexFrom(SystemTransaction transaction, long indexId) { // Get the index name IndexName indexName = GetIndexName(indexId); // We get the index as a SystemTableIndex SystemIndexSetDataSource indexSource = transaction.GetIndex(indexId); // Check if an object with this name exists in this transaction, if (IndexExists(indexName.TableName, indexName.Name)) { // It does exist, so generate an error throw new ApplicationException("Index copy failed, index '" + indexName + "' already exists"); } // Copy the index to this transaction indexSource.CopyEntirelyTo(this); // Update the index id, AddIndex(indexId, indexName.TableName, indexName.Name, user.Name, indexSource.Collation); }
internal void CopyEntirelyTo(SystemTransaction destination) { SystemIndexSetDataSource destIndex = destination.GetIndex(index.Name.TableName, index.Name.Name); if (index is ICommitableTableIndex) { ((ICommitableTableIndex)index).CopyTo(destIndex.index); } else { IRowCursor cursor = index.GetCursor(); while (cursor.MoveNext()) { destIndex.Insert(cursor.Current); } } }