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

◆ SetupSchemaWithoutKeyInfo()

object[] System.Data.ProviderBase.SchemaMapping.SetupSchemaWithoutKeyInfo ( MissingMappingAction mappingAction,
MissingSchemaAction schemaAction,
bool gettingData,
DataColumn parentChapterColumn,
object chapterValue )
inlineprivate

Definition at line 484 of file SchemaMapping.cs.

485 {
486 int[] array = null;
487 bool[] array2 = null;
488 int num = 0;
490 object[] result = null;
491 List<object> items = null;
492 try
493 {
494 DataColumnCollection columns = _dataTable.Columns;
495 columns.EnsureAdditionalCapacity(fieldCount + ((chapterValue != null) ? 1 : 0));
496 bool flag = _dataTable.Columns.Count == 0 && (_tableMapping.ColumnMappings == null || _tableMapping.ColumnMappings.Count == 0) && mappingAction == MissingMappingAction.Passthrough;
497 for (int i = 0; i < fieldCount; i++)
498 {
499 bool flag2 = false;
501 if (null == type)
502 {
504 }
505 if (typeof(IDataReader).IsAssignableFrom(type))
506 {
507 if (array2 == null)
508 {
509 array2 = new bool[fieldCount];
510 }
511 flag2 = (array2[i] = true);
512 type = typeof(int);
513 }
514 else if (typeof(SqlXml).IsAssignableFrom(type))
515 {
516 if (_xmlMap == null)
517 {
518 _xmlMap = new int[fieldCount];
519 }
520 _xmlMap[i] = 1;
521 }
522 else if (typeof(XmlReader).IsAssignableFrom(type))
523 {
524 type = typeof(string);
525 if (_xmlMap == null)
526 {
527 _xmlMap = new int[fieldCount];
528 }
529 _xmlMap[i] = 2;
530 }
532 if (dataColumn == null)
533 {
534 if (array == null)
535 {
537 }
538 array[i] = -1;
539 continue;
540 }
541 if (_xmlMap != null && _xmlMap[i] != 0)
542 {
543 if (typeof(SqlXml) == dataColumn.DataType)
544 {
545 _xmlMap[i] = 1;
546 }
547 else if (typeof(XmlDocument) == dataColumn.DataType)
548 {
549 _xmlMap[i] = 2;
550 }
551 else
552 {
553 _xmlMap[i] = 0;
554 int num2 = 0;
555 for (int j = 0; j < _xmlMap.Length; j++)
556 {
557 num2 += _xmlMap[j];
558 }
559 if (num2 == 0)
560 {
561 _xmlMap = null;
562 }
563 }
564 }
565 if (dataColumn.Table == null)
566 {
567 if (flag2)
568 {
571 dataColumn.ReadOnly = true;
572 }
575 }
576 else if (flag2 && !dataColumn.AutoIncrement)
577 {
579 }
580 if (array != null)
581 {
582 array[i] = dataColumn.Ordinal;
583 }
584 else if (i != dataColumn.Ordinal)
585 {
587 array[i] = dataColumn.Ordinal;
588 }
589 num++;
590 }
591 bool flag3 = false;
592 DataColumn dataColumn2 = null;
593 if (chapterValue != null)
594 {
595 Type type2 = chapterValue.GetType();
597 if (dataColumn2 != null)
598 {
599 if (dataColumn2.Table == null)
600 {
603 flag3 = parentChapterColumn != null;
604 }
605 num++;
606 }
607 }
608 if (0 < num)
609 {
610 if (_dataSet != null && _dataTable.DataSet == null)
611 {
614 }
615 if (gettingData)
616 {
617 if (columns == null)
618 {
620 }
624 }
625 else
626 {
627 _mappedMode = -1;
628 }
629 }
630 else
631 {
632 _dataTable = null;
633 }
634 if (flag3)
635 {
637 }
638 }
639 catch (Exception e) when (ADP.IsCatchableOrSecurityExceptionType(e))
640 {
641 RollbackAddedItems(items);
642 throw;
643 }
644 return result;
645 }
void Add(TKey key, TValue value)
static Exception FillChapterAutoIncrement()
Definition ADP.cs:400
static InvalidOperationException MissingDataReaderFieldType(int index)
Definition ADP.cs:405
static bool IsCatchableOrSecurityExceptionType(Exception e)
Definition ADP.cs:800
static DataColumn CreateDataColumnBySchemaAction(string sourceColumn, string dataSetColumn, DataTable dataTable, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields|DynamicallyAccessedMemberTypes.PublicProperties)] Type dataType, MissingSchemaAction schemaAction)
DataColumn? GetDataColumn(string sourceColumn, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields|DynamicallyAccessedMemberTypes.PublicProperties)] Type? dataType, DataTable dataTable, MissingMappingAction mappingAction, MissingSchemaAction schemaAction)
DataTableCollection Tables
Definition DataSet.cs:396
DataColumnCollection Columns
Definition DataTable.cs:327
object[] SetupMapping(int count, DataColumnCollection columnCollection, DataColumn chapterColumn, object chapterValue)
readonly DataReaderContainer _dataReader
void RollbackAddedItems(List< object > items)
void AddItemToAllowRollback(ref List< object > items, object value)
readonly DataTableMapping _tableMapping
int[] CreateIndexMap(int count, int index)
void AddRelation(DataColumn parentChapterColumn, DataColumn chapterColumn)

References System.Data.ProviderBase.SchemaMapping._chapterMap, System.Data.ProviderBase.SchemaMapping._dataReader, System.Data.ProviderBase.SchemaMapping._dataSet, System.Data.ProviderBase.SchemaMapping._dataTable, System.Data.ProviderBase.SchemaMapping._fieldNames, System.Data.ProviderBase.SchemaMapping._indexMap, System.Data.ProviderBase.SchemaMapping._mappedMode, System.Data.ProviderBase.SchemaMapping._tableMapping, System.Data.ProviderBase.SchemaMapping._xmlMap, System.Data.DataTableCollection.Add(), System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Data.ProviderBase.SchemaMapping.AddItemToAllowRollback(), System.Data.ProviderBase.SchemaMapping.AddRelation(), System.array, System.Data.DataTable.Columns, System.Data.Common.DataColumnMapping.CreateDataColumnBySchemaAction(), System.Data.ProviderBase.SchemaMapping.CreateIndexMap(), System.Data.DataTable.DataSet, System.Xml.Dictionary, System.Data.ProviderBase.DataReaderContainer.FieldCount, System.Data.Common.ADP.FillChapterAutoIncrement(), System.Data.Common.DataTableMapping.GetDataColumn(), System.Data.ProviderBase.DataReaderContainer.GetFieldType(), System.Data.Common.ADP.IsCatchableOrSecurityExceptionType(), System.Data.Common.ADP.MissingDataReaderFieldType(), System.Data.ProviderBase.SchemaMapping.RollbackAddedItems(), System.Data.ProviderBase.SchemaMapping.SetupMapping(), System.Data.Common.DataTableMapping.SourceTable, System.Data.DataSet.Tables, and System.type.

Referenced by System.Data.ProviderBase.SchemaMapping.SchemaMapping().