Postgres has a binary datatype. However, if your using hans's sqlid database driver with postgres, and try to save a bytestring to the postgres binary datatype, it will break when it encounters unusual charactors/bytes. (example: a ascii 0)
Note: hans's package is a planet package:
TO READ A BYTESTRING FROM POSTGRES: (from a postgres "bytea" datatype field)
(define (fix-quotes-for-sql-octal-inputstring-in)
(regexp-replace* (list->string (list#\"))
string-in
(list->string (list#\\#\\#\"))
))
(define (hans-get-everything-test)
(defineresults (sqli-querysqli"SELECT ALL * FROM blobdemo where id = 32"))
(sqli-fetchallsqli))
(letrec ([result (hans-get-everything-test)]
[data (read (open-input-string (string-append"#\""
(fix-quotes-for-sql-octal-input
(second (firstresult))) ;;;you should do somethign prettier then this to access your data. this is just for a example.
"\"")))]
data)
I've only tested this on postgres, and i've only tested it with a small amount of data so far. It may work on other database systems, but I have no way of testing that.