prepareNamed method
Prepares sql with named parameters on connectionId in the worker.
Supports @name and :name syntax. Named placeholders are converted
to positional placeholders before prepare. All placeholder occurrences
are preserved so repeated names can reuse the same input value during
execution. On success, internal metadata is stored so
executePreparedNamed can bind values by name.
Implementation
Future<int> prepareNamed(
int connectionId,
String sql, {
int timeoutMs = 0,
}) async {
final extract = NamedParameterParser.extract(sql);
final stmtId = await prepare(
connectionId,
extract.cleanedSql,
timeoutMs: timeoutMs,
);
if (stmtId > 0) {
_namedParamOrderByStmtId[stmtId] = extract.paramNames;
}
return stmtId;
}