Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Naming the returned fields #33
I noticed that when I test my application on my local machine, the returned fields look like this:
but when I move this app into server, the fields fetched look like this:
Database used is DB2. The ODBC-driver's version is different on the server than on my local machine, so I guess that is the reason for the above behavior.
However, the problem is that I am fetching field that has totally different name than CREATED_DATE. The field is named as SBCHA.
Why is the returned field translated (SBCHA -> CREATED_DATE)? How can I toggle this feature off?
This comment has been minimized.
This comment has been minimized.Show comment Hide comment
I am not familiar with DB2, but is there any way to tell if the column has a label? We use this code to grab the column name from here:
ret = SQLColAttribute( self->m_hStmt, //StatementHandle (SQLUSMALLINT)i+1, //ColumnNumber SQL_DESC_LABEL, //FieldIdentifier columns[i].name, //CharacterAttributePtr (SQLSMALLINT)MAX_FIELD_SIZE, //BufferLength (SQLSMALLINT *)&buflen, //StringLengthPtr NULL); //NumericAttributePtr
Where SQL_DESC_LABEL is the attribute type we are requesting. IBM's DB2 9.7 docs describe SQL_DESC_LABEL (DB2 CLI/v2) as:
It looks like SQL_DESC_NAME could be used instead, but Microsoft's documents indicate that is an ODBC 3.0 attribute. I'm not sure if it would cause other issues if we start using more features from ODBC 3.0.