hdbc / hdbc-odbc

ODBC driver for HDBC
BSD 3-Clause "New" or "Revised" License
26 stars 34 forks source link

Query parameter binding code rewrite #18

Closed anton-dessiatov closed 9 years ago

anton-dessiatov commented 10 years ago

Old implementation was rather simple converthing everything to a bytestring and treating it like a C string leaving encoding issues to an undrelying ODBC driver. It also had obvious failures with buffer lengths fixed in a pull request #10. This simple behaivor resulted in many surprises with types like wide strings and binary buffers including inability to encode certain blobs because of them being treated as UTF8 strings if ODBC driver was smart enough.

This patch makes parameter marshalling code a little more sophisticated, which fixes both issues addressed by #10 and encoding-related issues with blob data types.

It worked flawlessly in my Windows project with MS SQL server for about a month, although it isn't tested with other ODBC drivers.