pub fn dehex(db: &Connection) -> Result<(), Error>Expand description
Decode a hex encoded string
The SQL function dehex() takes a single argument:
- The input hex string.
Its output will be a blob of the decoded data.
use rusqlite::Connection;
use sqlfuncs::transcode::dehex;
let conn = Connection::open_in_memory().unwrap();
dehex(&conn).unwrap();
let instr = "48656c6c6f20776f726c6421";
let buf: Vec<u8> = conn.query_row_and_then(
"SELECT dehex(?);", [instr], |row| {
row.get(0)
}).unwrap();
assert_eq!(buf, "Hello world!".to_owned().into_bytes());ยงSQLite function properties
- Deterministic
- Innocuous
- UTF8