|
Database System 0.1.0
Advanced C++20 Database System with Multi-Backend Support
|
Builds JOIN clauses for SQL queries. More...
#include <join_builder.h>

Public Member Functions | |
| join_builder () | |
| join_builder & | join (const std::string &table, const std::string &condition, const std::string &alias="") |
| Add an INNER JOIN. | |
| join_builder & | left_join (const std::string &table, const std::string &condition, const std::string &alias="") |
| Add a LEFT JOIN. | |
| join_builder & | right_join (const std::string &table, const std::string &condition, const std::string &alias="") |
| Add a RIGHT JOIN. | |
| join_builder & | full_outer_join (const std::string &table, const std::string &condition, const std::string &alias="") |
| Add a FULL OUTER JOIN. | |
| join_builder & | cross_join (const std::string &table, const std::string &alias="") |
| Add a CROSS JOIN. | |
| join_builder & | add (const join_spec &spec) |
| Add a join with explicit type. | |
| std::string | build (const value_formatter &formatter) const |
| Build the JOIN clauses. | |
| bool | empty () const |
| Check if builder is empty. | |
| void | clear () |
| Clear all joins. | |
| size_t | size () const |
| Get number of joins. | |
Private Member Functions | |
| std::string | join_type_to_string (join_type type) const |
Private Attributes | |
| std::vector< join_spec > | joins_ |
Builds JOIN clauses for SQL queries.
Features:
Example:
Thread Safety:
Definition at line 65 of file join_builder.h.
|
default |
References add(), build(), clear(), cross_join(), empty(), full_outer_join(), join(), join_builder(), left_join(), right_join(), and size().
Referenced by join_builder().


| join_builder & database::query::join_builder::add | ( | const join_spec & | spec | ) |
Add a join with explicit type.
| spec | Join specification |
Definition at line 41 of file join_builder.cpp.
References joins_.
Referenced by join_builder().

| std::string database::query::join_builder::build | ( | const value_formatter & | formatter | ) | const |
Build the JOIN clauses.
| formatter | Value formatter for escaping identifiers |
Definition at line 46 of file join_builder.cpp.
References database::query::cross, empty(), database::query::value_formatter::escape_identifier(), join(), join_type_to_string(), and joins_.
Referenced by join_builder().


| void database::query::join_builder::clear | ( | ) |
Clear all joins.
Definition at line 78 of file join_builder.cpp.
References joins_.
Referenced by join_builder().

| join_builder & database::query::join_builder::cross_join | ( | const std::string & | table, |
| const std::string & | alias = "" ) |
Add a CROSS JOIN.
| table | Table to join |
| alias | Optional table alias |
Definition at line 36 of file join_builder.cpp.
References database::query::cross, and joins_.
Referenced by join_builder().

| bool database::query::join_builder::empty | ( | ) | const |
Check if builder is empty.
Definition at line 74 of file join_builder.cpp.
References joins_.
Referenced by build(), and join_builder().

| join_builder & database::query::join_builder::full_outer_join | ( | const std::string & | table, |
| const std::string & | condition, | ||
| const std::string & | alias = "" ) |
Add a FULL OUTER JOIN.
| table | Table to join |
| condition | ON condition |
| alias | Optional table alias |
Definition at line 30 of file join_builder.cpp.
References database::query::full_outer, and joins_.
Referenced by join_builder().

| join_builder & database::query::join_builder::join | ( | const std::string & | table, |
| const std::string & | condition, | ||
| const std::string & | alias = "" ) |
Add an INNER JOIN.
| table | Table to join |
| condition | ON condition |
| alias | Optional table alias |
Definition at line 12 of file join_builder.cpp.
References database::query::inner, and joins_.
Referenced by build(), and join_builder().

|
private |
Definition at line 86 of file join_builder.cpp.
References database::query::cross, database::query::full_outer, database::query::inner, database::query::left, and database::query::right.
Referenced by build().

| join_builder & database::query::join_builder::left_join | ( | const std::string & | table, |
| const std::string & | condition, | ||
| const std::string & | alias = "" ) |
Add a LEFT JOIN.
| table | Table to join |
| condition | ON condition |
| alias | Optional table alias |
Definition at line 18 of file join_builder.cpp.
References joins_, and database::query::left.
Referenced by join_builder().

| join_builder & database::query::join_builder::right_join | ( | const std::string & | table, |
| const std::string & | condition, | ||
| const std::string & | alias = "" ) |
Add a RIGHT JOIN.
| table | Table to join |
| condition | ON condition |
| alias | Optional table alias |
Definition at line 24 of file join_builder.cpp.
References joins_, and database::query::right.
Referenced by join_builder().

| size_t database::query::join_builder::size | ( | ) | const |
Get number of joins.
Definition at line 82 of file join_builder.cpp.
References joins_.
Referenced by join_builder().

|
private |
Definition at line 149 of file join_builder.h.
Referenced by add(), build(), clear(), cross_join(), empty(), full_outer_join(), join(), left_join(), right_join(), and size().