Skip to content

Commit 3835a19

Browse files
committed
Added more overloads for JoinColumnPair
1 parent 6d18675 commit 3835a19

File tree

1 file changed

+174
-9
lines changed

1 file changed

+174
-9
lines changed

dg.Sql/Sql/QueryKeywords/Join.cs

Lines changed: 174 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace dg.Sql
66
{
77
internal class JoinList : List<Join> { }
8+
89
public class JoinColumnPair : WhereList
910
{
1011
public const string RIGHT_TABLE_PLACEHOLDER_ID = @"__RIGHT_TABLE_PLACEHOLDER_ID__";
@@ -43,73 +44,237 @@ public JoinColumnPair(string leftTableNameOrAlias, string leftColumn, object val
4344
this.Add(w);
4445
}
4546

47+
[Obsolete("Use AND")]
4648
public JoinColumnPair JoinAND(TableSchema leftTableSchema, string leftColumn, string rightColumn)
49+
{
50+
return AND(leftTableSchema, leftColumn, rightColumn);
51+
}
52+
53+
[Obsolete("Use AND")]
54+
public JoinColumnPair JoinAND(string leftTableNameOrAlias, string leftColumn, string rightColumn)
55+
{
56+
return AND(leftTableNameOrAlias, leftColumn, rightColumn);
57+
}
58+
59+
[Obsolete("Use AND")]
60+
public JoinColumnPair JoinAND(object value, string rightColumn)
61+
{
62+
return AND(value, rightColumn);
63+
}
64+
65+
[Obsolete("Use AND")]
66+
public JoinColumnPair JoinAND(object value, bool literalValue, string rightColumn)
67+
{
68+
return AND(value, literalValue, rightColumn);
69+
}
70+
71+
[Obsolete("Use AND")]
72+
public JoinColumnPair JoinAND(string leftTableNameOrAlias, string leftColumn, object value, bool literalValue)
73+
{
74+
return AND(leftTableNameOrAlias, leftColumn, value, literalValue);
75+
}
76+
77+
[Obsolete("Use OR")]
78+
public JoinColumnPair JoinOR(TableSchema leftTableSchema, string leftColumn, string rightColumn)
79+
{
80+
return OR(leftTableSchema, leftColumn, rightColumn);
81+
}
82+
83+
[Obsolete("Use OR")]
84+
public JoinColumnPair JoinOR(string leftTableNameOrAlias, string leftColumn, string rightColumn)
85+
{
86+
return OR(leftTableNameOrAlias, leftColumn, rightColumn);
87+
}
88+
89+
[Obsolete("Use OR")]
90+
public JoinColumnPair JoinOR(object value, string rightColumn)
91+
{
92+
return OR(value, rightColumn);
93+
}
94+
95+
[Obsolete("Use OR")]
96+
public JoinColumnPair JoinOR(object value, bool literalValue, string rightColumn)
97+
{
98+
return OR(value, literalValue, rightColumn);
99+
}
100+
101+
[Obsolete("Use OR")]
102+
public JoinColumnPair JoinOR(string leftTableNameOrAlias, string leftColumn, object value, bool literalValue)
103+
{
104+
return OR(leftTableNameOrAlias, leftColumn, value, literalValue);
105+
}
106+
107+
public JoinColumnPair AND(TableSchema leftTableSchema, string leftColumn, string rightColumn)
47108
{
48109
this.Add(new Where(WhereCondition.AND, leftTableSchema.Name, leftColumn, WhereComparison.EqualsTo, RIGHT_TABLE_PLACEHOLDER_ID, rightColumn));
49110
return this;
50111
}
51112

52-
public JoinColumnPair JoinAND(string leftTableNameOrAlias, string leftColumn, string rightColumn)
113+
public JoinColumnPair AND(string leftTableNameOrAlias, string leftColumn, string rightColumn)
53114
{
54115
this.Add(new Where(WhereCondition.AND, leftTableNameOrAlias, leftColumn, WhereComparison.EqualsTo, RIGHT_TABLE_PLACEHOLDER_ID, rightColumn));
55116
return this;
56117
}
57118

58-
public JoinColumnPair JoinAND(object value, string rightColumn)
119+
public JoinColumnPair AND(object value, string rightColumn)
59120
{
60121
this.Add(new Where(WhereCondition.AND, RIGHT_TABLE_PLACEHOLDER_ID, rightColumn, WhereComparison.EqualsTo, value));
61122
return this;
62123
}
63124

64-
public JoinColumnPair JoinAND(object value, bool literalValue, string rightColumn)
125+
public JoinColumnPair AND(object value, bool literalValue, string rightColumn)
65126
{
66127
Where w = new Where(WhereCondition.AND, RIGHT_TABLE_PLACEHOLDER_ID, rightColumn, WhereComparison.EqualsTo, value);
67128
if (literalValue) w.SecondType = ValueObjectType.Literal;
68129
this.Add(w);
69130
return this;
70131
}
71-
public JoinColumnPair JoinAND(string leftTableNameOrAlias, string leftColumn, object value, bool literalValue)
132+
133+
public JoinColumnPair AND(string leftTableNameOrAlias, string leftColumn, object value, bool literalValue)
72134
{
73135
Where w = new Where(WhereCondition.AND, leftTableNameOrAlias, leftColumn, WhereComparison.EqualsTo, value);
74136
if (literalValue) w.SecondType = ValueObjectType.Literal;
75137
this.Add(w);
76138
return this;
77139
}
78140

79-
public JoinColumnPair JoinOR(TableSchema leftTableSchema, string leftColumn, string rightColumn)
141+
public new JoinColumnPair AND(object thisObject, ValueObjectType thisObjectType, WhereComparison comparison, object thatObject, ValueObjectType thatObjectType)
142+
{
143+
base.AND(thisObject, thisObjectType, comparison, thatObject, thatObjectType);
144+
return this;
145+
}
146+
147+
public new JoinColumnPair AND(IPhrase phrase)
148+
{
149+
base.AND(phrase);
150+
return this;
151+
}
152+
153+
public new JoinColumnPair AND(IPhrase phrase, WhereComparison comparison, object value)
154+
{
155+
base.AND(phrase, comparison, value);
156+
return this;
157+
}
158+
159+
public new JoinColumnPair AND(IPhrase phrase, WhereComparison comparison, object value, ValueObjectType valueType)
160+
{
161+
base.AND(phrase, comparison, value, valueType);
162+
return this;
163+
}
164+
165+
public new JoinColumnPair AND(IPhrase phrase, WhereComparison comparison, string tableName, string columnName)
166+
{
167+
base.AND(phrase, comparison, tableName, columnName);
168+
return this;
169+
}
170+
171+
public new JoinColumnPair AND(WhereList whereList)
172+
{
173+
base.AND(whereList);
174+
return this;
175+
}
176+
177+
public new JoinColumnPair AND(string tableName, string columnName, WhereComparison comparison, object columnValue)
178+
{
179+
base.AND(tableName, columnName, comparison, columnValue);
180+
return this;
181+
}
182+
183+
public new JoinColumnPair AND(string tableName, string columnName, WhereComparison comparison, string otherTableName, string otherColumnName)
184+
{
185+
base.AND(tableName, columnName, comparison, otherTableName, otherColumnName);
186+
return this;
187+
}
188+
189+
public JoinColumnPair OR(TableSchema leftTableSchema, string leftColumn, string rightColumn)
80190
{
81191
this.Add(new Where(WhereCondition.OR, leftTableSchema.Name, leftColumn, WhereComparison.EqualsTo, RIGHT_TABLE_PLACEHOLDER_ID, rightColumn));
82192
return this;
83193
}
84194

85-
public JoinColumnPair JoinOR(string leftTableNameOrAlias, string leftColumn, string rightColumn)
195+
public JoinColumnPair OR(string leftTableNameOrAlias, string leftColumn, string rightColumn)
86196
{
87197
this.Add(new Where(WhereCondition.OR, leftTableNameOrAlias, leftColumn, WhereComparison.EqualsTo, RIGHT_TABLE_PLACEHOLDER_ID, rightColumn));
88198
return this;
89199
}
90200

91-
public JoinColumnPair JoinOR(object value, string rightColumn)
201+
public JoinColumnPair OR(object value, string rightColumn)
92202
{
93203
this.Add(new Where(WhereCondition.OR, RIGHT_TABLE_PLACEHOLDER_ID, rightColumn, WhereComparison.EqualsTo, value));
94204
return this;
95205
}
96206

97-
public JoinColumnPair JoinOR(object value, bool literalValue, string rightColumn)
207+
public JoinColumnPair OR(object value, bool literalValue, string rightColumn)
98208
{
99209
Where w = new Where(WhereCondition.OR, RIGHT_TABLE_PLACEHOLDER_ID, rightColumn, WhereComparison.EqualsTo, value);
100210
if (literalValue) w.SecondType = ValueObjectType.Literal;
101211
this.Add(w);
102212
return this;
103213
}
104214

105-
public JoinColumnPair JoinOR(string leftTableNameOrAlias, string leftColumn, object value, bool literalValue)
215+
public JoinColumnPair OR(string leftTableNameOrAlias, string leftColumn, object value, bool literalValue)
106216
{
107217
Where w = new Where(WhereCondition.OR, leftTableNameOrAlias, leftColumn, WhereComparison.EqualsTo, value);
108218
if (literalValue) w.SecondType = ValueObjectType.Literal;
109219
this.Add(w);
110220
return this;
111221
}
222+
223+
public new JoinColumnPair OR(object thisObject, ValueObjectType thisObjectType, WhereComparison comparison, object thatObject, ValueObjectType thatObjectType)
224+
{
225+
base.OR(thisObject, thisObjectType, comparison, thatObject, thatObjectType);
226+
return this;
227+
}
228+
229+
public new JoinColumnPair OR(string columnName, WhereComparison comparison, object columnValue)
230+
{
231+
base.OR(columnName, comparison, columnValue);
232+
return this;
233+
}
234+
235+
public new JoinColumnPair OR(IPhrase phrase)
236+
{
237+
base.OR(phrase);
238+
return this;
239+
}
240+
241+
public new JoinColumnPair OR(IPhrase phrase, WhereComparison comparison, object value)
242+
{
243+
base.OR(phrase, comparison, value);
244+
return this;
245+
}
246+
247+
public new JoinColumnPair OR(IPhrase phrase, WhereComparison comparison, object value, ValueObjectType valueType)
248+
{
249+
base.OR(phrase, comparison, value, valueType);
250+
return this;
251+
}
252+
253+
public new JoinColumnPair OR(IPhrase phrase, WhereComparison comparison, string tableName, string columnName)
254+
{
255+
base.OR(phrase, comparison, tableName, columnName);
256+
return this;
257+
}
258+
259+
public new JoinColumnPair OR(WhereList whereList)
260+
{
261+
base.OR(whereList);
262+
return this;
263+
}
264+
265+
public new JoinColumnPair OR(string tableName, string columnName, WhereComparison comparison, object columnValue)
266+
{
267+
base.OR(tableName, columnName, comparison, columnValue);
268+
return this;
269+
}
270+
271+
public new JoinColumnPair OR(string tableName, string columnName, WhereComparison comparison, string otherTableName, string otherColumnName)
272+
{
273+
base.OR(tableName, columnName, comparison, otherTableName, otherColumnName);
274+
return this;
275+
}
112276
}
277+
113278
internal class Join
114279
{
115280
private JoinType _JoinType;

0 commit comments

Comments
 (0)