Fix the bug that PostgreSQL's function calls in queries cause a
authorHiroshi Inoue <inoue@tpf.co.jp>
Mon, 31 Oct 2011 14:20:20 +0000 (14:20 +0000)
committerHiroshi Inoue <inoue@tpf.co.jp>
Mon, 31 Oct 2011 14:20:20 +0000 (14:20 +0000)
crash on SQL Server linked servers.

execute.c
parse.c
qresult.c
version.h

index 5a3396e391cf6b001407953aa19085f71d84fecc..c0ae5e897d9dca2e272faa6a83b734c77ca523e2 100644 (file)
--- a/execute.c
+++ b/execute.c
@@ -440,17 +440,6 @@ RETCODE    Exec_with_parameters_resolved(StatementClass *stmt, BOOL *exec_end)
    /* Prepare the statement if possible at backend side */
    if (!stmt->inaccurate_result)
    {
-       /**
-       switch (decideHowToPrepare(stmt, FALSE))
-       {
-           case USING_PREPARE_COMMAND:
-           case NAMED_PARSE_REQUEST:
-#ifndef    BYPASS_ONESHOT_PLAN_EXECUTION
-           case PARSE_TO_EXEC_ONCE:
-#endif
-               prepare_before_exec = TRUE;
-       }
-       **/
        if (HowToPrepareBeforeExec(stmt, FALSE) >= allowParse)
            prepare_before_exec = TRUE;
    }
@@ -1070,6 +1059,7 @@ mylog("prepareParameters was %s called, prepare state:%d\n", shouldParse == nCal
        if (isSqlServr() &&
            !stmt->internal &&
            0 != stmt->prepare &&
+           PG_VERSION_LT(conn, 8.4) &&
            SC_can_parse_statement(stmt))
            parse_sqlsvr(stmt);
    }
diff --git a/parse.c b/parse.c
index 71e4bbbce772910f104364346772e0a9318eeb34..47b94872714ac66f89948f009fa998e308cebe37 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -1615,13 +1615,15 @@ mylog("blevel=%d btoken=%s in_dot=%d in_field=%d tbname=%s\n", blevel, btoken, i
                in_dot = FALSE;
                in_func = TRUE;
                if (NULL != wfi)
+               {
                    wfi->func = TRUE;
 
-               /*
-                * name will have the function name -- maybe useful some
-                * day
-                */
-               mylog("**** got function = '%s'\n", PRINT_NAME(wfi->column_name));
+                   /*
+                    * name will have the function name -- maybe useful some
+                    * day
+                    */
+                   mylog("**** got function = '%s'\n", PRINT_NAME(wfi->column_name));
+               }
                continue;
            }
 
index 74ad30a9fa3733cc6d931ab4da593ee0df1939e7..82257f31250fdcbc2d7c43235bc8e97d18642525 100644 (file)
--- a/qresult.c
+++ b/qresult.c
@@ -93,7 +93,15 @@ QR_set_cursor(QResultClass *self, const char *name)
    }
    else
    {
+       QResultClass *res;
+
        self->cursor_name = NULL;
+       for (res = self->next; NULL != res; res = res->next)
+       {
+           if (NULL != res->cursor_name)
+               free(res->cursor_name);
+           res->cursor_name = NULL;
+       }
        QR_set_no_cursor(self);
    }
 }
index c7164d5f21a7b9e5391acbc0658ebb4315b9895e..d8b358c99241d80560470dca110872e7975dc368 100644 (file)
--- a/version.h
+++ b/version.h
@@ -12,6 +12,6 @@
 #define POSTGRESDRIVERVERSION      "09.00.0311"
 #define POSTGRES_RESOURCE_VERSION  "09.00.0311\0"
 #define PG_DRVFILE_VERSION     9,0,03,11
-#define PG_BUILD_VERSION       "201110150001"
+#define PG_BUILD_VERSION       "201110310001"
 
 #endif