Re: Re: [INTERFACES] Postgres odbc driver bug - Mailing list pgsql-odbc

From Bruce Momjian
Subject Re: Re: [INTERFACES] Postgres odbc driver bug
Date
Msg-id 200105090258.f492w8u21241@candle.pha.pa.us
Whole thread Raw
In response to Re: Re: [INTERFACES] Postgres odbc driver bug  (Hiroshi Inoue <Inoue@tpf.co.jp>)
List pgsql-odbc
> > And you are saying that this patch fixes a different problem.  The user
> > reported his problems were fixed by that patch, so I am inclined to
> > apply it.
> >
>
> I don't agree to apply the patch because the patch makes
> the current code hardly understandable.

Agreed.  I mentioned to Keith I was going to clean it up before
application.  Here is the cleaned up patch.

Hiroshi, what do you think?

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
Index: src/interfaces/odbc/execute.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/odbc/execute.c,v
retrieving revision 1.29
diff -c -r1.29 execute.c
*** src/interfaces/odbc/execute.c    2001/05/08 17:12:36    1.29
--- src/interfaces/odbc/execute.c    2001/05/09 02:37:04
***************
*** 217,248 ****
          return SQL_INVALID_HANDLE;
      }

-     /*
-      * If the statement is premature, it means we already executed it from
-      * an SQLPrepare/SQLDescribeCol type of scenario.  So just return
-      * success.
-      */
-     if (stmt->prepare && stmt->status == STMT_PREMATURE)
-     {
-         if (stmt->inaccurate_result)
-             SC_recycle_statement(stmt);
-         else
-         {
-             stmt->status = STMT_FINISHED;
-             if (stmt->errormsg == NULL)
-             {
-                 mylog("%s: premature statement but return SQL_SUCCESS\n", func);
-                 return SQL_SUCCESS;
-             }
-             else
-             {
-                 SC_log_error(func, "", stmt);
-                 mylog("%s: premature statement so return SQL_ERROR\n", func);
-                 return SQL_ERROR;
-             }
-         }
-     }
-
      mylog("%s: clear errors...\n", func);

      SC_clear_error(stmt);
--- 217,222 ----
***************
*** 278,285 ****
      }

      /* Check if the statement is in the correct state */
!     if ((stmt->prepare && stmt->status != STMT_READY) ||
!         (stmt->status != STMT_ALLOCATED && stmt->status != STMT_READY))
      {
          stmt->errornumber = STMT_STATUS_ERROR;
          stmt->errormsg = "The handle does not point to a statement that is ready to be executed";
--- 252,259 ----
      }

      /* Check if the statement is in the correct state */
!     if ((stmt->prepare && (stmt->status != STMT_READY && stmt->status != STMT_PREMATURE)) ||
!         (stmt->status != STMT_ALLOCATED && stmt->status != STMT_READY && stmt->status != STMT_PREMATURE))
      {
          stmt->errornumber = STMT_STATUS_ERROR;
          stmt->errormsg = "The handle does not point to a statement that is ready to be executed";
***************
*** 294,310 ****
       */
      if (!stmt->pre_executing)
      {
-
          /*
           * The bound parameters could have possibly changed since the last
           * execute of this statement?  Therefore check for params and
           * re-copy.
           */
          stmt->data_at_exec = -1;
          for (i = 0; i < stmt->parameters_allocated; i++)
          {
              Int4       *pcVal = stmt->parameters[i].used;

              if (pcVal && (*pcVal == SQL_DATA_AT_EXEC || *pcVal <= SQL_LEN_DATA_AT_EXEC_OFFSET))
                  stmt->parameters[i].data_at_exec = TRUE;
              else
--- 268,286 ----
       */
      if (!stmt->pre_executing)
      {
          /*
           * The bound parameters could have possibly changed since the last
           * execute of this statement?  Therefore check for params and
           * re-copy.
           */
+         mylog("%s: Check for data at execution parameters\n", func);
+         mylog("%s: stmt->parameters_allocated = %d\n", func,stmt->parameters_allocated);
          stmt->data_at_exec = -1;
          for (i = 0; i < stmt->parameters_allocated; i++)
          {
              Int4       *pcVal = stmt->parameters[i].used;

+             mylog("%s: stmt->parameters[%d].data_at_exec = %d\n", func,i,stmt->parameters[i].data_at_exec);
              if (pcVal && (*pcVal == SQL_DATA_AT_EXEC || *pcVal <= SQL_LEN_DATA_AT_EXEC_OFFSET))
                  stmt->parameters[i].data_at_exec = TRUE;
              else

pgsql-odbc by date:

Previous
From: Hiroshi Inoue
Date:
Subject: Re: Re: [INTERFACES] Postgres odbc driver bug
Next
From: Hiroshi Inoue
Date:
Subject: Re: Re: [INTERFACES] Postgres odbc driver bug