Odbc and Bytea
am 26.02.2008 16:55:54 von LuizThis is a multi-part message in MIME format.
------=OPENWEBMAIL_ATT_0.943114810480864
Content-Type: text/plain;
charset=iso-8859-1
Hi,
I discovered that ODBC driver has a slightly different behavior than libpq on
the conversion from bytea escaped sequence to the unescaped form.
Well, I was sent a wrong escaped string to a bytea column, and Odbc driver
donĀ“t return the same wrong string when retrieve it. :(
Altought for correct strings they works well, I think that is interesting that
both routines have the same behaviour.
So,I attached a modification (algorithm extracted from libpq ;) ).
Hope this can help to improve the driver.
Best Regards
Luiz
--
Plan IT Tecnologia Informatica Ltda.
------=OPENWEBMAIL_ATT_0.943114810480864
Content-Type: application/octet-stream;
name="convert.diff"
Content-Disposition: attachment; filename="convert.diff"
Content-Transfer-Encoding: base64
SW5kZXg6IGNvbnZlcnQuYw0KPT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQ0KUkNT
IGZpbGU6IC9jdnNyb290L3BzcWxvZGJjL3BzcWxvZGJjL2NvbnZlcnQuYyx2
DQpyZXRyaWV2aW5nIHJldmlzaW9uIDEuMTY2DQpkaWZmIC1yMS4xNjYgY29u
dmVydC5jDQo0Nzg5YTQ3OTAsNDc5MQ0KPiAjZGVmaW5lIElTRklSU1RPQ1RE
SUdJVChDSCkgKChDSCkgPj0gJzAnICYmIChDSCkgPD0gJzMnKQ0KPiAjZGVm
aW5lIElTT0NURElHSVQoQ0gpICgoQ0gpID49ICcwJyAmJiAoQ0gpIDw9ICc3
JykNCjQ4MDJjNDgwNA0KPCAJCWlmICh2YWx1ZVtpXSA9PSBCWVRFQV9FU0NB
UEVfQ0hBUikNCi0tLQ0KPiAJCXN3aXRjaCAodmFsdWVbaV0pDQo0ODA0LDQ4
MDVjNDgwNiw0ODM3DQo8IAkJCWlmICh2YWx1ZVtpICsgMV0gPT0gQllURUFf
RVNDQVBFX0NIQVIpDQo8IAkJCXsNCi0tLQ0KPiAJCQljYXNlIEJZ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yZGVkLg0K
PiAJCQkJICovDQo+IAkJCQlicmVhazsNCj4gDQo+IAkJCWRlZmF1bHQ6DQo0
ODA4LDQ4MjFjNDg0MCw0ODQzDQo8IAkJCQlpICs9IDI7DQo8IAkJCX0NCjwg
CQkJZWxzZQ0KPCAJCQl7DQo8IAkJCQlpZiAocmdiVmFsdWUpDQo8IAkJCQkJ
cmdiVmFsdWVbb10gPSBjb252X2Zyb21fb2N0YWwoJnZhbHVlW2ldKTsNCjwg
CQkJCWkgKz0gNDsNCjwgCQkJfQ0KPCAJCX0NCjwgCQllbHNlDQo8IAkJew0K
PCAJCQlpZiAocmdiVmFsdWUpDQo8IAkJCQlyZ2JWYWx1ZVtvXSA9IHZhbHVl
W2ldOw0KPCAJCQlpKys7DQotLS0NCj4gDQo+IAkJCQlpKys7DQo+IAkJCQlv
KysNCj4gCQkJCWJyZWFrOw0KNDgyMyw0ODI1ZDQ4NDQNCjwgCQkvKiogaWYg
KHJnYlZhbHVlKQ0KPCAJCQlteWxvZygiY29udmVydF9mcm9tX3BnYmluYXJ5
OiBpPSVkLCByZ2JWYWx1ZVslZF0gPSAlZCwgJWNcbiIsIGksIG8sIHJnYlZh
bHVlW29dLCByZ2JWYWx1ZVtvXSk7ICoqKi8NCjwgCQlvKys7DQo=
------=OPENWEBMAIL_ATT_0.943114810480864
Content-Type: text/plain
Content-Disposition: inline
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match
------=OPENWEBMAIL_ATT_0.943114810480864--