Skip to main content

count_params

Function count_params 

Source
pub fn count_params(sql: &str) -> usize
Expand description

Count the number of positional parameter placeholders in a SQL string.

Recognises both $N (Postgres-style) and ? (MySQL/SQLite-style) placeholders. For $N parameters, returns the highest N found. For ? parameters, returns the count.

Note: this is a simple lexical scan, not an AST analysis. It does not distinguish placeholders inside string literals.