# this patch basically reverts
# http://mysql.bkbits.net:8080/mysql-5.0/cset@1.1616.2624.1 and
# http://mysql.bkbits.net:8080/mysql-5.0/cset@1.2053.14.1
# to make sure the client library is 100% binary compatible with
# the 5.0.18 version from SLES10 GA. The reverted patches just fixed
# issues with the libmysqld embeded server library which we don't whip
# anyway
--- include/mysql.h
+++ include/mysql.h
@@ -130,14 +130,14 @@ typedef MYSQL_ROWS *MYSQL_ROW_OFFSET;	/*
 
 #include "my_alloc.h"
 
-typedef struct embedded_query_result EMBEDDED_QUERY_RESULT;
 typedef struct st_mysql_data {
   my_ulonglong rows;
   unsigned int fields;
   MYSQL_ROWS *data;
   MEM_ROOT alloc;
-  /* extra info for embedded library */
-  struct embedded_query_result *embedded_info;
+#if !defined(CHECK_EMBEDDED_DIFFERENCES) || defined(EMBEDDED_LIBRARY)
+  MYSQL_ROWS **prev_ptr;
+#endif
 } MYSQL_DATA;
 
 enum mysql_option 
@@ -235,7 +235,6 @@ typedef struct character_set
 } MY_CHARSET_INFO;
 
 struct st_mysql_methods;
-struct st_mysql_stmt;
 
 typedef struct st_mysql
 {
@@ -289,16 +288,6 @@ typedef struct st_mysql
     from mysql_stmt_close if close had to cancel result set of this object.
   */
   my_bool *unbuffered_fetch_owner;
-#if defined(EMBEDDED_LIBRARY) || defined(EMBEDDED_LIBRARY_COMPATIBLE) || MYSQL_VERSION_ID >= 50100
-  /* needed for embedded server - no net buffer to store the 'info' */
-  char *info_buffer;
-#endif
-  /*
-    In embedded server it points to the statement that is processed
-    in the current query. We store some results directly in statement
-    fields then.
-  */
-  struct st_mysql_stmt *current_stmt;
 } MYSQL;
 
 typedef struct st_mysql_res {
@@ -751,8 +740,7 @@ typedef struct st_mysql_methods
 			      unsigned long header_length,
 			      const char *arg,
 			      unsigned long arg_length,
-			      my_bool skip_check,
-                              MYSQL_STMT *stmt);
+			      my_bool skip_check);
   MYSQL_DATA *(*read_rows)(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
 			   unsigned int fields);
   MYSQL_RES * (*use_result)(MYSQL *mysql);
@@ -769,7 +757,6 @@ typedef struct st_mysql_methods
   const char *(*read_statistics)(MYSQL *mysql);
   my_bool (*next_result)(MYSQL *mysql);
   int (*read_change_user_result)(MYSQL *mysql, char *buff, const char *passwd);
-  int (*read_rows_from_cursor)(MYSQL_STMT *stmt);
 #endif
 } MYSQL_METHODS;
 
@@ -842,11 +829,8 @@ int		STDCALL mysql_drop_db(MYSQL *mysql,
 */
 
 #define simple_command(mysql, command, arg, length, skip_check) \
-  (*(mysql)->methods->advanced_command)(mysql, command, NullS,  \
-                                        0, arg, length, skip_check, NULL)
-#define stmt_command(mysql, command, arg, length, stmt) \
-  (*(mysql)->methods->advanced_command)(mysql, command, NullS,  \
-                                        0, arg, length, 1, stmt)
+  (*(mysql)->methods->advanced_command)(mysql, command,         \
+					NullS, 0, arg, length, skip_check)
 
 #ifdef __NETWARE__
 #pragma pack(pop)		/* restore alignment */
--- libmysql/libmysql.c
+++ libmysql/libmysql.c
@@ -2061,7 +2061,7 @@ mysql_stmt_prepare(MYSQL_STMT *stmt, con
       mysql_use_result it won't be freed in mysql_stmt_free_result and
       we should get 'Commands out of sync' here.
     */
-    if (stmt_command(mysql, COM_STMT_CLOSE, buff, 4, stmt))
+    if (simple_command(mysql, COM_STMT_CLOSE, buff, 4, 1))
     {
       set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno,
                       mysql->net.sqlstate);
@@ -2070,7 +2070,7 @@ mysql_stmt_prepare(MYSQL_STMT *stmt, con
     stmt->state= MYSQL_STMT_INIT_DONE;
   }
 
-  if (stmt_command(mysql, COM_STMT_PREPARE, query, length, stmt))
+  if (simple_command(mysql, COM_STMT_PREPARE, query, length, 1))
   {
     set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno,
                     mysql->net.sqlstate);
@@ -2486,7 +2486,7 @@ static my_bool execute(MYSQL_STMT *stmt,
   buff[4]= (char) stmt->flags;
   int4store(buff+5, 1);                         /* iteration count */
   if (cli_advanced_command(mysql, COM_STMT_EXECUTE, buff, sizeof(buff),
-                           packet, length, 1, NULL) ||
+                           packet, length, 1) ||
       (*mysql->methods->read_query_result)(mysql))
   {
     set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
@@ -2701,13 +2701,12 @@ stmt_read_row_from_cursor(MYSQL_STMT *st
     int4store(buff, stmt->stmt_id);
     int4store(buff + 4, stmt->prefetch_rows); /* number of rows to fetch */
     if ((*mysql->methods->advanced_command)(mysql, COM_STMT_FETCH,
-                                            buff, sizeof(buff), NullS, 0,
-                                            1, NULL))
+                                            buff, sizeof(buff), NullS, 0, 1))
     {
       set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
       return 1;
     }
-    if ((*mysql->methods->read_rows_from_cursor)(stmt))
+    if (cli_read_binary_rows(stmt))
       return 1;
     stmt->server_status= mysql->server_status;
 
@@ -3369,7 +3368,7 @@ mysql_stmt_send_long_data(MYSQL_STMT *st
     */
     if ((*mysql->methods->advanced_command)(mysql, COM_STMT_SEND_LONG_DATA,
                                             buff, sizeof(buff), data,
-                                            length, 1, NULL))
+                                            length, 1))
     {
       set_stmt_errmsg(stmt, mysql->net.last_error,
 		      mysql->net.last_errno, mysql->net.sqlstate);
@@ -4757,7 +4756,7 @@ int STDCALL mysql_stmt_store_result(MYSQ
     int4store(buff, stmt->stmt_id);
     int4store(buff + 4, (int)~0); /* number of rows to fetch */
     if (cli_advanced_command(mysql, COM_STMT_FETCH, buff, sizeof(buff),
-                             NullS, 0, 1, NULL))
+                             NullS, 0, 1))
     {
       set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
       DBUG_RETURN(1);
@@ -4951,7 +4950,7 @@ static my_bool reset_stmt_handle(MYSQL_S
         char buff[MYSQL_STMT_HEADER]; /* packet header: 4 bytes for stmt id */
         int4store(buff, stmt->stmt_id);
         if ((*mysql->methods->advanced_command)(mysql, COM_STMT_RESET, buff,
-                                                sizeof(buff), 0, 0, 0, NULL))
+                                                sizeof(buff), 0, 0, 0))
         {
           set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno,
                           mysql->net.sqlstate);
@@ -5025,7 +5024,7 @@ my_bool STDCALL mysql_stmt_close(MYSQL_S
         mysql->status= MYSQL_STATUS_READY;
       }
       int4store(buff, stmt->stmt_id);
-      if ((rc= stmt_command(mysql, COM_STMT_CLOSE, buff, 4, stmt)))
+      if ((rc= simple_command(mysql, COM_STMT_CLOSE, buff, 4, 1)))
       {
         set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno,
                         mysql->net.sqlstate);
--- include/sql_common.h
+++ include/sql_common.h
@@ -34,8 +34,7 @@ void mysql_read_default_options(struct s
 my_bool
 cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
 		     const char *header, ulong header_length,
-		     const char *arg, ulong arg_length, my_bool skip_check,
-                     MYSQL_STMT *stmt);
+		     const char *arg, ulong arg_length, my_bool skip_check);
 unsigned long cli_safe_read(MYSQL *mysql);
 void set_stmt_errmsg(MYSQL_STMT * stmt, const char *err, int errcode,
 		     const char *sqlstate);
--- sql-common/client.c
+++ sql-common/client.c
@@ -657,8 +657,7 @@ void free_rows(MYSQL_DATA *cur)
 my_bool
 cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
 		     const char *header, ulong header_length,
-		     const char *arg, ulong arg_length, my_bool skip_check,
-                     MYSQL_STMT *stmt __attribute__((unused)))
+		     const char *arg, ulong arg_length, my_bool skip_check)
 {
   NET *net= &mysql->net;
   my_bool result= 1;
@@ -1676,7 +1675,6 @@ static MYSQL_METHODS client_methods=
   cli_read_statistics,                         /* read_statistics */
   cli_read_query_result,                       /* next_result */
   cli_read_change_user_result,                 /* read_change_user_result */
-  cli_read_binary_rows                         /* read_rows_from_cursor */
 #endif
 };
 
--- tests/mysql_client_test.c
+++ tests/mysql_client_test.c
@@ -13148,7 +13148,7 @@ static void test_bug9478()
       int4store(buff, stmt->stmt_id);
       buff[4]= 1;                               /* prefetch rows */
       rc= ((*mysql->methods->advanced_command)(mysql, COM_STMT_FETCH, buff,
-                                               sizeof(buff), 0,0,1,NULL) ||
+                                               sizeof(buff), 0,0,1) ||
            (*mysql->methods->read_query_result)(mysql));
       DIE_UNLESS(rc);
       if (!opt_silent && i == 0)
