I have been doing some testing in v18.1 and I’ve encountered the following situation. (Windows 10)
C_TEXT($tTest;$tResult) $tTest:="Hello" SQL LOGIN("ODBC:MyDSN";"user";"password";*) SQL SET OPTION(SQL charset;"UTF-16") SQL SET PARAMETER($tTest;SQL param in) SQL EXECUTE("SELECT ?";$tResult) SQL LOAD RECORD(SQL all records) SQL LOGOUT ASSERT($tResult=$tTest;"Failed") //this fails because $tResult has 5 space chars (0x20) appended to the end
The assert fails because the result has 5 space chars added to the end. Testing with other strings reveals that the number of spaces appended is always equal to the number of characters in the original. E.g. “Hello world” has 11 space chars appended.
The same code works as expected in v17R6 (which is what we are currently running live).
The DSN points to a Microsoft SQLLocalDB instance via the SQL Native Client 11.0 driver. I’ve also tested it pointing to Microsoft SQL Server 2017 via the ODBC Driver 17 for SQL Server. Same result.
SET SQL OPTION doesn’t make any difference.
So far I haven’t found a solution apart from trimming, but obviously that isn’t practical.
Anyone encountered anything like this?