[Commits] f1065f5: pre-review removed a function

Oleksandr Byelkin sanja at mariadb.com
Sat Oct 8 11:03:09 EEST 2016


revision-id: f1065f51aaed40e08447221b3517bcccb026cfd5 (mariadb-10.2.2-14-gf1065f5)
parent(s): ee4db0111a46846e78f3fd3793bd217cae6ea48e
committer: Oleksandr Byelkin
timestamp: 2016-10-08 10:03:09 +0200
message:

pre-review removed a function

---
 sql/sql_parse.cc   |  7 +------
 sql/sql_prepare.cc | 57 +++++++-----------------------------------------------
 2 files changed, 8 insertions(+), 56 deletions(-)

diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 956dea9..09ab232 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1746,12 +1746,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
   }
   case COM_STMT_EXECUTE:
   {
-    ulong iterations= uint4korr(packet + 5);
-    if (iterations < 2  ||
-        (thd->client_capabilities & MARIADB_CLIENT_STMT_BULK_OPERATIONS))
-      mysqld_stmt_execute(thd, packet, packet_length);
-    else
-      mysqld_stmt_bulk_execute(thd, packet, packet_length);
+    mysqld_stmt_execute(thd, packet, packet_length);
     break;
   }
   case COM_STMT_FETCH:
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index f3c22bc..65b373d 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -3030,6 +3030,7 @@ void mysqld_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
   uchar *packet= (uchar*)packet_arg; // GCC 4.0.1 workaround
   ulong stmt_id= uint4korr(packet);
   ulong flags= (ulong) packet[4];
+  ulong iterations= uint4korr(packet + 5);
   /* Query text for binary, general or slow log, if any of them is open */
   String expanded_query;
   uchar *packet_end= packet + packet_length;
@@ -3055,12 +3056,16 @@ void mysqld_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
   thd->profiling.set_query_source(stmt->query(), stmt->query_length());
 #endif
   DBUG_PRINT("exec_query", ("%s", stmt->query()));
-  DBUG_PRINT("info",("stmt: 0x%lx", (long) stmt));
+  DBUG_PRINT("info",("stmt: 0x%lx iterations: %lu", (long) stmt, iterations));
 
   open_cursor= MY_TEST(flags & (ulong) CURSOR_TYPE_READ_ONLY);
 
   thd->protocol= &thd->protocol_binary;
-  stmt->execute_loop(&expanded_query, open_cursor, packet, packet_end);
+  if (iterations <= 1)
+    stmt->execute_loop(&expanded_query, open_cursor, packet, packet_end);
+  else
+    stmt->execute_bulk_loop(&expanded_query, open_cursor, packet, packet_end,
+                            iterations);
   thd->protocol= save_protocol;
 
   sp_cache_enforce_limit(thd->sp_proc_cache, stored_program_cache_size);
@@ -3072,54 +3077,6 @@ void mysqld_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
   DBUG_VOID_RETURN;
 }
 
-void mysqld_stmt_bulk_execute(THD *thd, char *packet_arg, uint packet_length)
-{
-  uchar *packet= (uchar*)packet_arg; // GCC 4.0.1 workaround
-  ulong stmt_id= uint4korr(packet);
-  ulong flags= (ulong) packet[4];
-  ulong iterations= uint4korr(packet + 5);
-  /* Query text for binary, general or slow log, if any of them is open */
-  String expanded_query;
-  uchar *packet_end= packet + packet_length;
-  Prepared_statement *stmt;
-  Protocol *save_protocol= thd->protocol;
-  bool open_cursor;
-  DBUG_ENTER("mysqld_stmt_bulk_execute");
-
-  packet+= 9;                 /* stmt_id + flags + iterations */
-
-  /* First of all clear possible warnings from the previous command */
-  thd->reset_for_next_command();
-
-  if (!(stmt= find_prepared_statement(thd, stmt_id)))
-  {
-    char llbuf[22];
-    my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), static_cast<int>(sizeof(llbuf)),
-             llstr(stmt_id, llbuf), "mysqld_stmt_execute");
-    DBUG_VOID_RETURN;
-  }
-
-#if defined(ENABLED_PROFILING)
-  thd->profiling.set_query_source(stmt->query(), stmt->query_length());
-#endif
-  DBUG_PRINT("exec_query", ("%s", stmt->query()));
-  DBUG_PRINT("info",("stmt: 0x%lx", (long) stmt));
-
-  open_cursor= MY_TEST(flags & (ulong) CURSOR_TYPE_READ_ONLY);
-
-  thd->protocol= &thd->protocol_binary;
-  stmt->execute_bulk_loop(&expanded_query, open_cursor, packet, packet_end,
-                          iterations);
-  thd->protocol= save_protocol;
-
-  sp_cache_enforce_limit(thd->sp_proc_cache, stored_program_cache_size);
-  sp_cache_enforce_limit(thd->sp_func_cache, stored_program_cache_size);
-
-  /* Close connection socket; for use with client testing (Bug#43560). */
-  DBUG_EXECUTE_IF("close_conn_after_stmt_execute", vio_close(thd->net.vio););
-
-  DBUG_VOID_RETURN;
-}
 
 /**
   SQLCOM_EXECUTE implementation.


More information about the commits mailing list