MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / bind_and_format

Function bind_and_format

nodedb-sql/src/params.rs:99–109  ·  view source on GitHub ↗
(sql: &str, params: &[ParamValue])

Source from the content-addressed store, hash-verified

97 use crate::parser::statement::parse_sql;
98
99 fn bind_and_format(sql: &str, params: &[ParamValue]) -> String {
100 let mut stmts = parse_sql(sql).unwrap();
101 for stmt in &mut stmts {
102 bind_params(stmt, params);
103 }
104 stmts
105 .iter()
106 .map(|s| s.to_string())
107 .collect::<Vec<_>>()
108 .join("; ")
109 }
110
111 #[test]
112 fn bind_select_where() {

Callers 15

bind_select_whereFunction · 0.85
bind_string_paramFunction · 0.85
bind_null_paramFunction · 0.85
bind_multiple_paramsFunction · 0.85
bind_insert_valuesFunction · 0.85
bind_bool_paramFunction · 0.85
no_params_noopFunction · 0.85
bind_array_elementsFunction · 0.85
bind_any_op_rhsFunction · 0.85
bind_all_op_rhsFunction · 0.85

Calls 5

bind_paramsFunction · 0.85
joinMethod · 0.80
to_stringMethod · 0.80
parse_sqlFunction · 0.50
iterMethod · 0.45

Tested by 15

bind_select_whereFunction · 0.68
bind_string_paramFunction · 0.68
bind_null_paramFunction · 0.68
bind_multiple_paramsFunction · 0.68
bind_insert_valuesFunction · 0.68
bind_bool_paramFunction · 0.68
no_params_noopFunction · 0.68
bind_array_elementsFunction · 0.68
bind_any_op_rhsFunction · 0.68
bind_all_op_rhsFunction · 0.68