Skip to content

Commit

Permalink
Merge pull request wankdanker#85 from markdirish/2.3.0-date-time-size
Browse files Browse the repository at this point in the history
2.3.0 date time size
  • Loading branch information
markdirish authored Apr 30, 2020
2 parents 60aa6e4 + a028006 commit 5d87dc5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/odbc_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2032,6 +2032,22 @@ SQLRETURN ODBCConnection::BindColumns(QueryData *data) {
DEBUG_PRINTF("[SQLHENV: %p][SQLHDBC: %p][SQLHSTMT: %p] ODBCConnection::BindColumns(): SQLDescribeCol FAILED: SQLRETURN = %d\n", this->hENV, this->hDBC, data->hSTMT, data->sqlReturnCode);
return data->sqlReturnCode;
}

// ensuring ColumnSize values are valid according to ODBC docs
if (column->DataType == SQL_TYPE_DATE && column->ColumnSize < 10) {
// ODBC docs say this should be 10, but some drivers have bugs that
// return invalid values. eg. 4D
// Ensure that it is a minimum of 10.
column->ColumnSize = 10;
}

if (column->DataType == SQL_TYPE_TIME && column->ColumnSize < 8) {
// ODBC docs say this should be 8, but some drivers have bugs that
// return invalid values. eg. 4D
// Ensure that it is a minimum of 8.
column->ColumnSize = 8;
}

DEBUG_PRINTF("[SQLHENV: %p][SQLHDBC: %p][SQLHSTMT: %p] ODBCConnection::BindColumns(): SQLDescribeCol passed: ColumnName = %s, NameLength = %d, DataType = %d, ColumnSize = %lu, DecimalDigits = %d, Nullable = %d\n", this->hENV, this->hDBC, data->hSTMT, column->ColumnName, column->NameLength, column->DataType, column->ColumnSize, column->DecimalDigits, column->Nullable);
// bind depending on the column
switch(column->DataType) {
Expand Down

0 comments on commit 5d87dc5

Please sign in to comment.