summary refs log tree commit diff stats
path: root/lib/field.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/field.h')
-rw-r--r--lib/field.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/field.h b/lib/field.h index f799900..93dab97 100644 --- a/lib/field.h +++ b/lib/field.h
@@ -85,7 +85,7 @@ namespace verbly {
85 object joinWith, 85 object joinWith,
86 bool nullable = false) 86 bool nullable = false)
87 { 87 {
88 return field(obj, type::join, name, nullable, 0, joinWith); 88 return field(obj, type::join, name, nullable, 0, joinWith, name);
89 } 89 }
90 90
91 static field joinField( 91 static field joinField(
@@ -94,7 +94,7 @@ namespace verbly {
94 const char* table, 94 const char* table,
95 bool nullable = false) 95 bool nullable = false)
96 { 96 {
97 return field(obj, type::join, name, nullable, table); 97 return field(obj, type::join, name, nullable, table, obj, name);
98 } 98 }
99 99
100 static field joinWhere( 100 static field joinWhere(
@@ -105,7 +105,7 @@ namespace verbly {
105 int conditionValue, 105 int conditionValue,
106 bool nullable = false) 106 bool nullable = false)
107 { 107 {
108 return field(obj, type::join_where, name, nullable, 0, joinWith, 0, 0, 0, conditionColumn, conditionValue); 108 return field(obj, type::join_where, name, nullable, 0, joinWith, name, 0, 0, conditionColumn, conditionValue);
109 } 109 }
110 110
111 static field joinThrough( 111 static field joinThrough(
@@ -153,6 +153,14 @@ namespace verbly {
153 return field(obj, type::join_through, name, true, joinTable, obj, name, joinColumn, foreignJoinColumn); 153 return field(obj, type::join_through, name, true, joinTable, obj, name, joinColumn, foreignJoinColumn);
154 } 154 }
155 155
156 static field selfJoin(
157 object obj,
158 const char* name,
159 const char* foreignColumn)
160 {
161 return field(obj, type::join, name, true, 0, obj, foreignColumn);
162 }
163
156 static field hierarchalSelfJoin( 164 static field hierarchalSelfJoin(
157 object obj, 165 object obj,
158 const char* name, 166 const char* name,
@@ -220,9 +228,9 @@ namespace verbly {
220 const char* getForeignColumn() const 228 const char* getForeignColumn() const
221 { 229 {
222 // We ignore hierarchal joins because they are always self joins. 230 // We ignore hierarchal joins because they are always self joins.
223 return ((type_ == type::join_through) || (type_ == type::join_through_where)) 231 return ((type_ == type::join) || (type_ == type::join_through) || (type_ == type::join_through_where))
224 ? foreignColumn_ 232 ? foreignColumn_
225 : throw std::domain_error("Only many-to-many join fields have a foreign column"); 233 : throw std::domain_error("Only join fields have a foreign column");
226 } 234 }
227 235
228 const char* getJoinColumn() const 236 const char* getJoinColumn() const