Subject: SQLGetDiagField bug

From: V T <[email-masked]>
Date: Thu, 7 Oct 2021 02:22:31 +0300

SQLGetDiagField(SQL_DIAG_NUMBER) with SQL_HANDLE_DBC returns SQL_NO_DATA
even if an error record exists.

if I request one of unimplemented info types
SQL_DATETIME_LITERALS
SQL_STANDARD_CLI_CONFORMANCE
SQL_XOPEN_CLI_YEAR

    SQLUINTEGER bitmask;
    SQLRETURN rc;

    rc = SQLGetInfo(hdbc, SQL_DATETIME_LITERALS, &bitmask, sizeof(bitmask),
NULL); // _ASSERT(rc == 0);
    if (rc != SQL_SUCCESS)
    {
        SQLLEN numRecs;
        SQLCHAR Msg[SQL_MAX_MESSAGE_LENGTH + 1];

        rc = SQLGetDiagField(SQL_HANDLE_DBC, hdbc, 0, SQL_DIAG_NUMBER,
&numRecs, 0, nullptr); // _ASSERT(rc == 0);
        // returns SQL_NO_DATA

        // but this returns valid message
        rc = SQLGetDiagRec(SQL_HANDLE_DBC, hdbc, 1, NULL, NULL, Msg,
sizeof(Msg), NULL); _ASSERT(rc == 0);
        __debugbreak();
    }

Also there is a typo in function PGAPI_GetTypeInfo(HSTMT hstmt, SQLSMALLINT
fSqlType) [info.c]
https://git.postgresql.org/gitweb/?p=psqlodbc.git;a=blob;f=info.c;h=2ce1a5acd19052c2525bdd5b2ab02701eb6cba1d;hb=HEAD#l1161
"RECISION" should be "PRECISION"

---

From: "Inoue,Hiroshi" <[email-masked]>
Date: Mon, 11 Oct 2021 18:44:55 +0900

Hi,

Sorry for the late reply.
I would take care of this issue.

Thanks.
Hiroshi Inoue

2021年10月8日(金) 13:24 V T <[email-masked]>:

>     rc = SQLGetInfo(hdbc, SQL_DATETIME_LITERALS, &bitmask,
> sizeof(bitmask), NULL); // _ASSERT(rc == 0);
>     if (rc != SQL_SUCCESS)
>     {
>         SQLLEN numRecs;
> Also there is a typo in function PGAPI_GetTypeInfo(HSTMT hstmt,
> SQLSMALLINT fSqlType) [info.c]
>

---

From: "Inoue,Hiroshi" <[email-masked]>
Date: Wed, 13 Oct 2021 15:40:30 +0900

Hi,

Could you try test drivers on Windows?

regards,
Hiroshi Inoue