postgresql-interfaces/psqlodbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feed[postgresql-interfaces/psqlodbc] issue #33: SQLGetData function can return an incorrect SQLSTATE
3+ messages / 3 participants
[nested] [flat]
* [postgresql-interfaces/psqlodbc] issue #33: SQLGetData function can return an incorrect SQLSTATE
@ 2024-07-18 06:15 "omeuid (@omeuid)" <[email protected]>
0 siblings, 0 replies; 3+ messages in thread
From: omeuid (@omeuid) @ 2024-07-18 06:15 UTC (permalink / raw)
To: postgresql-interfaces/psqlodbc <[email protected]>
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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [postgresql-interfaces/psqlodbc] issue #33: SQLGetData function can return an incorrect SQLSTATE
@ 2024-07-18 09:23 ` "Hunaid2000 (@Hunaid2000)" <[email protected]>
1 sibling, 0 replies; 3+ messages in thread
From: Hunaid2000 (@Hunaid2000) @ 2024-07-18 09:23 UTC (permalink / raw)
To: postgresql-interfaces/psqlodbc <[email protected]>
Yes, I agree with you. Actually in `PGAPI_GetData` function after `copy_and_convert_field` call that returns `SQL_ERROR` it goes in default case and overrides the error. So, `copy_and_convert_field` should return `COPY_GENERAL_ERROR`.
https://github.com/postgresql-interfaces/psqlodbc/blob/c5053678f09ac204816b7ca7d6624af0f4987e70/resu...
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [postgresql-interfaces/psqlodbc] issue #33: SQLGetData function can return an incorrect SQLSTATE
@ 2024-07-18 10:30 ` "davecramer (@davecramer)" <[email protected]>
1 sibling, 0 replies; 3+ messages in thread
From: davecramer (@davecramer) @ 2024-07-18 10:30 UTC (permalink / raw)
To: postgresql-interfaces/psqlodbc <[email protected]>
@omeuid can you provide a Pull Request please ?
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2024-07-18 10:30 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-07-18 06:15 [postgresql-interfaces/psqlodbc] issue #33: SQLGetData function can return an incorrect SQLSTATE "omeuid (@omeuid)" <[email protected]>
2024-07-18 09:23 ` "Hunaid2000 (@Hunaid2000)" <[email protected]>
2024-07-18 10:30 ` "davecramer (@davecramer)" <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox