postgresql-interfaces/psqlodbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: omeuid (@omeuid) <[email protected]>
To: postgresql-interfaces/psqlodbc <[email protected]>
Subject: [postgresql-interfaces/psqlodbc] issue #33: SQLGetData function can return an incorrect SQLSTATE
Date: Thu, 18 Jul 2024 06:15:01 +0000
Message-ID: <[email protected]> (raw)

Hi,

The ODBC API documentation of the [SQLGetData ](https://learn.microsoft.com/en-us/sql/odbc/reference/syntax/sqlgetdata-function#retrieving-data-with... says:

> If the data is NULL and StrLen_or_IndPtr was a null pointer, SQLGetData returns SQLSTATE 22002 (Indicator variable required but not supplied).

But the PostgreSQL ODBC driver returns a generic HY000 SQLSTATE.

As I understand, to fix the issue the following change could be made.

In the _copy_and_convert_field_ method from the _convert.c_ file, replace the next fragment:

```
{
    SC_set_error(stmt, STMT_RETURN_NULL_WITHOUT_INDICATOR, "StrLen_or_IndPtr was a null pointer and NULL data was retrieved", func);
    return	SQL_ERROR;
}
```

by the next one:

```
{
    SC_set_error(stmt, STMT_RETURN_NULL_WITHOUT_INDICATOR, "StrLen_or_IndPtr was a null pointer and NULL data was retrieved", func);
    return	COPY_GENERAL_ERROR;
}
```

Regards,
Carlos


view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: github://postgresql-interfaces/psqlodbc
  Cc: [email protected], [email protected]
  Subject: Re: [postgresql-interfaces/psqlodbc] issue #33: SQLGetData function can return an incorrect SQLSTATE
  In-Reply-To: <<[email protected]>>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox