Archive: MSSQL plugin trimming returned data?


MSSQL plugin trimming returned data?
Hello again. :D

I am currently using this MSSQL plugin for some minor DB updates for my installer.

It's working quite well except for when I call the MSSQL_OLEDB::SQL_GetRow function to get the row from the last query run.
It seems to be trimming the output to 4 characters?! :weird:

So if select name from people where id = 1 would normally return "Michael" the GetRow is returning "Mich"
NOTE: This only seems to be for strings. Full Datetimes are returned.

Is there a global string length parameter that should be set? Anyone else come across this?
I can post my sample code if required?

Thanks!

Matt


Hmm I noticed the URL link is not showing above...
It is the MSSQL OLEDB plugin.
Maybe this will work?

nsis.sourceforge.net/MSSQL_OLEDB_plug-in


Hi,
I'm the author of the plugin.
someone else reported this behaviour, but I'm not able to reproduce the bug.
Can you submit your code? is the sample script given with the plugin working correctly?
let me know
regards
Stefano


Workaround suggested
Hey there

There is a work around I found.

If I convert the datatype of the returned field from varchar to nvarchar the call to SQL_GetRow works. That might be something to try in your test?

So in detailed summary:

Say have a table:

Table Name: Person
Id - int
Name - varchar[200]

If I did a select name from Person where Id = 6

If I expected "michael", when I call MSSQL_OLEDB::SQL_GetRow I would instead get "mich".

But if I changed the query to select cast(name as nvarchar) from Person where Id = 6.

When I call MSSQL_OLEDB::SQL_GetRow I am now getting "michael" as the result.

I hope this helps your testing. I am a little puzzled as to why a nvarchar and varchar would be treated differently?

Matt


I'll check the code that reads the length of a column of type varchar (and similar).
I think that there is a bug.
I'm puzzled too. If varchar is bugged, nvarchar should be too!


Ok. I think bug is fixed now. It was an offset problem in an internal buffer of the rowset class. I uploaded the new version on the official site