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 {
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 {
610 }
611 if (text2.Length == 0)
612 {
614 text2 = null;
615 }
616 if (text3.Length == 0)
617 {
619 text2 = null;
620 text3 = null;
621 }
622 if (text4 == null || text4.Length == 0)
623 {
624 throw ADP.DynamicSQLNoTableInfo();
625 }
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 }
640 if (CatalogLocation.Start == catalogLocation)
641 {
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 {
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 }
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 }
684 }
virtual string QuoteSuffix
virtual string QuotePrefix
virtual string SchemaSeparator
string _quotedBaseTableName
virtual CatalogLocation CatalogLocation
DbSchemaRow[] _dbSchemaRows
virtual string CatalogSeparator
bool _hasPartialPrimaryKey
override string ToString()
StringBuilder Append(char value, int repeatCount)