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

◆ BuildInformation()

void System.Data.Common.DbCommandBuilder.BuildInformation ( DataTable schemaTable)
inlineprivate

Definition at line 560 of file DbCommandBuilder.cs.

561 {
562 DbSchemaRow[] sortedSchemaRows = DbSchemaRow.GetSortedSchemaRows(schemaTable, returnProviderSpecificTypes: false);
563 if (sortedSchemaRows == null || sortedSchemaRows.Length == 0)
564 {
565 throw ADP.DynamicSQLNoTableInfo();
566 }
567 string text = string.Empty;
568 string text2 = string.Empty;
569 string text3 = string.Empty;
570 string text4 = null;
571 for (int i = 0; i < sortedSchemaRows.Length; i++)
572 {
573 DbSchemaRow dbSchemaRow = sortedSchemaRows[i];
574 string baseTableName = dbSchemaRow.BaseTableName;
575 if (baseTableName == null || baseTableName.Length == 0)
576 {
577 sortedSchemaRows[i] = null;
578 continue;
579 }
580 string text5 = dbSchemaRow.BaseServerName;
581 string text6 = dbSchemaRow.BaseCatalogName;
582 string text7 = dbSchemaRow.BaseSchemaName;
583 if (text5 == null)
584 {
585 text5 = string.Empty;
586 }
587 if (text6 == null)
588 {
589 text6 = string.Empty;
590 }
591 if (text7 == null)
592 {
593 text7 = string.Empty;
594 }
595 if (text4 == null)
596 {
597 text = text5;
598 text2 = text6;
599 text3 = text7;
600 text4 = baseTableName;
601 }
602 else if (ADP.SrcCompare(text4, baseTableName) != 0 || ADP.SrcCompare(text3, text7) != 0 || ADP.SrcCompare(text2, text6) != 0 || ADP.SrcCompare(text, text5) != 0)
603 {
604 throw ADP.DynamicSQLJoinUnsupported();
605 }
606 }
607 if (text.Length == 0)
608 {
609 text = null;
610 }
611 if (text2.Length == 0)
612 {
613 text = null;
614 text2 = null;
615 }
616 if (text3.Length == 0)
617 {
618 text = null;
619 text2 = null;
620 text3 = null;
621 }
622 if (text4 == null || text4.Length == 0)
623 {
624 throw ADP.DynamicSQLNoTableInfo();
625 }
626 CatalogLocation catalogLocation = CatalogLocation;
627 string catalogSeparator = CatalogSeparator;
628 string schemaSeparator = SchemaSeparator;
629 string quotePrefix = QuotePrefix;
630 string quoteSuffix = QuoteSuffix;
631 if (!string.IsNullOrEmpty(quotePrefix) && -1 != text4.IndexOf(quotePrefix, StringComparison.Ordinal))
632 {
633 throw ADP.DynamicSQLNestedQuote(text4, quotePrefix);
634 }
635 if (!string.IsNullOrEmpty(quoteSuffix) && -1 != text4.IndexOf(quoteSuffix, StringComparison.Ordinal))
636 {
637 throw ADP.DynamicSQLNestedQuote(text4, quoteSuffix);
638 }
639 StringBuilder stringBuilder = new StringBuilder();
640 if (CatalogLocation.Start == catalogLocation)
641 {
642 if (text != null)
643 {
644 stringBuilder.Append(ADP.BuildQuotedString(quotePrefix, quoteSuffix, text));
645 stringBuilder.Append(catalogSeparator);
646 }
647 if (text2 != null)
648 {
649 stringBuilder.Append(ADP.BuildQuotedString(quotePrefix, quoteSuffix, text2));
650 stringBuilder.Append(catalogSeparator);
651 }
652 }
653 if (text3 != null)
654 {
655 stringBuilder.Append(ADP.BuildQuotedString(quotePrefix, quoteSuffix, text3));
656 stringBuilder.Append(schemaSeparator);
657 }
658 stringBuilder.Append(ADP.BuildQuotedString(quotePrefix, quoteSuffix, text4));
659 if (CatalogLocation.End == catalogLocation)
660 {
661 if (text != null)
662 {
663 stringBuilder.Append(catalogSeparator);
664 stringBuilder.Append(ADP.BuildQuotedString(quotePrefix, quoteSuffix, text));
665 }
666 if (text2 != null)
667 {
668 stringBuilder.Append(catalogSeparator);
669 stringBuilder.Append(ADP.BuildQuotedString(quotePrefix, quoteSuffix, text2));
670 }
671 }
672 _quotedBaseTableName = stringBuilder.ToString();
673 _hasPartialPrimaryKey = false;
674 DbSchemaRow[] array = sortedSchemaRows;
675 foreach (DbSchemaRow dbSchemaRow2 in array)
676 {
677 if (dbSchemaRow2 != null && (dbSchemaRow2.IsKey || dbSchemaRow2.IsUnique) && !dbSchemaRow2.IsLong && !dbSchemaRow2.IsRowVersion && dbSchemaRow2.IsHidden)
678 {
680 break;
681 }
682 }
683 _dbSchemaRows = sortedSchemaRows;
684 }
virtual CatalogLocation CatalogLocation
override string ToString()
StringBuilder Append(char value, int repeatCount)

References System.Data.Common.DbCommandBuilder._dbSchemaRows, System.Data.Common.DbCommandBuilder._hasPartialPrimaryKey, System.Data.Common.DbCommandBuilder._quotedBaseTableName, System.Text.StringBuilder.Append(), System.array, System.Data.Common.DbSchemaRow.BaseCatalogName, System.Data.Common.DbSchemaRow.BaseSchemaName, System.Data.Common.DbSchemaRow.BaseServerName, System.Data.Common.DbSchemaRow.BaseTableName, System.Data.Common.ADP.BuildQuotedString(), System.Data.Common.DbCommandBuilder.CatalogLocation, System.Data.Common.DbCommandBuilder.CatalogSeparator, System.Data.Common.ADP.DynamicSQLJoinUnsupported(), System.Data.Common.ADP.DynamicSQLNestedQuote(), System.Data.Common.ADP.DynamicSQLNoTableInfo(), System.Data.Common.DbSchemaRow.GetSortedSchemaRows(), System.Text.RegularExpressions.i, System.Data.Common.DbSchemaRow.IsHidden, System.Data.Common.DbSchemaRow.IsKey, System.Data.Common.DbSchemaRow.IsLong, System.Data.Common.DbSchemaRow.IsRowVersion, System.Data.Common.DbSchemaRow.IsUnique, System.Data.Common.DbCommandBuilder.QuotePrefix, System.Data.Common.DbCommandBuilder.QuoteSuffix, System.Data.Common.DbCommandBuilder.SchemaSeparator, System.Data.Common.ADP.SrcCompare(), System.text, and System.Text.StringBuilder.ToString().

Referenced by System.Data.Common.DbCommandBuilder.BuildCache().