Skip to main content

parse_statements_with_context

Function parse_statements_with_context 

Source
pub(crate) fn parse_statements_with_context(
    sql: &str,
    path: PathBuf,
    variables: &BTreeMap<String, String>,
    profile_set: bool,
) -> Result<Vec<LocatedStatement>, ParseError>
Expand description

Parse SQL statements and add file context to any errors.

Resolves psql-style variables (:foo, :'foo', :"foo") before parsing. Returns each statement together with its byte offset within the resolved SQL so that downstream validation errors can point to the exact location.

profile_set informs the unresolved-variables error display so that the hint can direct the user to set a profile when none is active.