[BLACKBOX] AW: [BLACKBOX] AW: [BLACKBOX] reading with SqlODBC3

From: Bernhardt, Gunnar <"Bernhardt,>
Date: Fri, 11 Dec 2009 18:58:42 +0100

----boundary-LibPST-iamunique-981017442_-_-
Content-type: text/plain

Hello,

my apologies for changing the language from English to German.

As I already mentioned some changes have been applied to SqlODBC3.odc between BB1.5 and BB1.6rc5. Perhaps the substitution of "LEN(str)" by "SIZE" will solve the problem, I will try this. Interestingly it is possible to apply a rather simple work-around: the file from BB1.5 works fine after recompilation in BB1.6rc5.

Perhaps some introductory words about myself are appropriate: My name is Gunnar Bernhardt (Gunnar being the first name). Aged 32 I work as a "project engineer" for a software company after having studied mechanical engineering. My work consists of taking out software to our customers, doing trainings and customizations in order to make him happy with it. Programming is a hobby for me. The only software I ever wrote for a real "user" is a system for reading measured data in a special file format and applying a non-linear fit to it.

Greetings
gunnar bernhardt


-----Ursprüngliche Nachricht-----
Von: BlackBox [mailto:BLACKBOX{([at]})nowhere.xy
Gesendet: Donnerstag, 10. Dezember 2009 19:27
An: BLACKBOX{([at]})nowhere.xy
Betreff: Re: [BLACKBOX] AW: [BLACKBOX] reading with SqlODBC3

Bernhardt, please use english in this mailing list.

The bug is easy to find in BB1.6 in SqlOdbc3.ReadString:

  WinSql.SQLGetData(t.stmt, SHORT(column + 1), WinSql.SQL_C_WCHAR,
                        SYSTEM.ADR(str), LEN(str), len)

LEN(str) ist the number of Unicode characters (SQL_C_WCHAR), which happens to be half of the buffer size. The BufferLength parameter is defined as a number of bytes.
So either use SQL_C_CHAR, as in BB<5 or adapt the buffer size. The same may be required in other procedures such as ReadVarString.
In general it may be a good idea to check all occurences of "LEN"
and replace it by "SIZE" where appropriate.

- JT


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-981017442_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZz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ZATElTVFMuT0JFUk9OLkNIXHBh
cg0KfQ=
----boundary-LibPST-iamunique-981017442_-_---
Received on Fri Dec 11 2009 - 18:58:42 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:39 UTC