pub fn register_gzip_functions(conn: &Connection) -> Result<()>Expand description
Register the gzip SQL functions with the given SQLite connection.
The function takes a single argument and returns the GZIP compression (blob) of that argument.
The argument can be either a string or a blob.
If the argument is NULL, the result is NULL.
ยงExample
let db = Connection::open_in_memory()?;
register_gzip_functions(&db)?;
let result: Vec<u8> = db.query_row("SELECT gzip('hello')", [], |r| r.get(0))?;
let expected = b"\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcb\x48\xcd\xc9\xc9\x07\x00\x86\xa6\x10\x36\x05\x00\x00\x00";
assert_eq!(result, expected);
let result: String = db.query_row("SELECT CAST(gzip_decode(gzip('world')) AS TEXT)", [], |r| r.get(0))?;
let expected = "world";
assert_eq!(result, expected);
let result: bool = db.query_row("SELECT gzip_test(gzip('world'))", [], |r| r.get(0))?;
let expected = true;
assert_eq!(result, expected);