[unixODBC-support] Buffer Lengths in Chars or Bytes?
Frank A. U.
fau at email.com
Thu Jul 18 19:13:43 BST 2013
How are string lengths communicated in ODBC?
If an ODBC function wants to pass a string to the application I assume
that the application has to allocate a buffer and pass it and the length
of that buffer as input to the ODBC function.
For specifying the length of the input buffer there are generally two
possibilities: number of chars or number of bytes.
I do not have much experience with ODBC and just starting to read the MS
reference. For example it says SQLGetDiagRec() expects the buffer
length to be the number of chars which works fine for any fixed length
char encoding (e.g. ISO-8859-1 or UCS-16). However it leaves out the
case of UTF-8 where the char byte length varies. The only working
solution that comes to my mind is to pass the buffer length in bytes in
Are my assumptions correct?
More information about the unixODBC-support