From e5d8d42eae6ce486678d87e33c1a7c26e2a6c1a1 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 15 Feb 2023 10:01:00 -0500 Subject: Added antogram and antophone querying --- lib/field.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'lib/field.h') 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 { object joinWith, bool nullable = false) { - return field(obj, type::join, name, nullable, 0, joinWith); + return field(obj, type::join, name, nullable, 0, joinWith, name); } static field joinField( @@ -94,7 +94,7 @@ namespace verbly { const char* table, bool nullable = false) { - return field(obj, type::join, name, nullable, table); + return field(obj, type::join, name, nullable, table, obj, name); } static field joinWhere( @@ -105,7 +105,7 @@ namespace verbly { int conditionValue, bool nullable = false) { - return field(obj, type::join_where, name, nullable, 0, joinWith, 0, 0, 0, conditionColumn, conditionValue); + return field(obj, type::join_where, name, nullable, 0, joinWith, name, 0, 0, conditionColumn, conditionValue); } static field joinThrough( @@ -153,6 +153,14 @@ namespace verbly { return field(obj, type::join_through, name, true, joinTable, obj, name, joinColumn, foreignJoinColumn); } + static field selfJoin( + object obj, + const char* name, + const char* foreignColumn) + { + return field(obj, type::join, name, true, 0, obj, foreignColumn); + } + static field hierarchalSelfJoin( object obj, const char* name, @@ -220,9 +228,9 @@ namespace verbly { const char* getForeignColumn() const { // We ignore hierarchal joins because they are always self joins. - return ((type_ == type::join_through) || (type_ == type::join_through_where)) + return ((type_ == type::join) || (type_ == type::join_through) || (type_ == type::join_through_where)) ? foreignColumn_ - : throw std::domain_error("Only many-to-many join fields have a foreign column"); + : throw std::domain_error("Only join fields have a foreign column"); } const char* getJoinColumn() const -- cgit 1.4.1