public inbox for [email protected]  
help / color / mirror / Atom feed
From: Daniel Kempenich <[email protected]>
To: [email protected]
Subject: psqlodbc copy_and_convert_field "Unrecognized return value"
Date: Thu, 17 Mar 2022 13:14:05 -0500
Message-ID: <CAFSohAUzatQJ-exEXnEVN3St_d+sxyqxZUXRSXjC=-H1A8XZuA@mail.gmail.com> (raw)

In my client code I was seeing the message through the odbc driver:
native=<8> sqlerror=<Unrecognized return value from
copy_and_convert_field.> sqlstate=<HY000> during a fetch.  There are only a
few places where copy_and_convert_field return SQL_ERROR instead of a COPY
specific or COPY_GENERAL_ERROR with a message.  I believe it comes from
psqlodbc's results.c when the convert returns SQL_ERROR instead of COPY_*

Would it be possible to update the convert.c to something like the
following to print a more specific message to aid in debugging?

Thanks,
Dan.

(From the git branch: REL-13_02_0000)

diff --git a/convert.c b/convert.c
index d94fdb6..e525bd1 100644
--- a/convert.c
+++ b/convert.c
@@ -1277,7 +1277,8 @@ copy_and_convert_field(StatementClass *stmt,
        {
                if (stmt->current_col >= opts->allocated)
                {
-                       return SQL_ERROR;
+                       SC_set_error(stmt, STMT_INTERNAL_ERROR, "current
column is greater than amount allocated", func);
+                       return  COPY_GENERAL_ERROR;
                }
                if (gdata->allocated != opts->allocated)
                        extend_getdata_info(gdata, opts->allocated, TRUE);
@@ -1389,7 +1390,7 @@ MYLOG(0, "null_cvt_date_string=%d\n",
conn->connInfo.cvt_null_date_string);
                else
                {
                        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;
+                       return  COPY_GENERAL_ERROR;
                }


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: [email protected]
  Cc: [email protected]
  Subject: Re: psqlodbc copy_and_convert_field "Unrecognized return value"
  In-Reply-To: <CAFSohAUzatQJ-exEXnEVN3St_d+sxyqxZUXRSXjC=-H1A8XZuA@mail.gmail.com>

* 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