Skip to main content

no_mistakes_postgres_engine/
statements.rs

1pub use super::view_bounds::{bounded_view_selects, BOUNDED_VIEW_MARKER};
2pub use no_mistakes_postgres_sql::statements::*;
3
4/// Extract statement facts from SQL recovered by [`crate::extract_embedded_sql_from_source`].
5///
6/// This forwards the call's exact generated-placeholder positions to bound, value-form, and
7/// relation-restriction facts, distinguishing interpolated binds from user-written identifiers
8/// with the same marker spelling. Returns `None` when the call has no recovered SQL. Fact locations remain
9/// relative to the recovered SQL text; for a `Dynamic` call, that text may contain only a
10/// verified leading statement fragment.
11pub fn extract_sql_statement_facts_for_embedded_call(
12    call: &super::EmbeddedSqlCall,
13) -> Option<SqlStatementFileFacts> {
14    let sql = call.sql_text.as_deref()?;
15    Some(extract_sql_statement_facts_with_recovered_placeholders(
16        sql,
17        true,
18        &call.recovered_placeholder_positions,
19    ))
20}