wankdanker / node-odbc

ODBC bindings for node
MIT License
174 stars 79 forks source link

Handle errors returned by SQLMoreResults #3

Closed lee-houghton closed 11 years ago

lee-houghton commented 11 years ago

See https://github.com/w1nk/node-odbc/issues/54.

This seemed like the simplest method of fixing the issue, but perhaps you can see a better way.

At the same time I've fixed the DEBUG_PRINTF call in ODBC::GetSQLError trying to print unicode messages using the normal fprintf.

I also noticed that in ODBC::GetSQLError the numfields variable is not initialized properly and has a garbage value, even after calling SQLGetDiagField -- I've added the break; in to work around this, but it should probably be fixed properly...

wankdanker commented 11 years ago

Awesome. Thank you for the pull request. Everything looks pretty good. I'm especially psyched about the Unicode debug messages. That was really bothering me!

The only exception would be that I think the proper way to handle the moreResultsSync() function would be to throw the exception from C++ and try/catch it in odbc.js. I think that's how I've handled errors in other Sync() functions. I'll take care of that though when I do this merge.

Thanks again.

Dan