prepareStatementNamed method
Prepares a SQL statement with named parameters and returns a
PreparedStatement wrapper that supports executeNamed.
Supports @name and :name syntax. Converts to positional placeholders
before preparing. The returned PreparedStatement can use
executeNamed with a map of parameter values.
Implementation
PreparedStatement? prepareStatementNamed(
int connectionId,
String sql, {
int timeoutMs = 0,
}) {
final extractResult = NamedParameterParser.extract(sql);
final stmtId =
prepare(connectionId, extractResult.cleanedSql, timeoutMs: timeoutMs);
if (stmtId == 0) return null;
return PreparedStatement(
this,
stmtId,
paramNamesForNamedExecution: extractResult.paramNames,
);
}