/// <summary>Inserts the given row into all the indexes of the TableBuffer.</summary> /// <param name="ARow">The given row must conform to the structure of the TableBuffer.</param> public void Insert(ServerProcess AProcess, Row ARow) { // Insert the row into all indexes Row LKey; Row LData; int LColumnIndex; #if USEINTERNALID Scalar LScalar = new Scalar(AProcess, (Schema.IScalarType)FInternalIDColumn.DataType, Guid.NewGuid()); #endif foreach (TableBufferIndex LBufferIndex in Indexes) { LKey = AProcess.RowManager.RequestRow(AProcess, LBufferIndex.KeyRowType); try { LData = AProcess.RowManager.RequestRow(AProcess, LBufferIndex.DataRowType); try { LKey.ValuesOwned = false; LData.ValuesOwned = false; for (int LIndex = 0; LIndex < LKey.DataType.Columns.Count; LIndex++) #if USEINTERNALID if (LKey.DataType.Columns[LIndex].Name == CInternalIDColumnName) { LKey[LIndex] = LScalar; } else #endif { LColumnIndex = ARow.DataType.Columns.IndexOf(LKey.DataType.Columns[LIndex].Name); if (((Row)ARow).HasValue(LColumnIndex)) { LKey[LIndex] = ARow[LColumnIndex]; } else { LKey.ClearValue(LIndex); } } for (int LIndex = 0; LIndex < LData.DataType.Columns.Count; LIndex++) #if USEINTERNALID if (LData.DataType.Columns[LIndex].Name == CInternalIDColumnName) { LData[LIndex] = LScalar; } else #endif { LColumnIndex = ARow.DataType.Columns.IndexOf(LData.DataType.Columns[LIndex].Name); if (((Row)ARow).HasValue(LColumnIndex)) { LData[LIndex] = ARow[LColumnIndex]; } else { LData.ClearValue(LIndex); } } LBufferIndex.Insert(AProcess, LKey.Stream, LData.Stream); } finally { AProcess.RowManager.ReleaseRow(LData); } } finally { AProcess.RowManager.ReleaseRow(LKey); } } }