Przeglądaj źródła

HPCC-15694 MySQL executed twice for scalar results

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 9 lat temu
rodzic
commit
e8a0b6c35e
1 zmienionych plików z 2 dodań i 3 usunięć
  1. 2 3
      plugins/mysql/mysqlembed.cpp

+ 2 - 3
plugins/mysql/mysqlembed.cpp

@@ -1445,8 +1445,7 @@ public:
     {
     {
         if (nextParam != stmtInfo->queryInputBindings().numColumns())
         if (nextParam != stmtInfo->queryInputBindings().numColumns())
             failx("Not enough parameters supplied (%d parameters supplied, but statement has %d bound columns)", nextParam, stmtInfo->queryInputBindings().numColumns());
             failx("Not enough parameters supplied (%d parameters supplied, but statement has %d bound columns)", nextParam, stmtInfo->queryInputBindings().numColumns());
-        if (!stmtInfo->hasResult())
-            lazyExecute();
+        // We actually do the execute later, when the result is fetched
     }
     }
 protected:
 protected:
     void lazyExecute()
     void lazyExecute()
@@ -1460,7 +1459,7 @@ protected:
     {
     {
         if (!stmtInfo->hasResult() || stmtInfo->queryResultBindings().numColumns() != 1)
         if (!stmtInfo->hasResult() || stmtInfo->queryResultBindings().numColumns() != 1)
             typeError("scalar", NULL);
             typeError("scalar", NULL);
-        lazyExecute(); // MORE this seems wrong to me  - or at least needs to check not already executed
+        lazyExecute();
         if (!stmtInfo->next())
         if (!stmtInfo->next())
             typeError("scalar", NULL);
             typeError("scalar", NULL);
         return stmtInfo->queryResultBindings().queryColumn(0, NULL);
         return stmtInfo->queryResultBindings().queryColumn(0, NULL);