Send proper datatypes to the server when binding parameters.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 16 Jan 2015 21:18:47 +0000 (23:18 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 16 Jan 2015 21:18:47 +0000 (23:18 +0200)
commit1ccd04c70b8037b268eefcaae09ce131c8c33b59
treef69878f362cda69512ce8382b6876ee4328c9c60
parent19365af79a8615b1e52c24b02ab4c3c9b2a50444
Send proper datatypes to the server when binding parameters.

We used to always send 0 as the parameter type, which means that the server
should deduce the datatype from the context. That usually works well, but
we can do better. Sometimes there is ambiguity, like in "SELECT '555' > ?".
If the parameter is bound as a string, '6' would return true, but if it's
bound as an integer, it returns false.

When the application calls SQLBindParameter, it specifies the datatype, so
we should make use of that.

Add a test case for the "SELECT '555' > ?" case.
convert.c
convert.h
pgtypes.c
pgtypes.h
statement.c
test/expected/param-conversions.out
test/expected/param-conversions_1.out
test/src/param-conversions-test.c