Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ LoadRow()

DataRow System.Data.DataTable.LoadRow ( object[] values,
LoadOption loadOption,
Index searchIndex )
inlineprivateinherited

Definition at line 4404 of file DataTable.cs.

4405 {
4406 DataRow dataRow = null;
4407 int num2;
4408 if (searchIndex != null)
4409 {
4410 int[] array = Array.Empty<int>();
4411 if (_primaryKey != null)
4412 {
4413 array = new int[_primaryKey.ColumnsReference.Length];
4414 for (int i = 0; i < _primaryKey.ColumnsReference.Length; i++)
4415 {
4417 }
4418 }
4419 object[] array2 = new object[array.Length];
4420 for (int j = 0; j < array.Length; j++)
4421 {
4422 array2[j] = values[array[j]];
4423 }
4424 Range range = searchIndex.FindRecords(array2);
4425 if (!range.IsNull)
4426 {
4427 int num = 0;
4428 for (int k = range.Min; k <= range.Max; k++)
4429 {
4430 int record = searchIndex.GetRecord(k);
4433 for (int l = 0; l < values.Length; l++)
4434 {
4435 if (values[l] == null)
4436 {
4438 }
4439 }
4440 for (int m = values.Length; m < _columnCollection.Count; m++)
4441 {
4443 }
4444 if (loadOption != LoadOption.Upsert || dataRow.RowState != DataRowState.Deleted)
4445 {
4447 }
4448 else
4449 {
4450 num++;
4451 }
4452 }
4453 if (num == 0)
4454 {
4455 return dataRow;
4456 }
4457 }
4458 }
4460 dataRow = NewRow(num2);
4461 DataRowChangeEventArgs dataRowChangeEventArgs = null;
4462 DataRowAction eAction;
4463 switch (loadOption)
4464 {
4465 case LoadOption.OverwriteChanges:
4466 case LoadOption.PreserveChanges:
4467 eAction = DataRowAction.ChangeCurrentAndOriginal;
4468 break;
4469 case LoadOption.Upsert:
4470 eAction = DataRowAction.Add;
4471 break;
4472 default:
4473 throw ExceptionBuilder.ArgumentOutOfRange("LoadOption");
4474 }
4476 InsertRow(dataRow, -1L, -1, fireEvent: false);
4477 switch (loadOption)
4478 {
4479 case LoadOption.OverwriteChanges:
4480 case LoadOption.PreserveChanges:
4482 break;
4483 default:
4484 throw ExceptionBuilder.ArgumentOutOfRange("LoadOption");
4485 case LoadOption.Upsert:
4486 break;
4487 }
4489 return dataRow;
4490 }
void Add(TKey key, TValue value)
readonly DataColumnCollection _columnCollection
Definition DataTable.cs:64
UniqueConstraint _primaryKey
Definition DataTable.cs:124
void InsertRow(DataRow row, int proposedID, int pos)
int NewRecordFromArray(object[] value)
void SetOldRecord(DataRow row, int proposedRecord)
DataRowChangeEventArgs RaiseRowChanging(DataRowChangeEventArgs args, DataRow eRow, DataRowAction eAction)
void SetDataRowWithLoadOption(DataRow dataRow, int recordNo, LoadOption loadOption, bool checkReadOnly)
readonly RecordManager _recordManager
Definition DataTable.cs:74
DataRowChangeEventArgs RaiseRowChanged(DataRowChangeEventArgs args, DataRow eRow, DataRowAction eAction)

References System.Data.DataTable._columnCollection, System.Data.DataTable._primaryKey, System.Data.DataTable._recordManager, System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Data.ExceptionBuilder.ArgumentOutOfRange(), System.array, System.Data.UniqueConstraint.ColumnsReference, System.Data.InternalDataCollectionBase.Count, System.Runtime.Serialization.Dictionary, System.Data.DataTable.InsertRow(), System.L, System.Data.DataTable.NewRecordFromArray(), System.Data.DataTable.NewRow(), System.Data.DataColumn.Ordinal, System.Data.DataTable.RaiseRowChanged(), System.Data.DataTable.RaiseRowChanging(), System.Data.DataTable.SetDataRowWithLoadOption(), System.Data.DataTable.SetOldRecord(), and System.values.

Referenced by System.Data.DataTable.LoadDataRow().