[unixODBC-support] SQLSTATE changes after SQLGetDiagRecW

Frank A. U. fau at email.com
Wed Jul 31 18:52:17 BST 2013

Please have a look at the following log.

I call SQLSetEnvAttr() and it fails with the SQLSTATE error HY024.

			Environment = 0x7fffec0009f0
			Value = 0x7fffe7fafff0
			StrLen = 0
[ODBC][2718][1375292272.095848][SQLSetEnvAttr.c][256]Error: HY024

Then I'm starting to fetch the diagnostic messages.  I start by querying
for the length of the message starting with record 1.

(BTW: In case you are wondering I double the buffer size later to make
sure even UTF-16 would fit).

			Environment = 0x7fffec0009f0
			Rec Number = 1
			SQLState = (nil)
			Native = (nil)
			Message Text = (nil)
			Buffer Length = 0
			Text Len Ptr = 0x7fffe7faffe8
			SQLState = (null)
			Native = NULLPTR
			Message Text = [NULLPTR]

Next I fetch the actual message.  However the SQLSTATE suddenly changes
to S1009.  If I interpret the standard correctly this must never happen.

			Environment = 0x7fffec0009f0
			Rec Number = 1
			SQLState = 0x7fffe7faffe0
			Native = 0x7fffe7faffd8
			Message Text = 0x7fffec001d00
			Buffer Length = 99
			Text Len Ptr = (nil)
			SQLState = S1009
			Native = 0x7fffe7faffd8 -> 0
			Message Text = [[unixODBC][Driver Manager]Invalid attribute value]

More information about the unixODBC-support mailing list