Selecto.Builder.Sql.Helpers (Selecto v0.4.3)

Helper functions shared by SQL builder modules.

Responsibilities include:

  • adapter-aware identifier quoting
  • identifier safety validation
  • selector and join string construction
  • support helpers for parameterized join aliases

Link to this section Summary

Functions

Build join alias string for parameterized joins.

Build selector string for parameterized joins with signature support.

Always quote an identifier through the active adapter.

Get the appropriate quote character for identifiers based on the database adapter. PostgreSQL uses double quotes, MySQL uses backticks, SQLite uses double quotes.

Maybe quote an identifier - only adds quotes if necessary.

Check if an identifier needs quoting. Only quote if it's a reserved word, contains special characters, or has mixed case.

Wrap an identifier with the appropriate quotes for the database adapter. This is the adapter-aware version of double_wrap.

Link to this section Functions

Link to this function

build_join_string(selecto, join)

Link to this function

build_parameterized_join_string(selecto, join, parameter_signature \\ nil)

Build join alias string for parameterized joins.

Link to this function

build_parameterized_selector_string(selecto, join, field, parameter_signature \\ nil)

Build selector string for parameterized joins with signature support.

Link to this function

build_selector_string(selecto, join, field)

Link to this function

check_string(str)

Link to this function

double_wrap(str)

Link to this function

force_quote_identifier(selecto, str)

Always quote an identifier through the active adapter.

Link to this function

get_quote_char(selecto)

Get the appropriate quote character for identifiers based on the database adapter. PostgreSQL uses double quotes, MySQL uses backticks, SQLite uses double quotes.

Link to this function

maybe_quote_identifier(str)

Maybe quote an identifier - only adds quotes if necessary.

Link to this function

needs_quoting?(str)

Check if an identifier needs quoting. Only quote if it's a reserved word, contains special characters, or has mixed case.

Link to this function

quote_identifier(selecto, str)

Wrap an identifier with the appropriate quotes for the database adapter. This is the adapter-aware version of double_wrap.

Link to this function

single_wrap(val)