Reputation: 8815
For some reason, ODBC SQLDescribeCol()
always returns columnNameLength
of 0
, which screws up the logic of the code.
Running in Windows Server 2012 and SQLServer 2014 Developer.
Any idea why is it always returning columnNameLength
of 0
?
The code is here.
Upvotes: 0
Views: 294
Reputation: 8815
This turned out to be an issue for x64 build, where the parameters' sizes was incorrectly coded (it should be SQLULEN instead of SQLUINTEGER)
https://github.com/szekerest/mapserver/commit/6eb767fcaecd03960940343f9acef2ce296caf70
Upvotes: 0
Reputation: 364
Two things:
columnName
still contains a null-terminated string. Don't know much about C#, but I bet there is a way to create a string object from that. Or you could count try to find the null termination character yourself. In any case, since your external buffer
needs to be large enough to hold the largest supported column name, copying the entire columnName
buffer should be ok either way.That being said, I think if you improved your function to just return a string object, you would be much better off. Less (pointer) parameters, a meaningful return value, and error handling with exceptions. Just a suggestion, though.
Upvotes: 1