Class: ClickHouse::SQL::Join
- Inherits:
-
Object
- Object
- ClickHouse::SQL::Join
- Includes:
- Part
- Defined in:
- lib/clickhouse/sql/join.rb
Instance Method Summary collapse
-
#initialize(table, type:, as: nil, final: false, on:) ⇒ ClickHouse::SQL::Join
constructor
Builds a rendered JOIN clause.
-
#placeholder_types ⇒ Hash{Symbol=>String}
Returns ClickHouse placeholder types used by the JOIN.
-
#placeholders ⇒ Hash{Symbol=>Object}
Returns typed placeholder values used by the JOIN.
-
#to_redacted_sql(bind_index_manager) ⇒ String
Renders the JOIN with typed placeholders replaced by bind markers.
-
#to_sql ⇒ String
Renders the JOIN with ClickHouse typed placeholders intact.
Constructor Details
#initialize(table, type:, as: nil, final: false, on:) ⇒ ClickHouse::SQL::Join
Builds a rendered JOIN clause.
17 18 19 20 21 22 23 24 |
# File 'lib/clickhouse/sql/join.rb', line 17 def initialize(table, type:, as: nil, final: false, on:) @table = ClickHouse::SQL.coerce_raw_expression(table) @type = type @alias_name = ClickHouse::SQL.resolve_table_alias(table, as) @final = final @on = Array(on).flatten.compact.map { |condition| ClickHouse::SQL.coerce_expression(condition) } raise Error, "JOIN requires at least one ON condition" if @on.empty? end |
Instance Method Details
#placeholder_types ⇒ Hash{Symbol=>String}
Returns ClickHouse placeholder types used by the JOIN.
51 52 53 |
# File 'lib/clickhouse/sql/join.rb', line 51 def placeholder_types ClickHouse::SQL.collect_placeholder_types([@table, *@on]) end |
#placeholders ⇒ Hash{Symbol=>Object}
Returns typed placeholder values used by the JOIN.
44 45 46 |
# File 'lib/clickhouse/sql/join.rb', line 44 def placeholders ClickHouse::SQL.collect_placeholders([@table, *@on]) end |
#to_redacted_sql(bind_index_manager) ⇒ String
Renders the JOIN with typed placeholders replaced by bind markers.
37 38 39 |
# File 'lib/clickhouse/sql/join.rb', line 37 def to_redacted_sql(bind_index_manager) render(redacted: true, bind_index_manager:) end |
#to_sql ⇒ String
Renders the JOIN with ClickHouse typed placeholders intact.
29 30 31 |
# File 'lib/clickhouse/sql/join.rb', line 29 def to_sql render(redacted: false) end |