Re: How can we handle as many quirks as possible in general fashions?
Alaric Snell-Pym 18 Sep 2019 10:18 UTC
On 18/09/2019 02:31, xxxxxx@ancell-ent.com wrote:
In general, I reckon drivers can provide their own library that can be
imported directly by apps that need to use features specific to a
specific driver.
>> The best we can do there is probably to have a "default encoding" set as
>> part of the options when making a connection, maybe with the option to
>> override it per-column when binding strings into queries through some
>> MySQL-specific mechanism....
>
> Per column optional pass throughs ... could that be a general mechanism
> to possibly accomplish other things? How else are we going to say, *this*
> value gets interpreted in *this* non-default way? How ugly might that
> make the API? Here's a bit more from Alaric on this:
I was thinking something like, assuming we have a query procedure that
binds values to a query, like so:
(query "SELECT * FROM people WHERE name = ?" user-name)
...that normally does automatic type conversions, eg if user-name is a
string it'll be handed in as a string to the DB engine using the
"default" encoding.
We might also have mysql-specific mapping from a mysql-specific opaque
type that wraps a string and an encoding to send it to the DB in:
(import (prefix mysql mysql:))
(query "SELECT * FROM people WHERE name = ?"
(mysql:encoded-string user-name 'EBCDIC))
--
Alaric Snell-Pym (M7KIT)
http://www.snell-pym.org.uk/alaric/