% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/translate-sql-string.R
\name{sql_translation_string}
\alias{sql_translation_string}
\alias{sql_substr}
\alias{sql_str_sub}
\alias{sql_paste}
\alias{sql_paste_infix}
\title{SQL helpers for string functions}
\usage{
sql_substr(f = "SUBSTR")

sql_str_sub(subset_f = "SUBSTR", length_f = "LENGTH", optional_length = TRUE)

sql_paste(default_sep, f = "CONCAT_WS")

sql_paste_infix(default_sep, op, cast = sql_cast("text"))
}
\arguments{
\item{f}{The name of the SQL function as a string.}

\item{subset_f}{The name of the SQL substring function.}

\item{length_f}{The name of the SQL string length function.}

\item{optional_length}{Whether the length argument is optional in the SQL
substring function.}

\item{default_sep}{The default separator for paste operations.}

\item{op}{The SQL operator to use for infix paste operations.}

\item{cast}{A function to cast values to strings.}
}
\description{
These functions help you create custom string SQL translations when
implementing a new backend. They are typically used within \code{\link[=sql_translator]{sql_translator()}}
to define how R string functions should be translated to SQL.
\itemize{
\item \code{sql_substr()} creates a SQL substring function translator that converts
R's \code{substr(x, start, stop)} to SQL's \code{SUBSTR(x, start, length)}.
\item \code{sql_str_sub()} creates a SQL substring function translator that handles
stringr's \code{str_sub()} with support for negative indices.
\item \code{sql_paste()} creates a SQL paste function using \code{CONCAT_WS()} or similar.
\item \code{sql_paste_infix()} creates a SQL paste function using an infix operator
like \code{||}.
}
}
\seealso{
Other SQL translation helpers:
\code{\link{sql_translation_agg}},
\code{\link{sql_translation_scalar}},
\code{\link{sql_translation_window}},
\code{\link[=sql_variant]{sql_variant()}}
}
\concept{SQL translation helpers}
