Execute a SQL query with bound parameters and return the result. Bound parameters travel through `TextFields::sql_params` as a `Vec ` — zerompk's generic array encoding serialises each element via `Value`'s hand-rolled `ToMessagePack` impl so the canonical scalar variants round-trip without a lossy JSON step. The server inlines each value as a SQL literal before planning, so `$1`, `$2`, … p
(
&mut self,
sql: &str,
params: &[nodedb_types::Value],
)
| 250 | /// Empty `params` routes through the same opcode but omits the |
| 251 | /// field, equivalent to `execute_sql`. |
| 252 | pub async fn execute_sql_with_params( |
| 253 | &mut self, |
| 254 | sql: &str, |
| 255 | params: &[nodedb_types::Value], |
| 256 | ) -> NodeDbResult<QueryResult> { |
| 257 | let sql_params = if params.is_empty() { |
| 258 | None |
| 259 | } else { |
| 260 | Some(params.to_vec()) |
| 261 | }; |
| 262 | let resp = self |
| 263 | .send( |
| 264 | OpCode::Sql, |
| 265 | TextFields { |
| 266 | sql: Some(sql.to_string()), |
| 267 | sql_params, |
| 268 | ..Default::default() |
| 269 | }, |
| 270 | ) |
| 271 | .await?; |
| 272 | response_to_query_result(resp) |
| 273 | } |
| 274 | |
| 275 | /// Execute a DDL command. |
| 276 | pub async fn execute_ddl(&mut self, sql: &str) -> NodeDbResult<QueryResult> { |
no test coverage detected