Beispiel #1
0
        public virtual void InnerJoin(string table, string onTable, string onColumn, string toTable, string toColumn, string alias = null, string toAlias = null)
        {
            // Don't prefix if alias is used
            if (alias != onTable)
            {
                onTable = _tablePrefix + onTable;
            }

            if (toTable != toAlias)
            {
                toTable = _tablePrefix + toTable;
            }

            if (!String.IsNullOrEmpty(toAlias))
            {
                toTable = toAlias;
            }

            JoinSegments.Add(" INNER JOIN ");
            JoinSegments.Add(_dialect.QuoteForTableName(_tablePrefix + table));
            if (!String.IsNullOrEmpty(alias))
            {
                JoinSegments.AddRange(new[] { " AS ", _dialect.QuoteForTableName(alias) });
            }
            JoinSegments.AddRange(new[] {
                " ON ", _dialect.QuoteForTableName(onTable), ".", _dialect.QuoteForColumnName(onColumn),
                " = ", _dialect.QuoteForTableName(toTable), ".", _dialect.QuoteForColumnName(toColumn)
            }
                                  );
        }
Beispiel #2
0
 public virtual void InnerJoin(string table, string onTable, string onColumn, string toTable, string toColumn)
 {
     JoinSegments.AddRange(new[] {
         " INNER JOIN ", _dialect.QuoteForTableName(_tablePrefix + table),
         " ON ", _dialect.QuoteForTableName(_tablePrefix + onTable), ".", _dialect.QuoteForColumnName(onColumn),
         " = ", _dialect.QuoteForTableName(_tablePrefix + toTable), ".", _dialect.QuoteForColumnName(toColumn), " "
     }
                           );
 }