SQLDescribeCol: fill pcbColName even when szColName is null.

This commit is contained in:
Jean-Michel Vourgère
2011-09-04 17:15:52 -04:00
committed by Brian Bruns
parent 0919ca2a89
commit 2b72bcdc6f

View File

@@ -732,12 +732,20 @@ SQLRETURN SQL_API SQLDescribeCol(
break;
}
}
if (i==table->num_cols) {
fprintf(stderr, "Column %s lost\n", (char*)sqlcol->name);
return SQL_ERROR;
}
if (szColName) {
namelen = MIN(cbColNameMax,strlen(sqlcol->name));
strncpy((char*)szColName, sqlcol->name, namelen);
szColName[namelen]='\0';
*pcbColName=namelen;
if (pcbColName)
*pcbColName=namelen;
} else {
if (pcbColName)
*pcbColName = strlen(sqlcol->name);
}
if (pfSqlType) { //Currently libmdbodbc.so returns values as string in SQLGetData() even though it is a number.
*pfSqlType = SQL_VARCHAR;//_odbc_get_client_type(col->col_type);