Index: driver/results.c =================================================================== --- driver/results.c (revision 775) +++ driver/results.c (working copy) @@ -531,11 +531,13 @@ *pnColumnSize= get_column_size(stmt, field, FALSE); if (pibScale) *pibScale= max(0, get_decimal_digits(stmt, field)); - if ( pfNullable ) - *pfNullable= (((field->flags & (NOT_NULL_FLAG)) == - NOT_NULL_FLAG) ? - SQL_NO_NULLS : - SQL_NULLABLE); + if (pfNullable) + if ((field->flags & NOT_NULL_FLAG) && + !(field->flags & TIMESTAMP_FLAG) && + !(field->flags & AUTO_INCREMENT_FLAG)) + *pfNullable= SQL_NO_NULLS; + else + *pfNullable= SQL_NULLABLE; if ( stmt->dbc->flag & FLAG_FULL_COLUMN_NAMES && field->table ) { Index: test/my_datetime.c =================================================================== --- test/my_datetime.c (revision 775) +++ test/my_datetime.c (working copy) @@ -821,6 +821,7 @@ DECLARE_TEST(t_bug14414) { SQLCHAR col[10]; + SQLSMALLINT nullable; ok_sql(hstmt, "DROP TABLE IF EXISTS t_bug14414"); ok_sql(hstmt, "CREATE TABLE t_bug14414(a TIMESTAMP, b TIMESTAMP NOT NULL," @@ -848,6 +849,26 @@ ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_CLOSE)); + /** + Bug #26108 MyODBC ADO field attributes reporting adFldMayBeNull for + not null columns + */ + ok_sql(hstmt, "SELECT * FROM t_bug14414"); + + ok_stmt(hstmt, SQLDescribeCol(hstmt, 1, NULL, 0, NULL, NULL, NULL, NULL, + &nullable)); + is_num(nullable, SQL_NULLABLE); + + ok_stmt(hstmt, SQLDescribeCol(hstmt, 2, NULL, 0, NULL, NULL, NULL, NULL, + &nullable)); + is_num(nullable, SQL_NO_NULLS); + + ok_stmt(hstmt, SQLDescribeCol(hstmt, 3, NULL, 0, NULL, NULL, NULL, NULL, + &nullable)); + is_num(nullable, SQL_NULLABLE); + + ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_CLOSE)); + ok_sql(hstmt, "DROP TABLE IF EXISTS t_bug14414"); return OK; } Index: test/my_catalog.c =================================================================== --- test/my_catalog.c (revision 775) +++ test/my_catalog.c (working copy) @@ -1094,6 +1094,7 @@ DECLARE_TEST(t_bug14407) { SQLCHAR col[10]; + SQLSMALLINT nullable; ok_sql(hstmt, "DROP TABLE IF EXISTS t_bug14407"); ok_sql(hstmt, @@ -1111,6 +1112,18 @@ ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_CLOSE)); + /** + Bug #26108 MyODBC ADO field attributes reporting adFldMayBeNull for + not null columns + */ + ok_sql(hstmt, "SELECT * FROM t_bug14407"); + + ok_stmt(hstmt, SQLDescribeCol(hstmt, 1, NULL, 0, NULL, NULL, NULL, NULL, + &nullable)); + is_num(nullable, SQL_NULLABLE); + + ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_CLOSE)); + ok_sql(hstmt, "DROP TABLE IF EXISTS t_bug14407"); return OK; } Index: ChangeLog =================================================================== --- ChangeLog (revision 777) +++ ChangeLog (working copy) @@ -3,6 +3,8 @@ Functionality added or changed: Bugs fixed: + * SQLDescribeCol() incorrectly reported whether auto-increment and + some timestamp fields were nullable. (Bug #26108) * Empty selection for database and character set comboboxes in setup were set to " " instead of an empty string. (Bug #30568)