1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! Functions for transcoding data.
use ;
/// Decode a hex encoded string
///
/// The SQL function `dehex()` takes a single argument:
/// 1. 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
// vim: set ft=rust et sw=2 ts=2 sts=2 cinoptions=2 tw=79 :