Function dysql_core::extract_params_buf
source · pub fn extract_params_buf<'a>(
o_sql: &'a str,
sql_buf: &mut Vec<u8>,
sql_dial: SqlDialect
) -> ParseSqlResult<Vec<&'a str>>Expand description
extract sql and params from raw sql
§Examples
Basic usage:
ⓘ
let sql = "select * from abc where id=:id and name=:name order by id";
let mut buf = Vec::<u8>::with_capacity(sql.len());
let rst = extract_params_buf(sql, &mut buf, SqlDialect::postgres);
assert_eq!(
("select * from abc where id=$1 and name=$2 order by id".to_owned(), vec!["id".to_owned(), "name".to_owned()]),
rst.unwrap()
);