List:Commits« Previous MessageNext Message »
From:Jim Winstead Date:July 28 2006 10:51pm
Subject:bk commit into 5.1 tree (jimw:1.2244)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of jimw. When jimw does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-07-28 15:51:48-07:00, jimw@rama.(none) +44 -0
  Merge rama.(none):/home/jimw/my/tmp_merge
  into  rama.(none):/home/jimw/my/mysql-5.1-clean
  MERGE: 1.1810.1696.105

  BitKeeper/deleted/.del-case_sensitive_file_system.require@stripped, 2006-07-28 15:48:02-07:00, jimw@rama.(none) +0 -0
    Delete: mysql-test/r/case_sensitive_file_system.require

  BitKeeper/deleted/.del-have_case_sensitive_file_system.inc@stripped, 2006-07-28 15:47:59-07:00, jimw@rama.(none) +0 -0
    Delete: mysql-test/include/have_case_sensitive_file_system.inc

  BitKeeper/deleted/.del-mysql_explain_log.sh~5ddc62808e16bd57@stripped, 2006-07-28 15:47:25-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.3.1.2

  BitKeeper/deleted/.del-mysql_explain_log.sh~5ddc62808e16bd57@stripped, 2006-07-28 15:47:25-07:00, jimw@rama.(none) +0 -0
    Merge rename: scripts/mysql_explain_log.sh -> BitKeeper/deleted/.del-mysql_explain_log.sh~5ddc62808e16bd57

  client/mysql.cc@stripped, 2006-07-28 15:47:25-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.199.1.9

  client/mysqldump.c@stripped, 2006-07-28 15:47:25-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.214.1.20

  configure.in@stripped, 2006-07-28 15:47:25-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.245.1.158

  extra/yassl/include/openssl/ssl.h@stripped, 2006-07-28 15:47:25-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.14.1.1

  extra/yassl/include/yassl_int.hpp@stripped, 2006-07-28 15:47:25-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.11.1.1

  extra/yassl/src/ssl.cpp@stripped, 2006-07-28 15:47:25-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.16.1.1

  extra/yassl/src/template_instnt.cpp@stripped, 2006-07-28 15:47:25-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.10.1.1

  extra/yassl/src/yassl_imp.cpp@stripped, 2006-07-28 15:47:25-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.8.1.1

  extra/yassl/src/yassl_int.cpp@stripped, 2006-07-28 15:47:25-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.19.1.1

  include/mysql.h@stripped, 2006-07-28 15:47:25-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.154.1.5

  libmysql/libmysql.c@stripped, 2006-07-28 15:47:25-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.233.1.13

  libmysqld/embedded_priv.h@stripped, 2006-07-28 15:47:25-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.12.1.2

  libmysqld/lib_sql.cc@stripped, 2006-07-28 15:47:26-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.107.1.6

  libmysqld/libmysqld.c@stripped, 2006-07-28 15:47:26-07:00, jimw@rama.(none) +1 -1
    Auto merged
    MERGE: 1.66.1.5

  mysql-test/lib/mtr_cases.pl@stripped, 2006-07-28 15:51:45-07:00, jimw@rama.(none) +0 -0
    Resolve conflict
    MERGE: 1.12.1.6

  mysql-test/mysql-test-run.pl@stripped, 2006-07-28 15:51:45-07:00, jimw@rama.(none) +1 -1
    Resolve conflict
    MERGE: 1.30.1.74

  mysql-test/r/date_formats.result@stripped, 2006-07-28 15:47:26-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.18.1.5

  mysql-test/r/func_str.result@stripped, 2006-07-28 15:47:26-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.110.1.6

  mysql-test/r/mysqldump-max.result@stripped, 2006-07-28 15:47:26-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.2.1.2

  mysql-test/r/mysqldump.result@stripped, 2006-07-28 15:51:45-07:00, jimw@rama.(none) +157 -0
    Resolve conflict
    MERGE: 1.83.1.20

  mysql-test/r/ps.result@stripped, 2006-07-28 15:47:26-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.56.1.13

  mysql-test/t/date_formats.test@stripped, 2006-07-28 15:47:26-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.14.1.6

  mysql-test/t/mysqldump.test@stripped, 2006-07-28 15:51:45-07:00, jimw@rama.(none) +17 -0
    Resolve conflict
    MERGE: 1.76.1.20

  mysql-test/t/ps.test@stripped, 2006-07-28 15:47:26-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.56.1.10

  scripts/mysqld_safe.sh@stripped, 2006-07-28 15:47:26-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.80.1.2

  sql-common/client.c@stripped, 2006-07-28 15:47:27-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.83.1.12

  sql/item_func.h@stripped, 2006-07-28 15:47:26-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.136.2.5

  sql/item_strfunc.cc@stripped, 2006-07-28 15:47:26-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.261.1.14

  sql/sql_acl.cc@stripped, 2006-07-28 15:47:26-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.128.1.71

  sql/sql_class.cc@stripped, 2006-07-28 15:47:26-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.223.1.17

  sql/sql_lex.cc@stripped, 2006-07-28 15:47:26-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.142.1.50

  sql/sql_parse.cc@stripped, 2006-07-28 15:51:45-07:00, jimw@rama.(none) +0 -0
    Resolve conflict
    MERGE: 1.426.1.136

  sql/sql_prepare.cc@stripped, 2006-07-28 15:47:27-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.142.1.37

  sql/sql_string.h@stripped, 2006-07-28 15:47:27-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.60.1.1

  sql/table.cc@stripped, 2006-07-28 15:47:27-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.160.1.69

  sql/table.h@stripped, 2006-07-28 15:47:27-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.102.1.28

  sql/time.cc@stripped, 2006-07-28 15:47:27-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.57.1.1

  storage/myisam/mi_create.c@stripped, 2006-07-28 15:47:27-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.45.9.5

  storage/myisam/mi_create.c@stripped, 2006-07-28 15:47:25-07:00, jimw@rama.(none) +0 -0
    Merge rename: myisam/mi_create.c -> storage/myisam/mi_create.c

  storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp@stripped, 2006-07-28 15:47:27-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.12.3.4

  storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp@stripped, 2006-07-28 15:47:25-07:00, jimw@rama.(none) +0 -0
    Merge rename: ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp -> storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp

  storage/ndb/src/mgmsrv/ConfigInfo.cpp@stripped, 2006-07-28 15:47:27-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.60.13.4

  storage/ndb/src/mgmsrv/ConfigInfo.cpp@stripped, 2006-07-28 15:47:25-07:00, jimw@rama.(none) +0 -0
    Merge rename: ndb/src/mgmsrv/ConfigInfo.cpp -> storage/ndb/src/mgmsrv/ConfigInfo.cpp

  tests/mysql_client_test.c@stripped, 2006-07-28 15:47:27-07:00, jimw@rama.(none) +0 -0
    Auto merged
    MERGE: 1.167.1.24

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jimw
# Host:	rama.(none)
# Root:	/home/jimw/my/mysql-5.1-clean/RESYNC

--- 1.214/client/mysql.cc	2006-07-28 15:51:54 -07:00
+++ 1.215/client/mysql.cc	2006-07-28 15:51:54 -07:00
@@ -1093,7 +1093,7 @@ static int read_and_execute(bool interac
       (We want to allow help, print and clear anywhere at line start
     */
     if ((named_cmds || glob_buffer.is_empty())
-	&& !in_string && (com=find_command(line,0)))
+	&& !ml_comment && !in_string && (com=find_command(line,0)))
     {
       if ((*com->func)(&glob_buffer,line) > 0)
 	break;
@@ -2995,6 +2995,7 @@ static int
 com_use(String *buffer __attribute__((unused)), char *line)
 {
   char *tmp, buff[FN_REFLEN + 1];
+  int select_db;
 
   bzero(buff, sizeof(buff));
   strmov(buff, line);
@@ -3014,34 +3015,52 @@ com_use(String *buffer __attribute__((un
   if (!current_db || cmp_database(charset_info, current_db,tmp))
   {
     if (one_database)
+    {
       skip_updates= 1;
+      select_db= 0;    // don't do mysql_select_db()
+    }
     else
-    {
-      /*
-	reconnect once if connection is down or if connection was found to
-	be down during query
-      */
-      if (!connected && reconnect())
+      select_db= 2;    // do mysql_select_db() and build_completion_hash()
+  }
+  else
+  {
+    /*
+      USE to the current db specified.
+      We do need to send mysql_select_db() to make server
+      update database level privileges, which might
+      change since last USE (see bug#10979).
+      For performance purposes, we'll skip rebuilding of completion hash.
+    */
+    skip_updates= 0;
+    select_db= 1;      // do only mysql_select_db(), without completion
+  }
+
+  if (select_db)
+  {
+    /*
+      reconnect once if connection is down or if connection was found to
+      be down during query
+    */
+    if (!connected && reconnect())
       return opt_reconnect ? -1 : 1;                        // Fatal error
-      if (mysql_select_db(&mysql,tmp))
-      {
-	if (mysql_errno(&mysql) != CR_SERVER_GONE_ERROR)
-	  return put_error(&mysql);
+    if (mysql_select_db(&mysql,tmp))
+    {
+      if (mysql_errno(&mysql) != CR_SERVER_GONE_ERROR)
+        return put_error(&mysql);
 
-	if (reconnect())
+      if (reconnect())
         return opt_reconnect ? -1 : 1;                      // Fatal error
-	if (mysql_select_db(&mysql,tmp))
-	  return put_error(&mysql);
-      }
-      my_free(current_db,MYF(MY_ALLOW_ZERO_PTR));
-      current_db=my_strdup(tmp,MYF(MY_WME));
+      if (mysql_select_db(&mysql,tmp))
+        return put_error(&mysql);
+    }
+    my_free(current_db,MYF(MY_ALLOW_ZERO_PTR));
+    current_db=my_strdup(tmp,MYF(MY_WME));
 #ifdef HAVE_READLINE
+    if (select_db > 1)
       build_completion_hash(rehash, 1);
 #endif
-    }
   }
-  else
-    skip_updates= 0;
+
   put_info("Database changed",INFO_INFO);
   return 0;
 }

--- 1.241/client/mysqldump.c	2006-07-28 15:51:54 -07:00
+++ 1.242/client/mysqldump.c	2006-07-28 15:51:54 -07:00
@@ -2385,15 +2385,16 @@ static void dump_table(char *table, char
       goto err;
     }
 
-    if (opt_disable_keys)
+    if (opt_lock)
     {
-      fprintf(md_result_file, "\n/*!40000 ALTER TABLE %s DISABLE KEYS */;\n",
-              opt_quoted_table);
+      fprintf(md_result_file,"LOCK TABLES %s WRITE;\n", opt_quoted_table);
       check_io(md_result_file);
     }
-    if (opt_lock)
+    /* Moved disable keys to after lock per bug 15977 */
+    if (opt_disable_keys)
     {
-      fprintf(md_result_file,"LOCK TABLES %s WRITE;\n", opt_quoted_table);
+      fprintf(md_result_file, "/*!40000 ALTER TABLE %s DISABLE KEYS */;\n",
+	      opt_quoted_table);
       check_io(md_result_file);
     }
 
@@ -2657,17 +2658,19 @@ static void dump_table(char *table, char
       error= EX_CONSCHECK;
       goto err;
     }
-    if (opt_lock)
-    {
-      fputs("UNLOCK TABLES;\n", md_result_file);
-      check_io(md_result_file);
-    }
+
+    /* Moved enable keys to before unlock per bug 15977 */
     if (opt_disable_keys)
     {
       fprintf(md_result_file,"/*!40000 ALTER TABLE %s ENABLE KEYS */;\n",
               opt_quoted_table);
       check_io(md_result_file);
     }
+    if (opt_lock)
+    {
+      fputs("UNLOCK TABLES;\n", md_result_file);
+      check_io(md_result_file);
+    }
     if (opt_autocommit)
     {
       fprintf(md_result_file, "commit;\n");
@@ -3059,6 +3062,12 @@ static my_bool dump_all_views_in_db(char
   uint numrows;
   char table_buff[NAME_LEN*2+3];
 
+  if (mysql_select_db(sock, database))
+  {
+    DB_error(sock, "when selecting the database");
+    return 1;
+  }
+
   if (opt_xml)
     print_xml_tag1(md_result_file, "", "database name=", database, "\n");
   if (lock_tables)
@@ -3720,12 +3729,13 @@ static my_bool get_view_structure(char *
     mysql_free_result(table_res);
 
     /* Get the result from "select ... information_schema" */
-    if (!(table_res= mysql_store_result(sock)))
+    if (!(table_res= mysql_store_result(sock)) ||
+        !(row= mysql_fetch_row(table_res)))
     {
       safe_exit(EX_MYSQLERR);
       DBUG_RETURN(1);
     }
-    row= mysql_fetch_row(table_res);
+
     lengths= mysql_fetch_lengths(table_res);
 
     /*

--- 1.371/configure.in	2006-07-28 15:51:54 -07:00
+++ 1.372/configure.in	2006-07-28 15:51:54 -07:00
@@ -618,7 +618,7 @@ AC_ARG_ENABLE(assembler,
 
 AC_MSG_CHECKING(if we should use assembler functions)
 # For now we only support assembler on i386 and sparc systems
-AM_CONDITIONAL(ASSEMBLER_x86, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "i386")
+AM_CONDITIONAL(ASSEMBLER_x86, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "i386" && $AS strings/strings-x86.s -o checkassembler >/dev/null 2>&1 && test -f checkassembler && (rm -f checkassembler; exit 0;))
 AM_CONDITIONAL(ASSEMBLER_sparc32, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparc")
 AM_CONDITIONAL(ASSEMBLER_sparc64, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparcv9")
 AM_CONDITIONAL(ASSEMBLER, test "$ASSEMBLER_x86_TRUE" = "" -o "$ASSEMBLER_sparc32_TRUE" = "")

--- 1.162/include/mysql.h	2006-07-28 15:51:54 -07:00
+++ 1.163/include/mysql.h	2006-07-28 15:51:54 -07:00
@@ -236,6 +236,7 @@ typedef struct character_set
 } MY_CHARSET_INFO;
 
 struct st_mysql_methods;
+struct st_mysql_stmt;
 
 typedef struct st_mysql
 {
@@ -293,6 +294,12 @@ typedef struct st_mysql
   /* 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 {
@@ -745,7 +752,8 @@ typedef struct st_mysql_methods
 			      unsigned long header_length,
 			      const char *arg,
 			      unsigned long arg_length,
-			      my_bool skip_check);
+			      my_bool skip_check,
+                              MYSQL_STMT *stmt);
   MYSQL_DATA *(*read_rows)(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
 			   unsigned int fields);
   MYSQL_RES * (*use_result)(MYSQL *mysql);
@@ -835,8 +843,11 @@ 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)
+  (*(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)
 unsigned long net_safe_read(MYSQL* mysql);
 
 #ifdef __NETWARE__

--- 1.256/libmysql/libmysql.c	2006-07-28 15:51:54 -07:00
+++ 1.257/libmysql/libmysql.c	2006-07-28 15:51:54 -07:00
@@ -2055,7 +2055,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 (simple_command(mysql, COM_STMT_CLOSE, buff, 4, 1))
+    if (stmt_command(mysql, COM_STMT_CLOSE, buff, 4, stmt))
     {
       set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno,
                       mysql->net.sqlstate);
@@ -2064,7 +2064,7 @@ mysql_stmt_prepare(MYSQL_STMT *stmt, con
     stmt->state= MYSQL_STMT_INIT_DONE;
   }
 
-  if (simple_command(mysql, COM_STMT_PREPARE, query, length, 1))
+  if (stmt_command(mysql, COM_STMT_PREPARE, query, length, stmt))
   {
     set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno,
                     mysql->net.sqlstate);
@@ -2480,7 +2480,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) ||
+                           packet, length, 1, NULL) ||
       (*mysql->methods->read_query_result)(mysql))
   {
     set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
@@ -2693,7 +2693,8 @@ 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))
+                                            buff, sizeof(buff), NullS, 0,
+                                            1, NULL))
     {
       set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
       return 1;
@@ -3360,7 +3361,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))
+                                            length, 1, NULL))
     {
       set_stmt_errmsg(stmt, mysql->net.last_error,
 		      mysql->net.last_errno, mysql->net.sqlstate);
@@ -4748,7 +4749,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))
+                             NullS, 0, 1, NULL))
     {
       set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
       DBUG_RETURN(1);
@@ -4942,7 +4943,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))
+                                                sizeof(buff), 0, 0, 0, NULL))
         {
           set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno,
                           mysql->net.sqlstate);
@@ -5016,7 +5017,7 @@ my_bool STDCALL mysql_stmt_close(MYSQL_S
         mysql->status= MYSQL_STATUS_READY;
       }
       int4store(buff, stmt->stmt_id);
-      if ((rc= simple_command(mysql, COM_STMT_CLOSE, buff, 4, 1)))
+      if ((rc= stmt_command(mysql, COM_STMT_CLOSE, buff, 4, stmt)))
       {
         set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno,
                         mysql->net.sqlstate);

--- 1.45.9.4/myisam/mi_create.c	2006-07-28 15:51:54 -07:00
+++ 1.62/storage/myisam/mi_create.c	2006-07-28 15:51:54 -07:00
@@ -28,9 +28,9 @@
 #endif
 #include <m_ctype.h>
 
-	/*
-	** Old options is used when recreating database, from isamchk
-	*/
+/*
+  Old options is used when recreating database, from myisamchk
+*/
 
 int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
 	      uint columns, MI_COLUMNDEF *recinfo,
@@ -45,6 +45,7 @@ int mi_create(const char *name,uint keys
        key_length,info_length,key_segs,options,min_key_length_skip,
        base_pos,long_varchar_count,varchar_length,
        max_key_block_length,unique_key_parts,fulltext_keys,offset;
+  uint aligned_key_start, block_length;
   ulong reclength, real_reclength,min_pack_length;
   char filename[FN_REFLEN],linkname[FN_REFLEN], *linkname_ptr;
   ulong pack_reclength;
@@ -185,6 +186,8 @@ int mi_create(const char *name,uint keys
   }
   if (flags & HA_CREATE_DELAY_KEY_WRITE)
     options|= HA_OPTION_DELAY_KEY_WRITE;
+  if (flags & HA_CREATE_RELIES_ON_SQL_LAYER)
+    options|= HA_OPTION_RELIES_ON_SQL_LAYER;
 
   packed=(packed+7)/8;
   if (pack_reclength != INT_MAX32)
@@ -428,8 +431,16 @@ int mi_create(const char *name,uint keys
 	key_segs)
       share.state.rec_per_key_part[key_segs-1]=1L;
     length+=key_length;
+    /* Get block length for key, if defined by user */
+    block_length= (keydef->block_length ? 
+                   my_round_up_to_next_power(keydef->block_length) :
+                   myisam_block_size);
+    block_length= max(block_length, MI_MIN_KEY_BLOCK_LENGTH);
+    block_length= min(block_length, MI_MAX_KEY_BLOCK_LENGTH);
+
     keydef->block_length= MI_BLOCK_SIZE(length-real_length_diff,
-                                        pointer,MI_MAX_KEYPTR_SIZE);
+                                        pointer,MI_MAX_KEYPTR_SIZE,
+                                        block_length);
     if (keydef->block_length > MI_MAX_KEY_BLOCK_LENGTH ||
         length >= MI_MAX_KEY_BUFF)
     {
@@ -495,7 +506,7 @@ int mi_create(const char *name,uint keys
   mi_int2store(share.state.header.base_pos,base_pos);
   share.state.header.language= (ci->language ?
 				ci->language : default_charset_info->number);
-  share.state.header.max_block_size=max_key_block_length/MI_MIN_KEY_BLOCK_LENGTH;
+  share.state.header.max_block_size_index= max_key_block_length/MI_MIN_KEY_BLOCK_LENGTH;
 
   share.state.dellink = HA_OFFSET_ERROR;
   share.state.process=	(ulong) getpid();
@@ -522,8 +533,12 @@ int mi_create(const char *name,uint keys
   mi_int2store(share.state.header.unique_key_parts,unique_key_parts);
 
   mi_set_all_keys_active(share.state.key_map, keys);
-  share.base.keystart = share.state.state.key_file_length=
-    MY_ALIGN(info_length, myisam_block_size);
+  aligned_key_start= my_round_up_to_next_power(max_key_block_length ?
+                                               max_key_block_length :
+                                               myisam_block_size);
+
+  share.base.keystart= share.state.state.key_file_length=
+    MY_ALIGN(info_length, aligned_key_start);
   share.base.max_key_block_length=max_key_block_length;
   share.base.max_key_length=ALIGN_SIZE(max_key_length+4);
   share.base.records=ci->max_rows;
@@ -557,6 +572,8 @@ int mi_create(const char *name,uint keys
 
   if (ci->index_file_name)
   {
+    char *iext= strrchr(ci->index_file_name, '.');
+    int have_iext= iext && !strcmp(iext, MI_NAME_IEXT);
     if (options & HA_OPTION_TMP_TABLE)
     {
       char *path;
@@ -564,13 +581,17 @@ int mi_create(const char *name,uint keys
       if ((path= strrchr(ci->index_file_name, FN_LIBCHAR)))
         *path= '\0';
       fn_format(filename, name, ci->index_file_name, MI_NAME_IEXT,
-                MY_REPLACE_DIR | MY_UNPACK_FILENAME);
+                MY_REPLACE_DIR | MY_UNPACK_FILENAME | MY_APPEND_EXT);
     }
     else
-      fn_format(filename, ci->index_file_name, "",
-                MI_NAME_IEXT, MY_UNPACK_FILENAME);
-    fn_format(linkname, name, "", MI_NAME_IEXT, MY_UNPACK_FILENAME);
-    linkname_ptr= linkname;
+    {
+      fn_format(filename, ci->index_file_name, "", MI_NAME_IEXT,
+                MY_UNPACK_FILENAME | (have_iext ? MY_REPLACE_EXT :
+                                      MY_APPEND_EXT));
+    }
+    fn_format(linkname, name, "", MI_NAME_IEXT,
+              MY_UNPACK_FILENAME|MY_APPEND_EXT);
+    linkname_ptr=linkname;
     /*
       Don't create the table if the link or file exists to ensure that one
       doesn't accidently destroy another table.
@@ -579,8 +600,10 @@ int mi_create(const char *name,uint keys
   }
   else
   {
-    fn_format(filename,name,"",MI_NAME_IEXT,(4+ (flags & HA_DONT_TOUCH_DATA) ?
-					     32 : 0));
+    fn_format(filename, name, "", MI_NAME_IEXT,
+              (MY_UNPACK_FILENAME |
+               (flags & HA_DONT_TOUCH_DATA) ? MY_RETURN_REAL_PATH : 0) |
+                MY_APPEND_EXT);
     linkname_ptr=0;
     /* Replace the current file */
     create_flag=MY_DELETE_OLD;
@@ -611,7 +634,8 @@ int mi_create(const char *name,uint keys
 #ifdef USE_RAID
     if (share.base.raid_type)
     {
-      (void) fn_format(filename,name,"",MI_NAME_DEXT,2+4);
+      (void) fn_format(filename, name, "", MI_NAME_DEXT,
+                       MY_UNPACK_FILENAME | MY_APPEND_EXT);
       if ((dfile=my_raid_create(filename, 0, create_mode,
 				share.base.raid_type,
 				share.base.raid_chunks,
@@ -624,6 +648,9 @@ int mi_create(const char *name,uint keys
     {
       if (ci->data_file_name)
       {
+        char *dext= strrchr(ci->data_file_name, '.');
+        int have_dext= dext && !strcmp(dext, MI_NAME_DEXT);
+
         if (options & HA_OPTION_TMP_TABLE)
         {
           char *path;
@@ -631,18 +658,24 @@ int mi_create(const char *name,uint keys
           if ((path= strrchr(ci->data_file_name, FN_LIBCHAR)))
             *path= '\0';
           fn_format(filename, name, ci->data_file_name, MI_NAME_DEXT,
-                    MY_REPLACE_DIR | MY_UNPACK_FILENAME);
+                    MY_REPLACE_DIR | MY_UNPACK_FILENAME | MY_APPEND_EXT);
         }
         else
-          fn_format(filename, ci->data_file_name, "",
-                    MI_NAME_DEXT, MY_UNPACK_FILENAME);
-        fn_format(linkname, name, "", MI_NAME_DEXT, MY_UNPACK_FILENAME);
-        linkname_ptr= linkname;
-        create_flag= 0;
+        {
+          fn_format(filename, ci->data_file_name, "", MI_NAME_DEXT,
+                    MY_UNPACK_FILENAME |
+                    (have_dext ? MY_REPLACE_EXT : MY_APPEND_EXT));
+        }
+
+	fn_format(linkname, name, "",MI_NAME_DEXT,
+	          MY_UNPACK_FILENAME | MY_APPEND_EXT);
+	linkname_ptr=linkname;
+	create_flag=0;
       }
       else
       {
-	fn_format(filename,name,"",MI_NAME_DEXT,4);
+	fn_format(filename,name,"", MI_NAME_DEXT,
+	          MY_UNPACK_FILENAME | MY_APPEND_EXT);
 	linkname_ptr=0;
 	create_flag=MY_DELETE_OLD;
       }
@@ -796,13 +829,15 @@ err:
   case 2:
   if (! (flags & HA_DONT_TOUCH_DATA))
-    my_delete_with_symlink(fn_format(filename,name,"",MI_NAME_DEXT,2+4),
+    my_delete_with_symlink(fn_format(filename,name,"",MI_NAME_DEXT,
+                                     MY_UNPACK_FILENAME | MY_APPEND_EXT),
 			   MYF(0));
     /* fall through */
   case 1:
     VOID(my_close(file,MYF(0)));
     if (! (flags & HA_DONT_TOUCH_DATA))
-      my_delete_with_symlink(fn_format(filename,name,"",MI_NAME_IEXT,2+4),
+      my_delete_with_symlink(fn_format(filename,name,"",MI_NAME_IEXT,
+                                       MY_UNPACK_FILENAME | MY_APPEND_EXT),
 			     MYF(0));
   }
   my_free((char*) rec_per_key_part, MYF(0));

--- 1.83/scripts/mysqld_safe.sh	2006-07-28 15:51:54 -07:00
+++ 1.84/scripts/mysqld_safe.sh	2006-07-28 15:51:54 -07:00
@@ -346,10 +346,13 @@ then
     ulimit -n $open_files
     append_arg_to_args "--open-files-limit=$open_files"
   fi
-  if test -n "$core_file_size"
-  then
-    ulimit -c $core_file_size
-  fi
+fi
+
+# Try to set the core file size (even if we aren't root) because many systems
+# don't specify a hard limit on core file size.
+if test -n "$core_file_size"
+then
+  ulimit -c $core_file_size
 fi
 
 #

--- 1.141/sql/item_func.h	2006-07-28 15:51:54 -07:00
+++ 1.142/sql/item_func.h	2006-07-28 15:51:54 -07:00
@@ -156,7 +156,10 @@ public:
   {
     return (null_value=args[0]->get_time(ltime));
   }
-  bool is_null() { (void) val_int(); return null_value; }
+  bool is_null() { 
+    (void) val_int();  /* Discard result. It sets null_value as side-effect. */ 
+    return null_value; 
+  }
   void signal_divide_by_null();
   friend class udf_handler;
   Field *tmp_table_field() { return result_field; }

--- 1.279/sql/item_strfunc.cc	2006-07-28 15:51:54 -07:00
+++ 1.280/sql/item_strfunc.cc	2006-07-28 15:51:54 -07:00
@@ -1038,7 +1038,7 @@ String *Item_func_left::val_str(String *
   long length  =(long) args[1]->val_int();
   uint char_pos;
 
-  if ((null_value=args[0]->null_value))
+  if ((null_value=(args[0]->null_value || args[1]->null_value)))
     return 0;
   if (length <= 0)
     return &my_empty_string;
@@ -1078,7 +1078,7 @@ String *Item_func_right::val_str(String 
   String *res  =args[0]->val_str(str);
   long length  =(long) args[1]->val_int();
 
-  if ((null_value=args[0]->null_value))
+  if ((null_value=(args[0]->null_value || args[1]->null_value)))
     return 0; /* purecov: inspected */
   if (length <= 0)
     return &my_empty_string; /* purecov: inspected */

--- 1.201/sql/sql_acl.cc	2006-07-28 15:51:54 -07:00
+++ 1.202/sql/sql_acl.cc	2006-07-28 15:51:54 -07:00
@@ -264,8 +264,8 @@ my_bool acl_init(bool dont_read_acl_tabl
   acl_cache= new hash_filo(ACL_CACHE_SIZE, 0, 0,
                            (hash_get_key) acl_entry_get_key,
                            (hash_free_key) free,
-                           /* Use the case sensitive "binary" charset */
-                           &my_charset_bin);
+                           lower_case_file_system ?
+                           system_charset_info : &my_charset_bin);
   if (dont_read_acl_tables)
   {
     DBUG_RETURN(0); /* purecov: tested */

--- 1.573/sql/sql_parse.cc	2006-07-28 15:51:54 -07:00
+++ 1.574/sql/sql_parse.cc	2006-07-28 15:51:54 -07:00
@@ -64,8 +64,8 @@ extern "C" int gethostname(char *name, i
 static void time_out_user_resource_limits(THD *thd, USER_CONN *uc);
 #ifndef NO_EMBEDDED_ACCESS_CHECKS
 static int check_for_max_user_connections(THD *thd, USER_CONN *uc);
-#endif
 static void decrease_user_connections(USER_CONN *uc);
+#endif /* NO_EMBEDDED_ACCESS_CHECKS */
 static bool check_multi_update_lock(THD *thd);
 static void remove_escape(char *name);
 static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables);
@@ -218,6 +218,7 @@ static bool some_non_temp_table_to_be_up
   return 0;
 }
 
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
 static HASH hash_user_connections;
 
 static int get_or_create_user_conn(THD *thd, const char *user,
@@ -269,6 +270,7 @@ end:
   return return_val;
 
 }
+#endif /* !NO_EMBEDDED_ACCESS_CHECKS */
 
 
 /*
@@ -317,8 +319,6 @@ int check_user(THD *thd, enum enum_serve
     {
       /* Send the error to the client */
       net_send_error(thd);
-      if (thd->user_connect)
-	decrease_user_connections(thd->user_connect);
       DBUG_RETURN(-1);
     }
   }
@@ -509,10 +509,12 @@ extern "C" void free_user(struct user_co
 
 void init_max_user_conn(void)
 {
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
   (void) hash_init(&hash_user_connections,system_charset_info,max_connections,
 		   0,0,
 		   (hash_get_key) get_key_conn, (hash_free_key) free_user,
 		   0);
+#endif
 }
 
 
@@ -575,7 +577,6 @@ static int check_for_max_user_connection
   (void) pthread_mutex_unlock(&LOCK_user_conn);
   DBUG_RETURN(error);
 }
-#endif /* NO_EMBEDDED_ACCESS_CHECKS */
 
 /*
   Decrease user connection count
@@ -609,13 +610,18 @@ static void decrease_user_connections(US
   DBUG_VOID_RETURN;
 }
 
+#endif /* NO_EMBEDDED_ACCESS_CHECKS */
+
 
 void free_max_user_conn(void)
 {
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
   hash_free(&hash_user_connections);
+#endif /* NO_EMBEDDED_ACCESS_CHECKS */
 }
 
 
+
 /*
   Mark all commands that somehow changes a table
   This is used to check number of updates / hour
@@ -1770,9 +1776,11 @@ bool dispatch_command(enum enum_server_c
     }
     else
     {
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
       /* we've authenticated new user */
       if (save_user_connect)
 	decrease_user_connections(save_user_connect);
+#endif /* NO_EMBEDDED_ACCESS_CHECKS */
       x_free((gptr) save_db);
       x_free((gptr)  save_security_ctx.user);
     }

--- 1.234/sql/table.cc	2006-07-28 15:51:54 -07:00
+++ 1.235/sql/table.cc	2006-07-28 15:51:54 -07:00
@@ -4034,6 +4034,22 @@ void st_table::mark_columns_needed_for_i
     mark_auto_increment_column();
 }
 
+/*
+  Cleanup this table for re-execution.
+
+  SYNOPSIS
+    st_table_list::reinit_before_use()
+*/
+
+void st_table_list::reinit_before_use(THD * /* thd */)
+{
+  /*
+    Reset old pointers to TABLEs: they are not valid since the tables
+    were closed in the end of previous prepare or execute call.
+  */
+  table= 0;
+}
+
 
 /*****************************************************************************
 ** Instansiate templates

--- 1.144/sql/table.h	2006-07-28 15:51:54 -07:00
+++ 1.145/sql/table.h	2006-07-28 15:51:54 -07:00
@@ -765,6 +765,11 @@ typedef struct st_table_list
   Security_context *find_view_security_context(THD *thd);
   bool prepare_view_securety_context(THD *thd);
 #endif
+  /*
+    Cleanup for re-execution in a prepared statement or a stored
+    procedure.
+  */
+  void reinit_before_use(THD *thd);
 
 private:
   bool prep_check_option(THD *thd, uint8 check_opt_type);

--- 1.25/mysql-test/r/date_formats.result	2006-07-28 15:51:54 -07:00
+++ 1.26/mysql-test/r/date_formats.result	2006-07-28 15:51:54 -07:00
@@ -567,3 +567,9 @@ TIME_FORMAT("24:00:00", '%l %p')
 SELECT TIME_FORMAT("25:00:00", '%l %p');
 TIME_FORMAT("25:00:00", '%l %p')
 1 AM
+SELECT DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896);
+DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896)
+NULL
+Warnings:
+Warning	1292	Truncated incorrect datetime value: '%Y-%m-%d %H:%i:%s'
+"End of 4.1 tests"

--- 1.20/mysql-test/t/date_formats.test	2006-07-28 15:51:54 -07:00
+++ 1.21/mysql-test/t/date_formats.test	2006-07-28 15:51:54 -07:00
@@ -293,7 +293,6 @@ drop table t1;
 select str_to_date( 1, NULL );
 select str_to_date( NULL, 1 );
 select str_to_date( 1, IF(1=1,NULL,NULL) );
-# End of 4.1 tests
 
 #
 # Bug#11326
@@ -324,3 +323,10 @@ SELECT TIME_FORMAT("12:00:00", '%l %p');
 SELECT TIME_FORMAT("23:00:00", '%l %p');
 SELECT TIME_FORMAT("24:00:00", '%l %p');
 SELECT TIME_FORMAT("25:00:00", '%l %p');
+
+#
+# Bug#20729:  Bad date_format() call makes mysql server crash
+#
+SELECT DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896);
+
+--echo "End of 4.1 tests"

--- 1.101/sql-common/client.c	2006-07-28 15:51:54 -07:00
+++ 1.102/sql-common/client.c	2006-07-28 15:51:54 -07:00
@@ -642,7 +642,8 @@ 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)
+		     const char *arg, ulong arg_length, my_bool skip_check,
+                     MYSQL_STMT *stmt __attribute__((unused)))
 {
   NET *net= &mysql->net;
   my_bool result= 1;
@@ -1668,11 +1669,18 @@ C_MODE_START
 int mysql_init_character_set(MYSQL *mysql)
 {
   NET		*net= &mysql->net;
+  const char *default_collation_name;
+  
   /* Set character set */
-  if (!mysql->options.charset_name &&
-      !(mysql->options.charset_name= 
+  if (!mysql->options.charset_name)
+  {
+    default_collation_name= MYSQL_DEFAULT_COLLATION_NAME;
+    if (!(mysql->options.charset_name= 
        my_strdup(MYSQL_DEFAULT_CHARSET_NAME,MYF(MY_WME))))
     return 1;
+  }
+  else
+    default_collation_name= NULL;
   
   {
     const char *save= charsets_dir;
@@ -1680,6 +1688,28 @@ int mysql_init_character_set(MYSQL *mysq
       charsets_dir=mysql->options.charset_dir;
     mysql->charset=get_charset_by_csname(mysql->options.charset_name,
                                          MY_CS_PRIMARY, MYF(MY_WME));
+    if (mysql->charset && default_collation_name)
+    {
+      CHARSET_INFO *collation;
+      if ((collation= 
+           get_charset_by_name(default_collation_name, MYF(MY_WME))))
+      {
+        if (!my_charset_same(mysql->charset, collation))
+        {
+          my_printf_error(ER_UNKNOWN_ERROR, 
+                         "COLLATION %s is not valid for CHARACTER SET %s",
+                         MYF(0),
+                         default_collation_name, mysql->options.charset_name);
+          mysql->charset= NULL;
+        }
+        else
+        {
+          mysql->charset= collation;
+        }
+      }
+      else
+        mysql->charset= NULL;
+    }
     charsets_dir= save;
   }
   

--- 1.148/mysql-test/mysql-test-run.pl	2006-07-28 15:51:54 -07:00
+++ 1.149/mysql-test/mysql-test-run.pl	2006-07-28 15:51:54 -07:00
@@ -3701,6 +3701,7 @@ sub run_mysqltest ($) {
   my $cmdline_mysql_client_test=
     "$exe_mysql_client_test --no-defaults --testcase --user=root --silent " .
     "--port=$master->[0]->{'port'} " .
+    "--vardir=$opt_vardir " .
     "--socket=$master->[0]->{'path_sock'}";
 
   if ( $opt_debug )

--- 1.60.13.3/ndb/src/mgmsrv/ConfigInfo.cpp	2006-07-28 15:51:54 -07:00
+++ 1.83/storage/ndb/src/mgmsrv/ConfigInfo.cpp	2006-07-28 15:51:54 -07:00
@@ -762,6 +762,30 @@ const ConfigInfo::ParamInfo ConfigInfo::
     STR_VALUE(MAX_INT_RNIL)},
 
   {
+    CFG_DB_DISK_PAGE_BUFFER_MEMORY,
+    "DiskPageBufferMemory",
+    DB_TOKEN,
+    "Number bytes on each "DB_TOKEN_PRINT" node allocated for disk page buffer cache",
+    ConfigInfo::CI_USED,
+    false,
+    ConfigInfo::CI_INT64,
+    "64M",
+    "4M",
+    "1024G" },
+
+  {
+    CFG_DB_SGA,
+    "SharedGlobalMemory",
+    DB_TOKEN,
+    "Total number bytes on each "DB_TOKEN_PRINT" node allocated for any use",
+    ConfigInfo::CI_USED,
+    false,
+    ConfigInfo::CI_INT64,
+    "20M",
+    "0",
+    "65536G" }, // 32k pages * 32-bit i value
+  
+  {
     CFG_DB_START_PARTIAL_TIMEOUT,
     "StartPartialTimeout",
     DB_TOKEN,
@@ -870,6 +894,18 @@ const ConfigInfo::ParamInfo ConfigInfo::
     STR_VALUE(MAX_INT_RNIL) },
   
   {
+    CFG_DB_INITIAL_OPEN_FILES,
+    "InitialNoOfOpenFiles",
+    DB_TOKEN,
+    "Initial number of files open per "DB_TOKEN_PRINT" node.(One thread is created per file)",
+    ConfigInfo::CI_USED,
+    false,
+    ConfigInfo::CI_INT,
+    "27",
+    "20",
+    STR_VALUE(MAX_INT_RNIL) },
+  
+  {
     CFG_DB_TRANSACTION_CHECK_INTERVAL,
     "TimeBetweenInactiveTransactionAbortCheck",
     DB_TOKEN,
@@ -1215,6 +1251,18 @@ const ConfigInfo::ParamInfo ConfigInfo::
     "2K",
     STR_VALUE(MAX_INT_RNIL) },
 
+  { 
+    CFG_DB_STRING_MEMORY,
+    "StringMemory",
+    DB_TOKEN,
+    "Default size of string memory (0 -> 5% of max 1-100 -> %of max, >100 -> actual bytes)",
+    ConfigInfo::CI_USED,
+    false,
+    ConfigInfo::CI_INT,
+    "0",
+    "0",
+    STR_VALUE(MAX_INT_RNIL) },
+  
   /***************************************************************************
    * API
    ***************************************************************************/

--- 1.12.3.3/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp	2006-07-28 15:51:54 -07:00
+++ 1.31/storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp	2006-07-28 15:51:54 -07:00
@@ -25,6 +25,7 @@
 #include <signaldata/FsRemoveReq.hpp>
 #include <signaldata/DropTab.hpp>
 #include <signaldata/AlterTab.hpp>
+#include <signaldata/CreateFilegroupImpl.hpp>
 #include <AttributeDescriptor.hpp>
 #include "AttributeOffset.hpp"
 #include <my_sys.h>
@@ -32,11 +33,6 @@
 #define ljam() { jamLine(20000 + __LINE__); }
 #define ljamEntry() { jamEntryLine(20000 + __LINE__); }
 
-/* ---------------------------------------------------------------- */
-/* ---------------------------------------------------------------- */
-/* --------------- ADD/DROP FRAGMENT TABLE MODULE ----------------- */
-/* ---------------------------------------------------------------- */
-/* ---------------------------------------------------------------- */
 void Dbtup::execTUPFRAGREQ(Signal* signal)
 {
   ljamEntry();
@@ -61,13 +57,11 @@ void Dbtup::execTUPFRAGREQ(Signal* signa
   Uint32 noOfNullAttr = tupFragReq->noOfNullAttr;
   /*  Uint32 schemaVersion = tupFragReq->schemaVersion;*/
   Uint32 noOfKeyAttr = tupFragReq->noOfKeyAttr;
-
-  Uint32 noOfNewAttr = tupFragReq->noOfNewAttr;
   Uint32 noOfCharsets = tupFragReq->noOfCharsets;
 
   Uint32 checksumIndicator = tupFragReq->checksumIndicator;
-  Uint32 noOfAttributeGroups = tupFragReq->noOfAttributeGroups;
-  Uint32 globalCheckpointIdIndicator = tupFragReq->globalCheckpointIdIndicator;
+  Uint32 gcpIndicator = tupFragReq->globalCheckpointIdIndicator;
+  Uint32 tablespace_id= tupFragReq->tablespaceid;
 
   Uint64 maxRows =
     (((Uint64)tupFragReq->maxRowsHigh) << 32) + tupFragReq->maxRowsLow;
@@ -92,7 +86,7 @@ void Dbtup::execTUPFRAGREQ(Signal* signa
     tupFragReq->userRef = ZNOFREE_FRAGOP_ERROR;
     sendSignal(userblockref, GSN_TUPFRAGREF, signal, 2, JBB);
     return;
-  }//if
+  }
   seizeFragoperrec(fragOperPtr);
 
   fragOperPtr.p->nextFragoprec = RNIL;
@@ -101,53 +95,56 @@ void Dbtup::execTUPFRAGREQ(Signal* signa
   fragOperPtr.p->fragidFrag = fragId;
   fragOperPtr.p->tableidFrag = regTabPtr.i;
   fragOperPtr.p->attributeCount = noOfAttributes;
-  fragOperPtr.p->noOfNullBits = noOfNullAttr;
-  fragOperPtr.p->noOfNewAttrCount = noOfNewAttr;
+  
+  memset(fragOperPtr.p->m_null_bits, 0, sizeof(fragOperPtr.p->m_null_bits));
+  memset(fragOperPtr.p->m_fix_attributes_size, 0, 
+	 sizeof(fragOperPtr.p->m_fix_attributes_size));
+  memset(fragOperPtr.p->m_var_attributes_size, 0, 
+	 sizeof(fragOperPtr.p->m_var_attributes_size));
+
   fragOperPtr.p->charsetIndex = 0;
-  fragOperPtr.p->currNullBit = 0;
-  // remove in 5.1, 2 fragments per fragment in 5.0
-  fragOperPtr.p->minRows = (minRows + 1)/2;
-  fragOperPtr.p->maxRows = (maxRows + 1)/2;
+  fragOperPtr.p->minRows = minRows;
+  fragOperPtr.p->maxRows = maxRows;
 
   ndbrequire(reqinfo == ZADDFRAG);
 
   getFragmentrec(regFragPtr, fragId, regTabPtr.p);
   if (regFragPtr.i != RNIL) {
     ljam();
-    terrorCode = ZEXIST_FRAG_ERROR;	/* THE FRAGMENT ALREADY EXIST */
+    terrorCode= ZEXIST_FRAG_ERROR;
     fragrefuse1Lab(signal, fragOperPtr);
     return;
-  }//if
+  }
   if (cfirstfreefrag != RNIL) {
     ljam();
     seizeFragrecord(regFragPtr);
   } else {
     ljam();
-    terrorCode = ZFULL_FRAGRECORD_ERROR;
+    terrorCode= ZFULL_FRAGRECORD_ERROR;
     fragrefuse1Lab(signal, fragOperPtr);
     return;
-  }//if
+  }
   initFragRange(regFragPtr.p);
   if (!addfragtotab(regTabPtr.p, fragId, regFragPtr.i)) {
     ljam();
-    terrorCode = ZNO_FREE_TAB_ENTRY_ERROR;
+    terrorCode= ZNO_FREE_TAB_ENTRY_ERROR;
     fragrefuse2Lab(signal, fragOperPtr, regFragPtr);
     return;
-  }//if
+  }
   if (cfirstfreerange == RNIL) {
     ljam();
-    terrorCode = ZNO_FREE_PAGE_RANGE_ERROR;
+    terrorCode= ZNO_FREE_PAGE_RANGE_ERROR;
     fragrefuse3Lab(signal, fragOperPtr, regFragPtr, regTabPtr.p, fragId);
     return;
-  }//if
+  }
 
-  regFragPtr.p->emptyPrimPage = RNIL;
-  regFragPtr.p->thFreeFirst = RNIL;
-  regFragPtr.p->thFreeCopyFirst = RNIL;
-  regFragPtr.p->noCopyPagesAlloc = 0;
-  regFragPtr.p->fragTableId = regTabPtr.i;
-  regFragPtr.p->fragmentId = fragId;
-  regFragPtr.p->checkpointVersion = RNIL;
+  regFragPtr.p->fragTableId= regTabPtr.i;
+  regFragPtr.p->fragmentId= fragId;
+  regFragPtr.p->m_tablespace_id= tablespace_id;
+  regFragPtr.p->m_undo_complete= false;
+  regFragPtr.p->m_lcp_scan_op = RNIL; 
+  regFragPtr.p->m_lcp_keep_list = RNIL;
+  regFragPtr.p->m_var_page_chunks = RNIL;  
 
   if (ERROR_INSERTED(4007) && regTabPtr.p->fragid[0] == fragId ||
       ERROR_INSERTED(4008) && regTabPtr.p->fragid[1] == fragId) {
@@ -160,112 +157,112 @@ void Dbtup::execTUPFRAGREQ(Signal* signa
 
   if (regTabPtr.p->tableStatus == NOT_DEFINED) {
     ljam();
-//-------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
 // We are setting up references to the header of the tuple.
-// Active operation  This word contains a reference to the operation active on the tuple
-//                   at the moment. RNIL means no one active at all.  Not optional.
+// Active operation  This word contains a reference to the operation active
+//                   on the tuple at the moment. RNIL means no one active at
+//                   all.  Not optional.
 // Tuple version     Uses only low 16 bits.  Not optional.
-// Checksum          The third header word is optional and contains a checksum of the
-//                   tuple header.
-// Null-bits         A number of words to contain null bits for all non-dynamic attributes.
-//                   Each word contains upto 32 null bits. Each time a new word is needed
-//                   we allocate the complete word. Zero nullable attributes means that
-//                   there is no word at all
-// Global Checkpoint id
-//                   This word is optional. When used it is stored as a 32-bit unsigned
-//                   attribute with attribute identity 0. Thus the kernel assumes that
-//                   this is the first word after the header.
-//-------------------------------------------------------------------------------------
-    fragOperPtr.p->definingFragment = true;
-    regTabPtr.p->tableStatus = DEFINING;
-    regTabPtr.p->checksumIndicator = (checksumIndicator != 0 ? true : false);
-    regTabPtr.p->GCPIndicator = (globalCheckpointIdIndicator != 0 ? true : false);
-
-    regTabPtr.p->tupChecksumIndex = 2;
-    regTabPtr.p->tupNullIndex = 2 + (checksumIndicator != 0 ? 1 : 0);
-    regTabPtr.p->tupNullWords = (noOfNullAttr + 31) >> 5;
-    regTabPtr.p->tupGCPIndex = regTabPtr.p->tupNullIndex + regTabPtr.p->tupNullWords;
-    regTabPtr.p->tupheadsize = regTabPtr.p->tupGCPIndex;
-
-    regTabPtr.p->noOfKeyAttr = noOfKeyAttr;
-    regTabPtr.p->noOfCharsets = noOfCharsets;
-    regTabPtr.p->noOfAttr = noOfAttributes;
-    regTabPtr.p->noOfNewAttr = noOfNewAttr;
-    regTabPtr.p->noOfNullAttr = noOfNullAttr;
-    regTabPtr.p->noOfAttributeGroups = noOfAttributeGroups;
-
+// Checksum          The third header word is optional and contains a checksum
+//                   of the tuple header.
+// Null-bits         A number of words to contain null bits for all
+//                   non-dynamic attributes. Each word contains upto 32 null
+//                   bits. Each time a new word is needed we allocate the
+//                   complete word. Zero nullable attributes means that there
+//                   is no word at all
+//-----------------------------------------------------------------------------
+    fragOperPtr.p->definingFragment= true;
+    regTabPtr.p->tableStatus= DEFINING;
+    regTabPtr.p->m_bits = 0;
+    regTabPtr.p->m_bits |= (checksumIndicator ? Tablerec::TR_Checksum : 0);
+    regTabPtr.p->m_bits |= (gcpIndicator ? Tablerec::TR_RowGCI : 0);
+    
+    regTabPtr.p->m_offsets[MM].m_disk_ref_offset= 0;
+    regTabPtr.p->m_offsets[MM].m_null_words= 0;
+    regTabPtr.p->m_offsets[MM].m_varpart_offset= 0;
+    regTabPtr.p->m_offsets[MM].m_max_var_offset= 0;
+
+    regTabPtr.p->m_offsets[DD].m_disk_ref_offset= 0;
+    regTabPtr.p->m_offsets[DD].m_null_words= 0;
+    regTabPtr.p->m_offsets[DD].m_varpart_offset= 0;
+    regTabPtr.p->m_offsets[DD].m_max_var_offset= 0;
+
+    regTabPtr.p->m_attributes[MM].m_no_of_fixsize= 0;
+    regTabPtr.p->m_attributes[MM].m_no_of_varsize= 0;
+    regTabPtr.p->m_attributes[DD].m_no_of_fixsize= 0;
+    regTabPtr.p->m_attributes[DD].m_no_of_varsize= 0;
+
+    regTabPtr.p->noOfKeyAttr= noOfKeyAttr;
+    regTabPtr.p->noOfCharsets= noOfCharsets;
+    regTabPtr.p->m_no_of_attributes= noOfAttributes;
+    
     regTabPtr.p->notNullAttributeMask.clear();
-
+    regTabPtr.p->blobAttributeMask.clear();
+    
     Uint32 offset[10];
-    Uint32 tableDescriptorRef = allocTabDescr(regTabPtr.p, offset);
+    Uint32 tableDescriptorRef= allocTabDescr(regTabPtr.p, offset);
     if (tableDescriptorRef == RNIL) {
       ljam();
       fragrefuse4Lab(signal, fragOperPtr, regFragPtr, regTabPtr.p, fragId);
       return;
-    }//if
+    }
     setUpDescriptorReferences(tableDescriptorRef, regTabPtr.p, offset);
   } else {
     ljam();
-    fragOperPtr.p->definingFragment = false;
-  }//if
-  signal->theData[0] = fragOperPtr.p->lqhPtrFrag;
-  signal->theData[1] = fragOperPtr.i;
-  signal->theData[2] = regFragPtr.i;
-  signal->theData[3] = fragId;
+    fragOperPtr.p->definingFragment= false;
+  }
+  signal->theData[0]= fragOperPtr.p->lqhPtrFrag;
+  signal->theData[1]= fragOperPtr.i;
+  signal->theData[2]= regFragPtr.i;
+  signal->theData[3]= fragId;
   sendSignal(fragOperPtr.p->lqhBlockrefFrag, GSN_TUPFRAGCONF, signal, 4, JBB);
   return;
-}//Dbtup::execTUPFRAGREQ()
+}
 
-/* -------------------------------------------------------------------- */
-/* ------------------------- ADDFRAGTOTAB ----------------------------- */
-/* PUTS A FRAGMENT POINTER AND FID IN THE TABLE ARRAY OF THE TID RECORD */
-/* -------------------------------------------------------------------- */
-bool Dbtup::addfragtotab(Tablerec* const regTabPtr, Uint32 fragId, Uint32 fragIndex) 
+bool Dbtup::addfragtotab(Tablerec* const regTabPtr,
+                         Uint32 fragId,
+                         Uint32 fragIndex) 
 {
-  for (Uint32 i = 0; i < (2 * MAX_FRAG_PER_NODE); i++) {
+  for (Uint32 i = 0; i < MAX_FRAG_PER_NODE; i++) {
     ljam();
     if (regTabPtr->fragid[i] == RNIL) {
       ljam();
-      regTabPtr->fragid[i] = fragId;
-      regTabPtr->fragrec[i] = fragIndex;
+      regTabPtr->fragid[i]= fragId;
+      regTabPtr->fragrec[i]= fragIndex;
       return true;
-    }//if
-  }//for
+    }
+  }
   return false;
-}//Dbtup::addfragtotab()
+}
 
-void Dbtup::getFragmentrec(FragrecordPtr& regFragPtr, Uint32 fragId, Tablerec* const regTabPtr) 
+void Dbtup::getFragmentrec(FragrecordPtr& regFragPtr,
+                           Uint32 fragId,
+                           Tablerec* const regTabPtr) 
 {
-  for (Uint32 i = 0; i < (2 * MAX_FRAG_PER_NODE); i++) {
+  for (Uint32 i = 0; i < MAX_FRAG_PER_NODE; i++) {
     ljam();
     if (regTabPtr->fragid[i] == fragId) {
       ljam();
-/* ---------------------------------------------------------------- */
-/* A FRAGMENT  RECORD HAVE BEEN FOUND FOR THIS OPERATION.           */
-/* ---------------------------------------------------------------- */
-      regFragPtr.i = regTabPtr->fragrec[i];
+      regFragPtr.i= regTabPtr->fragrec[i];
       ptrCheckGuard(regFragPtr, cnoOfFragrec, fragrecord);
       return;
-    }//if
-  }//for
-  regFragPtr.i = RNIL;
+    }
+  }
+  regFragPtr.i= RNIL;
   ptrNull(regFragPtr);
-}//Dbtup::getFragmentrec()
+}
 
 void Dbtup::seizeFragrecord(FragrecordPtr& regFragPtr) 
 {
-  regFragPtr.i = cfirstfreefrag;
+  regFragPtr.i= cfirstfreefrag;
   ptrCheckGuard(regFragPtr, cnoOfFragrec, fragrecord);
-  cfirstfreefrag = regFragPtr.p->nextfreefrag;
-  regFragPtr.p->nextfreefrag = RNIL;
-}//Dbtup::seizeFragrecord()
-
-/* ---------------------------------------------------------------- */
-/* SEIZE A FRAGMENT OPERATION RECORD                                */
-/* ---------------------------------------------------------------- */
+  cfirstfreefrag= regFragPtr.p->nextfreefrag;
+  regFragPtr.p->nextfreefrag= RNIL;
+}
+
 void Dbtup::seizeFragoperrec(FragoperrecPtr& fragOperPtr) 
 {
-  fragOperPtr.i = cfirstfreeFragopr;
+  fragOperPtr.i= cfirstfreeFragopr;
   ptrCheckGuard(fragOperPtr, cnoOfFragoprec, fragoperrec);
   cfirstfreeFragopr = fragOperPtr.p->nextFragoprec;
   fragOperPtr.p->nextFragoprec = RNIL;
@@ -282,17 +279,18 @@ void Dbtup::execTUP_ADD_ATTRREQ(Signal* 
   TablerecPtr regTabPtr;
 
   ljamEntry();
-  fragOperPtr.i = signal->theData[0];
+  fragOperPtr.i= signal->theData[0];
   ptrCheckGuard(fragOperPtr, cnoOfFragoprec, fragoperrec);
   Uint32 attrId = signal->theData[2];
   Uint32 attrDescriptor = signal->theData[3];
+  Uint32 extType = AttributeDescriptor::getType(attrDescriptor);
   // DICT sends charset number in upper half
   Uint32 csNumber = (signal->theData[4] >> 16);
 
-  regTabPtr.i = fragOperPtr.p->tableidFrag;
+  regTabPtr.i= fragOperPtr.p->tableidFrag;
   ptrCheckGuard(regTabPtr, cnoOfTablerec, tablerec);
 
-  Uint32 fragId = fragOperPtr.p->fragidFrag;
+  Uint32 fragId= fragOperPtr.p->fragidFrag;
 
   getFragmentrec(regFragPtr, fragId, regTabPtr.p);
   ndbrequire(regFragPtr.i != RNIL);
@@ -301,103 +299,118 @@ void Dbtup::execTUP_ADD_ATTRREQ(Signal* 
   fragOperPtr.p->attributeCount--;
   const bool lastAttr = (fragOperPtr.p->attributeCount == 0);
 
-  if ((regTabPtr.p->tableStatus == DEFINING) &&
-      (fragOperPtr.p->definingFragment)) {
+  if (regTabPtr.p->tableStatus != DEFINING)
+  {
+    ndbrequire(regTabPtr.p->tableStatus == DEFINED);
+    signal->theData[0] = fragOperPtr.p->lqhPtrFrag;
+    signal->theData[1] = lastAttr;
+    sendSignal(fragOperPtr.p->lqhBlockrefFrag, GSN_TUP_ADD_ATTCONF, 
+	       signal, 2, JBB);
+    
+    if(lastAttr)
+    {
+      /**
+       * Init Disk_alloc_info
+       */
+      CreateFilegroupImplReq rep;
+      if(regTabPtr.p->m_no_of_disk_attributes)
+      {
+	Tablespace_client tsman(0, c_tsman, 0, 0, 
+				regFragPtr.p->m_tablespace_id);
+	ndbrequire(tsman.get_tablespace_info(&rep) == 0);
+	regFragPtr.p->m_logfile_group_id= rep.tablespace.logfile_group_id;
+      }
+      new (&regFragPtr.p->m_disk_alloc_info)
+	Disk_alloc_info(regTabPtr.p, rep.tablespace.extent_size);
+      releaseFragoperrec(fragOperPtr);      
+    }
+    return;
+  }
+    
+  Uint32 firstTabDesIndex= regTabPtr.p->tabDescriptor + (attrId * ZAD_SIZE);
+  setTabDescrWord(firstTabDesIndex, attrDescriptor);
+  Uint32 attrLen = AttributeDescriptor::getSize(attrDescriptor);
+  
+  Uint32 attrDes2= 0;
+  if (!AttributeDescriptor::getDynamic(attrDescriptor)) {
     ljam();
-    Uint32 firstTabDesIndex = regTabPtr.p->tabDescriptor + (attrId * ZAD_SIZE);
-    setTabDescrWord(firstTabDesIndex, attrDescriptor);
-    Uint32 attrLen = AttributeDescriptor::getSize(attrDescriptor);
-    Uint32 nullBitPos = fragOperPtr.p->currNullBit;
-    Uint32 bitCount = 0;
-
-    if (AttributeDescriptor::getNullable(attrDescriptor)) {
-      if (!AttributeDescriptor::getDynamic(attrDescriptor)) {
-        ljam();                                      /* NULL ATTR */
-        fragOperPtr.p->currNullBit++;
-      }//if
-    } else {
+    Uint32 pos= 0, null_pos;
+    Uint32 bytes= AttributeDescriptor::getSizeInBytes(attrDescriptor);
+    Uint32 words= (bytes + 3) / 4;
+    Uint32 ind= AttributeDescriptor::getDiskBased(attrDescriptor);
+    ndbrequire(ind <= 1);
+    null_pos= fragOperPtr.p->m_null_bits[ind];
+
+    if (AttributeDescriptor::getNullable(attrDescriptor)) 
+    {
       ljam();
+      fragOperPtr.p->m_null_bits[ind]++;
+    } 
+    else 
+    {
       regTabPtr.p->notNullAttributeMask.set(attrId);
-    }//if
+    }
+
+    if (extType == NDB_TYPE_BLOB || extType == NDB_TYPE_TEXT) {
+      regTabPtr.p->blobAttributeMask.set(attrId);
+    }
 
-    Uint32 attrDes2 = 0;
-    if (!AttributeDescriptor::getDynamic(attrDescriptor)) {
+    switch (AttributeDescriptor::getArrayType(attrDescriptor)) {
+    case NDB_ARRAYTYPE_FIXED:
+    {
       ljam();
-      Uint32 attributePos = regTabPtr.p->tupheadsize;
-      switch (AttributeDescriptor::getArrayType(attrDescriptor)) {
-      case 1:
-      case 2:
+      regTabPtr.p->m_attributes[ind].m_no_of_fixsize++;
+      if(attrLen != 0)
       {
-        ljam();
-	if(attrLen != 0)
-	{
-	  ljam();
-	  Uint32 bitsUsed = 
-	    AttributeDescriptor::getArraySize(attrDescriptor) * (1 << attrLen);
-	  regTabPtr.p->tupheadsize += ((bitsUsed + 31) >> 5);
-	  break;
-	}
-	else
-	{
-	  ljam();
-	  bitCount = AttributeDescriptor::getArraySize(attrDescriptor);
-	  fragOperPtr.p->currNullBit += bitCount;
-	  break;
-	}
+	ljam();
+	pos= fragOperPtr.p->m_fix_attributes_size[ind];
+	fragOperPtr.p->m_fix_attributes_size[ind] += words;
       }
-      default:
-        ndbrequire(false);
-        break;
-      }//switch
-      if(nullBitPos + bitCount + 1 >= MAX_NULL_BITS)
+      else
       {
-	terrorCode = TupAddAttrRef::TooManyBitsUsed;
-        addattrrefuseLab(signal, regFragPtr, fragOperPtr, regTabPtr.p, fragId);
-	return;
-      }
-      AttributeOffset::setOffset(attrDes2, attributePos);
-      AttributeOffset::setNullFlagPos(attrDes2, nullBitPos);
-    } else {
-      ndbrequire(false);
-    }//if
-    if (csNumber != 0) { 
-      CHARSET_INFO* cs = all_charsets[csNumber];
-      ndbrequire(cs != NULL);
-      Uint32 i = 0;
-      while (i < fragOperPtr.p->charsetIndex) {
-        ljam();
-        if (regTabPtr.p->charsetArray[i] == cs)
-          break;
-        i++;
-      }
-      if (i == fragOperPtr.p->charsetIndex) {
-        ljam();
-        fragOperPtr.p->charsetIndex++;
+	ljam();
+	Uint32 bitCount = AttributeDescriptor::getArraySize(attrDescriptor);
+	fragOperPtr.p->m_null_bits[ind] += bitCount;
       }
-      ndbrequire(i < regTabPtr.p->noOfCharsets);
-      regTabPtr.p->charsetArray[i] = cs;
-      AttributeOffset::setCharsetPos(attrDes2, i);
+      break;
     }
-    setTabDescrWord(firstTabDesIndex + 1, attrDes2);
-
-    if (regTabPtr.p->tupheadsize > MAX_TUPLE_SIZE_IN_WORDS) {
-      ljam();
-      terrorCode = ZTOO_LARGE_TUPLE_ERROR;
-      addattrrefuseLab(signal, regFragPtr, fragOperPtr, regTabPtr.p, fragId);
-      return;
-    }//if
-    if (lastAttr && 
-	(fragOperPtr.p->currNullBit != fragOperPtr.p->noOfNullBits))
+    default:
     {
       ljam();
-      terrorCode = ZINCONSISTENT_NULL_ATTRIBUTE_COUNT;
-      addattrrefuseLab(signal, regFragPtr, fragOperPtr, regTabPtr.p, fragId);
-      return;
-    }//if
-  }//if
-  if (ERROR_INSERTED(4009) && regTabPtr.p->fragid[0] == fragId && attrId == 0 ||
+      fragOperPtr.p->m_var_attributes_size[ind] += bytes;
+      pos= regTabPtr.p->m_attributes[ind].m_no_of_varsize++;
+      break;
+    }
+    }//switch
+    
+    AttributeOffset::setOffset(attrDes2, pos);
+    AttributeOffset::setNullFlagPos(attrDes2, null_pos);
+  } else {
+    ndbrequire(false);
+  }
+  if (csNumber != 0) { 
+    CHARSET_INFO* cs = all_charsets[csNumber];
+    ndbrequire(cs != NULL);
+    Uint32 i = 0;
+    while (i < fragOperPtr.p->charsetIndex) {
+      ljam();
+      if (regTabPtr.p->charsetArray[i] == cs)
+	break;
+      i++;
+    }
+    if (i == fragOperPtr.p->charsetIndex) {
+      ljam();
+      fragOperPtr.p->charsetIndex++;
+    }
+    ndbrequire(i < regTabPtr.p->noOfCharsets);
+    regTabPtr.p->charsetArray[i]= cs;
+    AttributeOffset::setCharsetPos(attrDes2, i);
+  }
+  setTabDescrWord(firstTabDesIndex + 1, attrDes2);
+
+  if (ERROR_INSERTED(4009) && regTabPtr.p->fragid[0] == fragId && attrId == 0||
       ERROR_INSERTED(4010) && regTabPtr.p->fragid[0] == fragId && lastAttr ||
-      ERROR_INSERTED(4011) && regTabPtr.p->fragid[1] == fragId && attrId == 0 ||
+      ERROR_INSERTED(4011) && regTabPtr.p->fragid[1] == fragId && attrId == 0||
       ERROR_INSERTED(4012) && regTabPtr.p->fragid[1] == fragId && lastAttr) {
     ljam();
     terrorCode = 1;
@@ -406,10 +419,127 @@ void Dbtup::execTUP_ADD_ATTRREQ(Signal* 
     return;
   }
 
-  if (lastAttr)
-  {
+/* **************************************************************** */
+/* **************          TUP_ADD_ATTCONF       ****************** */
+/* **************************************************************** */
+  if (! lastAttr) {
     ljam();
-    Uint32 noRowsPerPage = ZWORDS_ON_PAGE/regTabPtr.p->tupheadsize;
+    signal->theData[0] = fragOperPtr.p->lqhPtrFrag;
+    signal->theData[1] = lastAttr;
+    sendSignal(fragOperPtr.p->lqhBlockrefFrag, GSN_TUP_ADD_ATTCONF, 
+	       signal, 2, JBB);
+    return;
+  }
+  
+  ndbrequire(regTabPtr.p->tableStatus == DEFINING);
+  regTabPtr.p->tableStatus= DEFINED;
+  regFragPtr.p->fragStatus= ACTIVE;
+  
+#define BTW(x) ((x+31) >> 5)
+  regTabPtr.p->m_offsets[MM].m_null_words= BTW(fragOperPtr.p->m_null_bits[MM]);
+  regTabPtr.p->m_offsets[DD].m_null_words= BTW(fragOperPtr.p->m_null_bits[DD]);
+
+  /**
+   * Fix offsets
+   */
+  Uint32 pos[2] = { 0, 0 };
+  if (regTabPtr.p->m_bits & Tablerec::TR_Checksum)
+  {
+    pos[0]= 1; 
+  }
+
+  if (regTabPtr.p->m_bits & Tablerec::TR_RowGCI)
+  {
+    pos[MM]++;
+    pos[DD]++;
+  }
+  
+  regTabPtr.p->m_no_of_disk_attributes= 
+    regTabPtr.p->m_attributes[DD].m_no_of_fixsize +
+    regTabPtr.p->m_attributes[DD].m_no_of_varsize;
+  
+  if(regTabPtr.p->m_no_of_disk_attributes > 0)
+  {
+    regTabPtr.p->m_offsets[MM].m_disk_ref_offset= pos[MM];
+    pos[MM] += 2; // 8 bytes
+  }
+  
+  regTabPtr.p->m_offsets[MM].m_null_offset= pos[MM];
+  regTabPtr.p->m_offsets[DD].m_null_offset= pos[DD];
+  
+  pos[MM]+= regTabPtr.p->m_offsets[MM].m_null_words;
+  pos[DD]+= regTabPtr.p->m_offsets[DD].m_null_words;
+
+  Uint32 *tabDesc = (Uint32*)(tableDescriptor+regTabPtr.p->tabDescriptor);
+  for(Uint32 i= 0; i<regTabPtr.p->m_no_of_attributes; i++)
+  {
+    Uint32 ind= AttributeDescriptor::getDiskBased(* tabDesc);
+    Uint32 arr= AttributeDescriptor::getArrayType(* tabDesc++);
+
+    if(arr == NDB_ARRAYTYPE_FIXED)
+    {
+      Uint32 desc= * tabDesc;
+      Uint32 off= AttributeOffset::getOffset(desc) + pos[ind];
+      AttributeOffset::setOffset(desc, off);
+      * tabDesc= desc;
+    }
+    tabDesc++;
+  }
+
+  regTabPtr.p->m_offsets[MM].m_fix_header_size= 
+    fragOperPtr.p->m_fix_attributes_size[MM] + 
+    pos[MM];
+
+  regTabPtr.p->m_offsets[DD].m_fix_header_size= 
+    fragOperPtr.p->m_fix_attributes_size[DD] + 
+    pos[DD];
+
+  if(regTabPtr.p->m_attributes[MM].m_no_of_varsize == 0)
+    regTabPtr.p->m_offsets[MM].m_fix_header_size += Tuple_header::HeaderSize;
+
+  if(regTabPtr.p->m_attributes[DD].m_no_of_varsize == 0 &&
+     regTabPtr.p->m_attributes[DD].m_no_of_fixsize > 0)
+    regTabPtr.p->m_offsets[DD].m_fix_header_size += Tuple_header::HeaderSize;
+  
+  regTabPtr.p->m_offsets[MM].m_max_var_offset= 
+    fragOperPtr.p->m_var_attributes_size[MM];
+  
+  regTabPtr.p->m_offsets[DD].m_max_var_offset= 
+    fragOperPtr.p->m_var_attributes_size[DD];
+
+  regTabPtr.p->total_rec_size= 
+    pos[MM] + fragOperPtr.p->m_fix_attributes_size[MM] +
+    pos[DD] + fragOperPtr.p->m_fix_attributes_size[DD] +
+    ((fragOperPtr.p->m_var_attributes_size[MM] + 3) >> 2) +
+    ((fragOperPtr.p->m_var_attributes_size[DD] + 3) >> 2) +
+    (regTabPtr.p->m_attributes[MM].m_no_of_varsize ? 
+     (regTabPtr.p->m_attributes[MM].m_no_of_varsize + 2) >> 1 : 0) +
+    (regTabPtr.p->m_attributes[DD].m_no_of_varsize ? 
+     (regTabPtr.p->m_attributes[DD].m_no_of_varsize + 2) >> 1 : 0) +
+    Tuple_header::HeaderSize +
+    (regTabPtr.p->m_no_of_disk_attributes ? Tuple_header::HeaderSize : 0);
+  
+  setUpQueryRoutines(regTabPtr.p);
+  setUpKeyArray(regTabPtr.p);
+
+#if 0
+  ndbout << *regTabPtr.p << endl;
+  Uint32 idx= regTabPtr.p->tabDescriptor;
+  for(Uint32 i = 0; i<regTabPtr.p->m_no_of_attributes; i++)
+  {
+    ndbout << i << ": " << endl;
+    ndbout << *(AttributeDescriptor*)(tableDescriptor+idx) << endl;
+    ndbout << *(AttributeOffset*)(tableDescriptor+idx+1) << endl;
+    idx += 2;
+  }
+#endif
+  
+  {
+    Uint32 fix_tupheader = regTabPtr.p->m_offsets[MM].m_fix_header_size;
+    if(regTabPtr.p->m_attributes[MM].m_no_of_varsize != 0)
+      fix_tupheader += Tuple_header::HeaderSize + 1;
+    ndbassert(fix_tupheader > 0);
+    Uint32 noRowsPerPage = ZWORDS_ON_PAGE / fix_tupheader;
     Uint32 noAllocatedPages =
       (fragOperPtr.p->minRows + noRowsPerPage - 1 )/ noRowsPerPage;
     if (fragOperPtr.p->minRows == 0)
@@ -426,26 +556,120 @@ void Dbtup::execTUP_ADD_ATTRREQ(Signal* 
     }//if
   }
 
-/* **************************************************************** */
-/* **************          TUP_ADD_ATTCONF       ****************** */
-/* **************************************************************** */
+  CreateFilegroupImplReq rep;
+  if(regTabPtr.p->m_no_of_disk_attributes)
+  {
+    ljam();
+    Tablespace_client tsman(0, c_tsman, 0, 0, 
+			    regFragPtr.p->m_tablespace_id);
+    ndbrequire(tsman.get_tablespace_info(&rep) == 0);
+    regFragPtr.p->m_logfile_group_id= rep.tablespace.logfile_group_id;
+  }    
+
+  new (&regFragPtr.p->m_disk_alloc_info)
+    Disk_alloc_info(regTabPtr.p, rep.tablespace.extent_size); 
+  
+  if (regTabPtr.p->m_no_of_disk_attributes)
+  {
+    ljam();
+    if(!(getNodeState().startLevel == NodeState::SL_STARTING && 
+	 getNodeState().starting.startPhase <= 4))
+    {
+      Callback cb;
+      ljam();
+
+      cb.m_callbackData= fragOperPtr.i;
+      cb.m_callbackFunction = 
+	safe_cast(&Dbtup::undo_createtable_callback);
+      Uint32 sz= sizeof(Disk_undo::Create) >> 2;
+      
+      Logfile_client lgman(this, c_lgman, regFragPtr.p->m_logfile_group_id);
+      int r0 = c_lgman->alloc_log_space(regFragPtr.p->m_logfile_group_id,
+					sz);
+      
+      int res= lgman.get_log_buffer(signal, sz, &cb);
+      switch(res){
+      case 0:
+        ljam();
+	signal->theData[0] = 1;
+	return;
+      case -1:
+	ndbrequire("NOT YET IMPLEMENTED" == 0);
+	break;
+      }
+      execute(signal, cb, 0);
+      return;
+    }
+  }
+  
   signal->theData[0] = fragOperPtr.p->lqhPtrFrag;
   signal->theData[1] = lastAttr;
-  sendSignal(fragOperPtr.p->lqhBlockrefFrag, GSN_TUP_ADD_ATTCONF, signal, 2, JBB);
-  if (! lastAttr) {
-    ljam();
-    return;	/* EXIT AND WAIT FOR MORE */
-  }//if
-  regFragPtr.p->fragStatus = ACTIVE;
-  if (regTabPtr.p->tableStatus == DEFINING) {
-    ljam();
-    setUpQueryRoutines(regTabPtr.p);
-    setUpKeyArray(regTabPtr.p);
-    regTabPtr.p->tableStatus = DEFINED;
-  }//if
+  sendSignal(fragOperPtr.p->lqhBlockrefFrag, GSN_TUP_ADD_ATTCONF, 
+	     signal, 2, JBB);
+
   releaseFragoperrec(fragOperPtr);
+
   return;
-}//Dbtup::execTUP_ADD_ATTRREQ()
+}
+
+void
+Dbtup::undo_createtable_callback(Signal* signal, Uint32 opPtrI, Uint32 unused)
+{
+  FragrecordPtr regFragPtr;
+  FragoperrecPtr fragOperPtr;
+  TablerecPtr regTabPtr;
+
+  fragOperPtr.i= opPtrI;
+  ptrCheckGuard(fragOperPtr, cnoOfFragoprec, fragoperrec);
+
+  regTabPtr.i= fragOperPtr.p->tableidFrag;
+  ptrCheckGuard(regTabPtr, cnoOfTablerec, tablerec);
+
+  getFragmentrec(regFragPtr, fragOperPtr.p->fragidFrag, regTabPtr.p);
+  ndbrequire(regFragPtr.i != RNIL);
+  
+  Logfile_client lgman(this, c_lgman, regFragPtr.p->m_logfile_group_id);
+
+  Disk_undo::Create create;
+  create.m_type_length= Disk_undo::UNDO_CREATE << 16 | (sizeof(create) >> 2);
+  create.m_table = regTabPtr.i;
+  
+  Logfile_client::Change c[1] = {{ &create, sizeof(create) >> 2 } };
+  
+  Uint64 lsn= lgman.add_entry(c, 1);
+
+  Logfile_client::Request req;
+  req.m_callback.m_callbackData= fragOperPtr.i;
+  req.m_callback.m_callbackFunction = 
+    safe_cast(&Dbtup::undo_createtable_logsync_callback);
+  
+  int ret = lgman.sync_lsn(signal, lsn, &req, 0);
+  switch(ret){
+  case 0:
+    return;
+  default:
+    ndbout_c("ret: %d", ret);
+    ndbrequire(false);
+  }
+  
+}
+
+void
+Dbtup::undo_createtable_logsync_callback(Signal* signal, Uint32 ptrI, 
+					 Uint32 res)
+{
+  jamEntry();
+  FragoperrecPtr fragOperPtr;
+  fragOperPtr.i= ptrI;
+  ptrCheckGuard(fragOperPtr, cnoOfFragoprec, fragoperrec);
+  
+  signal->theData[0] = fragOperPtr.p->lqhPtrFrag;
+  signal->theData[1] = 1;
+  sendSignal(fragOperPtr.p->lqhBlockrefFrag, GSN_TUP_ADD_ATTCONF, 
+	     signal, 2, JBB);
+  
+  releaseFragoperrec(fragOperPtr);  
+}
 
 /*
  * Descriptor has these parts:
@@ -454,49 +678,84 @@ void Dbtup::execTUP_ADD_ATTRREQ(Signal* 
  * 1 updateFunctionArray ( ditto )
  * 2 charsetArray ( pointers to distinct CHARSET_INFO )
  * 3 readKeyArray ( attribute ids of keys )
- * 4 attributeGroupDescriptor ( currently size 1 but unused )
  * 5 tabDescriptor ( attribute descriptors, each ZAD_SIZE )
  */
-
 void Dbtup::setUpDescriptorReferences(Uint32 descriptorReference,
                                       Tablerec* const regTabPtr,
                                       const Uint32* offset)
 {
-  Uint32* desc = &tableDescriptor[descriptorReference].tabDescr;
-  regTabPtr->readFunctionArray = (ReadFunction*)(desc + offset[0]);
-  regTabPtr->updateFunctionArray = (UpdateFunction*)(desc + offset[1]);
-  regTabPtr->charsetArray = (CHARSET_INFO**)(desc + offset[2]);
-  regTabPtr->readKeyArray = descriptorReference + offset[3];
-  regTabPtr->attributeGroupDescriptor = descriptorReference + offset[4];
-  regTabPtr->tabDescriptor = descriptorReference + offset[5];
-}//Dbtup::setUpDescriptorReferences()
+  Uint32* desc= &tableDescriptor[descriptorReference].tabDescr;
+  regTabPtr->readFunctionArray= (ReadFunction*)(desc + offset[0]);
+  regTabPtr->updateFunctionArray= (UpdateFunction*)(desc + offset[1]);
+  regTabPtr->charsetArray= (CHARSET_INFO**)(desc + offset[2]);
+  regTabPtr->readKeyArray= descriptorReference + offset[3];
+  regTabPtr->tabDescriptor= descriptorReference + offset[4];
+  regTabPtr->m_real_order_descriptor = descriptorReference + offset[5];
+}
 
 Uint32
 Dbtup::sizeOfReadFunction()
 {
-  ReadFunction* tmp = (ReadFunction*)&tableDescriptor[0];
-  TableDescriptor* start = &tableDescriptor[0];
-  TableDescriptor * end = (TableDescriptor*)(tmp + 1);
+  ReadFunction* tmp= (ReadFunction*)&tableDescriptor[0];
+  TableDescriptor* start= &tableDescriptor[0];
+  TableDescriptor * end= (TableDescriptor*)(tmp + 1);
   return (Uint32)(end - start);
-}//Dbtup::sizeOfReadFunction()
+}
 
 void Dbtup::setUpKeyArray(Tablerec* const regTabPtr)
 {
-  ndbrequire((regTabPtr->readKeyArray + regTabPtr->noOfKeyAttr) < cnoOfTabDescrRec);
-  Uint32* keyArray = &tableDescriptor[regTabPtr->readKeyArray].tabDescr;
-  Uint32 countKeyAttr = 0;
-  for (Uint32 i = 0; i < regTabPtr->noOfAttr; i++) {
+  ndbrequire((regTabPtr->readKeyArray + regTabPtr->noOfKeyAttr) <
+              cnoOfTabDescrRec);
+  Uint32* keyArray= &tableDescriptor[regTabPtr->readKeyArray].tabDescr;
+  Uint32 countKeyAttr= 0;
+  for (Uint32 i= 0; i < regTabPtr->m_no_of_attributes; i++) {
     ljam();
-    Uint32 refAttr = regTabPtr->tabDescriptor + (i * ZAD_SIZE);
-    Uint32 attrDescriptor = getTabDescrWord(refAttr);
+    Uint32 refAttr= regTabPtr->tabDescriptor + (i * ZAD_SIZE);
+    Uint32 attrDescriptor= getTabDescrWord(refAttr);
     if (AttributeDescriptor::getPrimaryKey(attrDescriptor)) {
       ljam();
       AttributeHeader::init(&keyArray[countKeyAttr], i, 0);
       countKeyAttr++;
-    }//if
-  }//for
+    }
+  }
   ndbrequire(countKeyAttr == regTabPtr->noOfKeyAttr);
-}//Dbtup::setUpKeyArray()
+
+  /**
+   * Setup real order array (16 bit per column)
+   */
+  const Uint32 off= regTabPtr->m_real_order_descriptor;
+  const Uint32 sz= (regTabPtr->m_no_of_attributes + 1) >> 1;
+  ndbrequire((off + sz) < cnoOfTabDescrRec);
+  
+  Uint32 cnt= 0;
+  Uint16* order= (Uint16*)&tableDescriptor[off].tabDescr;
+  for (Uint32 type = 0; type < 4; type++)
+  {
+    for (Uint32 i= 0; i < regTabPtr->m_no_of_attributes; i++) 
+    {
+      ljam();
+      Uint32 refAttr= regTabPtr->tabDescriptor + (i * ZAD_SIZE);
+      Uint32 desc = getTabDescrWord(refAttr);
+      Uint32 t = 0;
+
+      if (AttributeDescriptor::getArrayType(desc) != NDB_ARRAYTYPE_FIXED) 
+      {
+	t += 1;
+      }
+      if (AttributeDescriptor::getDiskBased(desc))
+      {
+	t += 2;
+      }
+      ndbrequire(t < 4);
+      if(t == type)
+      {
+	* order++ = i << ZAD_LOG_SIZE;
+	cnt++;
+      }
+    }
+  }
+  ndbrequire(cnt == regTabPtr->m_no_of_attributes);
+}
 
 void Dbtup::addattrrefuseLab(Signal* signal,
                              FragrecordPtr regFragPtr,
@@ -510,12 +769,12 @@ void Dbtup::addattrrefuseLab(Signal* sig
   releaseTabDescr(regTabPtr);
   initTab(regTabPtr);
 
-  signal->theData[0] = fragOperPtr.p->lqhPtrFrag;
-  signal->theData[1] = terrorCode;
-  sendSignal(fragOperPtr.p->lqhBlockrefFrag, GSN_TUP_ADD_ATTRREF, signal, 2, JBB);
+  signal->theData[0]= fragOperPtr.p->lqhPtrFrag;
+  signal->theData[1]= terrorCode;
+  sendSignal(fragOperPtr.p->lqhBlockrefFrag,
+              GSN_TUP_ADD_ATTRREF, signal, 2, JBB);
   releaseFragoperrec(fragOperPtr);
-  return;
-}//Dbtup::addattrrefuseLab()
+}
 
 void Dbtup::fragrefuse4Lab(Signal* signal,
                            FragoperrecPtr fragOperPtr,
@@ -526,8 +785,7 @@ void Dbtup::fragrefuse4Lab(Signal* signa
   releaseFragPages(regFragPtr.p);
   fragrefuse3Lab(signal, fragOperPtr, regFragPtr, regTabPtr, fragId);
   initTab(regTabPtr);
-  return;
-}//Dbtup::fragrefuse4Lab()
+}
 
 void Dbtup::fragrefuse3Lab(Signal* signal,
                            FragoperrecPtr fragOperPtr,
@@ -537,30 +795,28 @@ void Dbtup::fragrefuse3Lab(Signal* signa
 {
   fragrefuse2Lab(signal, fragOperPtr, regFragPtr);
   deleteFragTab(regTabPtr, fragId);
-  return;
-}//Dbtup::fragrefuse3Lab()
+}
 
-void Dbtup::fragrefuse2Lab(Signal* signal, FragoperrecPtr fragOperPtr, FragrecordPtr regFragPtr) 
+void Dbtup::fragrefuse2Lab(Signal* signal,
+                           FragoperrecPtr fragOperPtr,
+                           FragrecordPtr regFragPtr) 
 {
   fragrefuse1Lab(signal, fragOperPtr);
   releaseFragrec(regFragPtr);
-  return;
-}//Dbtup::fragrefuse2Lab()
+}
 
 void Dbtup::fragrefuse1Lab(Signal* signal, FragoperrecPtr fragOperPtr) 
 {
   fragrefuseLab(signal, fragOperPtr);
   releaseFragoperrec(fragOperPtr);
-  return;
-}//Dbtup::fragrefuse1Lab()
+}
 
 void Dbtup::fragrefuseLab(Signal* signal, FragoperrecPtr fragOperPtr) 
 {
-  signal->theData[0] = fragOperPtr.p->lqhPtrFrag;
-  signal->theData[1] = terrorCode;
+  signal->theData[0]= fragOperPtr.p->lqhPtrFrag;
+  signal->theData[1]= terrorCode;
   sendSignal(fragOperPtr.p->lqhBlockrefFrag, GSN_TUPFRAGREF, signal, 2, JBB);
-  return;
-}//Dbtup::fragrefuseLab()
+}
 
 void Dbtup::releaseFragoperrec(FragoperrecPtr fragOperPtr) 
 {
@@ -571,17 +827,17 @@ void Dbtup::releaseFragoperrec(Fragoperr
 
 void Dbtup::deleteFragTab(Tablerec* const regTabPtr, Uint32 fragId) 
 {
-  for (Uint32 i = 0; i < (2 * MAX_FRAG_PER_NODE); i++) {
+  for (Uint32 i = 0; i < MAX_FRAG_PER_NODE; i++) {
     ljam();
     if (regTabPtr->fragid[i] == fragId) {
       ljam();
-      regTabPtr->fragid[i] = RNIL;
-      regTabPtr->fragrec[i] = RNIL;
+      regTabPtr->fragid[i]= RNIL;
+      regTabPtr->fragrec[i]= RNIL;
       return;
-    }//if
-  }//for
+    }
+  }
   ndbrequire(false);
-}//Dbtup::deleteFragTab()
+}
 
 /*
  * LQH aborts on-going create table operation.  The table is later
@@ -606,129 +862,323 @@ Dbtup::execDROP_TAB_REQ(Signal* signal)
     verifytabdes();
 #endif
   }
-  DropTabReq* req = (DropTabReq*)signal->getDataPtr();
+  DropTabReq* req= (DropTabReq*)signal->getDataPtr();
   
   TablerecPtr tabPtr;
-  tabPtr.i = req->tableId;
+  tabPtr.i= req->tableId;
   ptrCheckGuard(tabPtr, cnoOfTablerec, tablerec);
   
   tabPtr.p->m_dropTable.tabUserRef = req->senderRef;
   tabPtr.p->m_dropTable.tabUserPtr = req->senderData;
+  tabPtr.p->tableStatus = DROPPING;
 
-  signal->theData[0] = ZREL_FRAG;
-  signal->theData[1] = tabPtr.i;
+  signal->theData[0]= ZREL_FRAG;
+  signal->theData[1]= tabPtr.i;
   sendSignal(cownref, GSN_CONTINUEB, signal, 2, JBB);
-}//Dbtup::execDROP_TAB_REQ()
+}
 
 void Dbtup::releaseTabDescr(Tablerec* const regTabPtr) 
 {
-  Uint32 descriptor = regTabPtr->readKeyArray;
+  Uint32 descriptor= regTabPtr->readKeyArray;
   if (descriptor != RNIL) {
     ljam();
     Uint32 offset[10];
     getTabDescrOffsets(regTabPtr, offset);
 
-    regTabPtr->tabDescriptor = RNIL;
-    regTabPtr->readKeyArray = RNIL;
-    regTabPtr->readFunctionArray = NULL;
-    regTabPtr->updateFunctionArray = NULL;
-    regTabPtr->charsetArray = NULL;
-    regTabPtr->attributeGroupDescriptor= RNIL;
+    regTabPtr->tabDescriptor= RNIL;
+    regTabPtr->readKeyArray= RNIL;
+    regTabPtr->readFunctionArray= NULL;
+    regTabPtr->updateFunctionArray= NULL;
+    regTabPtr->charsetArray= NULL;
 
     // move to start of descriptor
     descriptor -= offset[3];
-    Uint32 retNo = getTabDescrWord(descriptor + ZTD_DATASIZE);
+    Uint32 retNo= getTabDescrWord(descriptor + ZTD_DATASIZE);
     ndbrequire(getTabDescrWord(descriptor + ZTD_HEADER) == ZTD_TYPE_NORMAL);
     ndbrequire(retNo == getTabDescrWord((descriptor + retNo) - ZTD_TR_SIZE));
-    ndbrequire(ZTD_TYPE_NORMAL == getTabDescrWord((descriptor + retNo) - ZTD_TR_TYPE));
+    ndbrequire(ZTD_TYPE_NORMAL ==
+               getTabDescrWord((descriptor + retNo) - ZTD_TR_TYPE));
     freeTabDescr(descriptor, retNo);
-  }//if
-}//Dbtup::releaseTabDescr()
+  }
+}
 
 void Dbtup::releaseFragment(Signal* signal, Uint32 tableId)
 {
   TablerecPtr tabPtr;
-  tabPtr.i = tableId;
+  tabPtr.i= tableId;
   ptrCheckGuard(tabPtr, cnoOfTablerec, tablerec);
   Uint32 fragIndex = RNIL;
   Uint32 fragId = RNIL;
   Uint32 i = 0;
-  for (i = 0; i < (2 * MAX_FRAG_PER_NODE); i++) {
+  for (i = 0; i < MAX_FRAG_PER_NODE; i++) {
     ljam();
     if (tabPtr.p->fragid[i] != RNIL) {
       ljam();
-      fragIndex = tabPtr.p->fragrec[i];
-      fragId = tabPtr.p->fragid[i];
+      fragIndex= tabPtr.p->fragrec[i];
+      fragId= tabPtr.p->fragid[i];
       break;
-    }//if
-  }//for
+    }
+  }
   if (fragIndex != RNIL) {
     ljam();
     
-    FragrecordPtr regFragPtr;
-    regFragPtr.i = fragIndex;
-    ptrCheckGuard(regFragPtr, cnoOfFragrec, fragrecord);
-    releaseFragPages(regFragPtr.p);
-
-    tabPtr.p->fragid[i] = RNIL;
-    tabPtr.p->fragrec[i] = RNIL;
-    releaseFragrec(regFragPtr);
-
-    signal->theData[0] = ZREL_FRAG;
-    signal->theData[1] = tableId;
-    sendSignal(cownref, GSN_CONTINUEB, signal, 2, JBB);  
+    signal->theData[0] = ZUNMAP_PAGES;
+    signal->theData[1] = tabPtr.i;
+    signal->theData[2] = fragIndex;
+    signal->theData[3] = 0;
+    sendSignal(cownref, GSN_CONTINUEB, signal, 4, JBB);  
     return;
-  }//if
+  }
   
-  /**
-   * Finished...
-   */
-  sendFSREMOVEREQ(signal, tabPtr);
-}//Dbtup::releaseFragment()
+  DropTabConf * const dropConf= (DropTabConf *)signal->getDataPtrSend();
+  dropConf->senderRef= reference();
+  dropConf->senderData= tabPtr.p->m_dropTable.tabUserPtr;
+  dropConf->tableId= tabPtr.i;
+  sendSignal(tabPtr.p->m_dropTable.tabUserRef, GSN_DROP_TAB_CONF,
+             signal, DropTabConf::SignalLength, JBB);
+  
+  releaseTabDescr(tabPtr.p);
+  initTab(tabPtr.p);
+}
 
-void Dbtup::sendFSREMOVEREQ(Signal* signal, TablerecPtr tabPtr)
+void
+Dbtup::drop_fragment_unmap_pages(Signal *signal, 
+				 TablerecPtr tabPtr, 
+				 FragrecordPtr fragPtr,
+				 Uint32 pos)
 {
-  FsRemoveReq * const fsReq = (FsRemoveReq *)signal->getDataPtrSend();
-  fsReq->userReference = cownref;
-  fsReq->userPointer = tabPtr.i;
-  fsReq->fileNumber[0] = tabPtr.i;
-  fsReq->fileNumber[1] = (Uint32)-1; // Remove all fragments
-  fsReq->fileNumber[2] = (Uint32)-1; // Remove all data files within fragment
-  fsReq->fileNumber[3] = 255 |       // No P-value used here
-    (5 <<  8) |  // Data-files in D5
-    (0 << 16) | // Data-files
-    (1 << 24);  // Version 1 of fileNumber
-  
-  fsReq->directory = 1;
-  fsReq->ownDirectory = 1;
-  sendSignal(NDBFS_REF, GSN_FSREMOVEREQ, signal, 
-	     FsRemoveReq::SignalLength, JBA);  
-}//Dbtup::sendFSREMOVEREQ()
- 
-void Dbtup::execFSREMOVECONF(Signal* signal)
+  if (tabPtr.p->m_no_of_disk_attributes)
+  {
+    Disk_alloc_info& alloc_info= fragPtr.p->m_disk_alloc_info;
+    while(alloc_info.m_dirty_pages[pos].isEmpty() && pos < MAX_FREE_LIST)
+      pos++;
+    
+    if (pos == MAX_FREE_LIST)
+    {
+      if(alloc_info.m_curr_extent_info_ptr_i != RNIL)
+      {
+	Local_extent_info_list
+	  list(c_extent_pool, alloc_info.m_free_extents[0]);
+	Ptr<Extent_info> ext_ptr;
+	c_extent_pool.getPtr(ext_ptr, alloc_info.m_curr_extent_info_ptr_i);
+	list.add(ext_ptr);
+	alloc_info.m_curr_extent_info_ptr_i= RNIL;
+      }
+      
+      drop_fragment_free_exent(signal, tabPtr, fragPtr, 0);
+      return;
+    }
+    
+    Ptr<Page> pagePtr;
+    ArrayPool<Page> *pool= (ArrayPool<Page>*)&m_global_page_pool;
+    {
+      LocalDLList<Page> list(*pool, alloc_info.m_dirty_pages[pos]);
+      list.first(pagePtr);
+      list.remove(pagePtr);
+    }
+    
+    Page_cache_client::Request req;
+    req.m_page.m_page_no = pagePtr.p->m_page_no;
+    req.m_page.m_file_no = pagePtr.p->m_file_no;
+    
+    req.m_callback.m_callbackData= pos;
+    req.m_callback.m_callbackFunction = 
+      safe_cast(&Dbtup::drop_fragment_unmap_page_callback);
+    
+    int flags= Page_cache_client::COMMIT_REQ;
+    int res= m_pgman.get_page(signal, req, flags);
+    switch(res)
+    {
+    case 0:
+    case -1:
+      break;
+    default:
+      ndbrequire((Uint32)res == pagePtr.i);
+      drop_fragment_unmap_page_callback(signal, pos, res);
+    }
+    return;
+  }
+  drop_fragment_free_exent(signal, tabPtr, fragPtr, 0);  
+}
+
+void
+Dbtup::drop_fragment_unmap_page_callback(Signal* signal, 
+					 Uint32 pos, Uint32 page_id)
 {
-  ljamEntry();
+  Ptr<GlobalPage> page;
+  m_global_page_pool.getPtr(page, page_id);
   
-  FsConf * const fsConf = (FsConf *)signal->getDataPtrSend();
+  Local_key key;
+  key.m_page_no = ((Page*)page.p)->m_page_no;
+  key.m_file_no = ((Page*)page.p)->m_file_no;
+
+  Uint32 fragId = ((Page*)page.p)->m_fragment_id;
+  Uint32 tableId = ((Page*)page.p)->m_table_id;
+  m_pgman.drop_page(key, page_id);
+
   TablerecPtr tabPtr;
-  tabPtr.i = fsConf->userPointer;
+  tabPtr.i= tableId;
   ptrCheckGuard(tabPtr, cnoOfTablerec, tablerec);
+  
+  FragrecordPtr fragPtr;
+  getFragmentrec(fragPtr, fragId, tabPtr.p);
+  
+  signal->theData[0] = ZUNMAP_PAGES;
+  signal->theData[1] = tabPtr.i;
+  signal->theData[2] = fragPtr.i;
+  signal->theData[3] = pos;
+  sendSignal(cownref, GSN_CONTINUEB, signal, 4, JBB);  
+}
 
+void
+Dbtup::drop_fragment_free_exent(Signal *signal, 
+				TablerecPtr tabPtr, 
+				FragrecordPtr fragPtr,
+				Uint32 pos)
+{
+  if (tabPtr.p->m_no_of_disk_attributes)
+  {
+    Disk_alloc_info& alloc_info= fragPtr.p->m_disk_alloc_info;
+    for(; pos<EXTENT_SEARCH_MATRIX_SIZE; pos++)
+    {
+      if(!alloc_info.m_free_extents[pos].isEmpty())
+      {
+	jam();
+	Local_extent_info_list
+	  list(c_extent_pool, alloc_info.m_free_extents[pos]);
+	Ptr<Extent_info> ext_ptr;
+	list.first(ext_ptr);
+	
+	Tablespace_client tsman(signal, c_tsman, tabPtr.i, 
+				fragPtr.p->fragmentId,
+				fragPtr.p->m_tablespace_id);
+	
+	tsman.free_extent(&ext_ptr.p->m_key);
+	c_extent_hash.remove(ext_ptr);
+	list.release(ext_ptr);
+	
+	signal->theData[0] = ZFREE_EXTENT;
+	signal->theData[1] = tabPtr.i;
+	signal->theData[2] = fragPtr.i;
+	signal->theData[3] = pos;
+	sendSignal(cownref, GSN_CONTINUEB, signal, 4, JBB);  
+	return;
+      }
+    }
+    
+    ArrayPool<Page> *cheat_pool= (ArrayPool<Page>*)&m_global_page_pool;
+    for(pos= 0; pos<MAX_FREE_LIST; pos++)
+    {
+      ndbrequire(alloc_info.m_page_requests[pos].isEmpty());
+      LocalDLList<Page> list(* cheat_pool, alloc_info.m_dirty_pages[pos]);
+      list.remove();
+    }
+  }
   
-  DropTabConf * const dropConf = (DropTabConf *)signal->getDataPtrSend();
-  dropConf->senderRef = reference();
-  dropConf->senderData = tabPtr.p->m_dropTable.tabUserPtr;
-  dropConf->tableId = tabPtr.i;
-  sendSignal(tabPtr.p->m_dropTable.tabUserRef, GSN_DROP_TAB_CONF,
-             signal, DropTabConf::SignalLength, JBB);
+  signal->theData[0] = ZFREE_VAR_PAGES;
+  signal->theData[1] = tabPtr.i;
+  signal->theData[2] = fragPtr.i;
+  sendSignal(reference(), GSN_CONTINUEB, signal, 3, JBB);  
+}
+
+void
+Dbtup::drop_fragment_free_var_pages(Signal* signal)
+{
+  ljam();
+  Uint32 tableId = signal->theData[1];
+  Uint32 fragPtrI = signal->theData[2];
   
-  releaseTabDescr(tabPtr.p);
-  initTab(tabPtr.p);
-  if (ERROR_INSERTED(4013)) {
-    CLEAR_ERROR_INSERT_VALUE;
-#ifdef VM_TRACE
-    verifytabdes();
-#endif
+  TablerecPtr tabPtr;
+  tabPtr.i= tableId;
+  ptrCheckGuard(tabPtr, cnoOfTablerec, tablerec);
+  
+  FragrecordPtr fragPtr;
+  fragPtr.i = fragPtrI;
+  ptrCheckGuard(fragPtr, cnoOfFragrec, fragrecord);
+  
+  PagePtr pagePtr;
+  if ((pagePtr.i = fragPtr.p->m_var_page_chunks) != RNIL)
+  {
+    c_page_pool.getPtr(pagePtr);
+    Var_page* page = (Var_page*)pagePtr.p;
+    fragPtr.p->m_var_page_chunks = page->next_chunk;
+
+    Uint32 sz = page->chunk_size;
+    returnCommonArea(pagePtr.i, sz);
+    
+    signal->theData[0] = ZFREE_VAR_PAGES;
+    signal->theData[1] = tabPtr.i;
+    signal->theData[2] = fragPtr.i;
+    sendSignal(cownref, GSN_CONTINUEB, signal, 3, JBB);  
+    return;
   }
-}//Dbtup::execFSREMOVECONF()
+  
+  releaseFragPages(fragPtr.p);
+  Uint32 i;
+  for(i= 0; i<MAX_FRAG_PER_NODE; i++)
+    if(tabPtr.p->fragrec[i] == fragPtr.i)
+      break;
+  
+  ndbrequire(i != MAX_FRAG_PER_NODE);
+  tabPtr.p->fragid[i]= RNIL;
+  tabPtr.p->fragrec[i]= RNIL;
+  releaseFragrec(fragPtr);
+  
+  signal->theData[0]= ZREL_FRAG;
+  signal->theData[1]= tabPtr.i;
+  sendSignal(cownref, GSN_CONTINUEB, signal, 2, JBB);  
+  return;
+}
 
+void
+Dbtup::start_restore_lcp(Uint32 tableId, Uint32 fragId)
+{
+  TablerecPtr tabPtr;
+  tabPtr.i= tableId;
+  ptrCheckGuard(tabPtr, cnoOfTablerec, tablerec);
+  
+  tabPtr.p->m_dropTable.tabUserPtr= tabPtr.p->m_attributes[DD].m_no_of_fixsize;
+  tabPtr.p->m_dropTable.tabUserRef= tabPtr.p->m_attributes[DD].m_no_of_varsize;
+  
+  Uint32 *tabDesc = (Uint32*)(tableDescriptor+tabPtr.p->tabDescriptor);
+  for(Uint32 i= 0; i<tabPtr.p->m_no_of_attributes; i++)
+  {
+    Uint32 disk= AttributeDescriptor::getDiskBased(* tabDesc);
+    Uint32 null= AttributeDescriptor::getNullable(* tabDesc);
+
+    ndbrequire(tabPtr.p->notNullAttributeMask.get(i) != null);
+    if(disk)
+      tabPtr.p->notNullAttributeMask.clear(i);
+    tabDesc += 2;
+  }
+  
+  tabPtr.p->m_no_of_disk_attributes = 0;
+  tabPtr.p->m_attributes[DD].m_no_of_fixsize = 0;
+  tabPtr.p->m_attributes[DD].m_no_of_varsize = 0;
+}
+void
+Dbtup::complete_restore_lcp(Uint32 tableId, Uint32 fragId)
+{
+  TablerecPtr tabPtr;
+  tabPtr.i= tableId;
+  ptrCheckGuard(tabPtr, cnoOfTablerec, tablerec);
+  
+  tabPtr.p->m_attributes[DD].m_no_of_fixsize= tabPtr.p->m_dropTable.tabUserPtr;
+  tabPtr.p->m_attributes[DD].m_no_of_varsize= tabPtr.p->m_dropTable.tabUserRef;
+  
+  tabPtr.p->m_no_of_disk_attributes = 
+    tabPtr.p->m_attributes[DD].m_no_of_fixsize + 
+    tabPtr.p->m_attributes[DD].m_no_of_varsize;
+  
+  Uint32 *tabDesc = (Uint32*)(tableDescriptor+tabPtr.p->tabDescriptor);
+  for(Uint32 i= 0; i<tabPtr.p->m_no_of_attributes; i++)
+  {
+    Uint32 disk= AttributeDescriptor::getDiskBased(* tabDesc);
+    Uint32 null= AttributeDescriptor::getNullable(* tabDesc);
+    
+    if(disk && !null)
+      tabPtr.p->notNullAttributeMask.set(i);
+    
+    tabDesc += 2;
+  }
+}

--- 1.14/libmysqld/embedded_priv.h	2006-07-28 15:51:54 -07:00
+++ 1.15/libmysqld/embedded_priv.h	2006-07-28 15:51:54 -07:00
@@ -18,9 +18,9 @@
 
 C_MODE_START
 void lib_connection_phase(NET *net, int phase);
-void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db);
-void *create_embedded_thd(int client_flag, char *db);
-int check_embedded_connection(MYSQL *mysql);
+void init_embedded_mysql(MYSQL *mysql, int client_flag);
+void *create_embedded_thd(int client_flag);
+int check_embedded_connection(MYSQL *mysql, const char *db);
 void free_old_query(MYSQL *mysql);
 extern MYSQL_METHODS embedded_methods;
 

--- 1.119/mysql-test/r/func_str.result	2006-07-28 15:51:54 -07:00
+++ 1.120/mysql-test/r/func_str.result	2006-07-28 15:51:54 -07:00
@@ -33,6 +33,9 @@ instr('hello','HE')	instr('hello',binary
 select position(binary 'll' in 'hello'),position('a' in binary 'hello');
 position(binary 'll' in 'hello')	position('a' in binary 'hello')
 3	0
+select left('hello',null), right('hello',null);
+left('hello',null)	right('hello',null)
+NULL	NULL
 select left('hello',2),right('hello',2),substring('hello',2,2),mid('hello',1,5) ;
 left('hello',2)	right('hello',2)	substring('hello',2,2)	mid('hello',1,5)
 he	lo	el	hello

--- 1.117/libmysqld/lib_sql.cc	2006-07-28 15:51:54 -07:00
+++ 1.118/libmysqld/lib_sql.cc	2006-07-28 15:51:54 -07:00
@@ -79,7 +79,8 @@ void embedded_get_error(MYSQL *mysql, MY
 static my_bool
 emb_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)
+		     const char *arg, ulong arg_length, my_bool skip_check,
+                     MYSQL_STMT *stmt)
 {
   my_bool result= 1;
   THD *thd=(THD *) mysql->thd;
@@ -99,6 +100,7 @@ emb_advanced_command(MYSQL *mysql, enum 
   mysql->affected_rows= ~(my_ulonglong) 0;
   mysql->field_count= 0;
   net->last_errno= 0;
+  mysql->current_stmt= stmt;
 
   thd->store_globals();				// Fix if more than one connect
   /* 
@@ -284,7 +286,7 @@ static int emb_stmt_execute(MYSQL_STMT *
   thd->client_param_count= stmt->param_count;
   thd->client_params= stmt->params;
   if (emb_advanced_command(stmt->mysql, COM_STMT_EXECUTE,0,0,
-                           header, sizeof(header), 1) ||
+                           header, sizeof(header), 1, stmt) ||
       emb_read_query_result(stmt->mysql))
   {
     NET *net= &stmt->mysql->net;
@@ -384,7 +386,6 @@ static MYSQL_RES * emb_store_result(MYSQ
   return mysql_store_result(mysql);
 }
 
-
 int emb_read_change_user_result(MYSQL *mysql, 
 				char *buff __attribute__((unused)),
 				const char *passwd __attribute__((unused)))
@@ -554,7 +555,7 @@ void end_embedded_server()
 }
 
 
-void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db)
+void init_embedded_mysql(MYSQL *mysql, int client_flag)
 {
   THD *thd = (THD *)mysql->thd;
   thd->mysql= mysql;
@@ -562,7 +563,7 @@ void init_embedded_mysql(MYSQL *mysql, i
   init_alloc_root(&mysql->field_alloc, 8192, 0);
 }
 
-void *create_embedded_thd(int client_flag, char *db)
+void *create_embedded_thd(int client_flag)
 {
   THD * thd= new THD;
   thd->thread_id= thread_id++;
@@ -588,8 +589,8 @@ void *create_embedded_thd(int client_fla
   thd->init_for_queries();
   thd->client_capabilities= client_flag;
 
-  thd->db= db;
-  thd->db_length= db ? strip_sp(db) : 0;
+  thd->db= NULL;
+  thd->db_length= 0;
 #ifndef NO_EMBEDDED_ACCESS_CHECKS
   thd->security_ctx->db_access= DB_ACLS;
   thd->security_ctx->master_access= ~NO_ACCESS;
@@ -608,7 +609,7 @@ err:
 
 
 #ifdef NO_EMBEDDED_ACCESS_CHECKS
-int check_embedded_connection(MYSQL *mysql)
+int check_embedded_connection(MYSQL *mysql, const char *db)
 {
   int result;
   THD *thd= (THD*)mysql->thd;
@@ -618,13 +619,13 @@ int check_embedded_connection(MYSQL *mys
   sctx->host_or_ip= sctx->host= (char*) my_localhost;
   strmake(sctx->priv_host, (char*) my_localhost,  MAX_HOSTNAME-1);
   sctx->priv_user= sctx->user= my_strdup(mysql->user, MYF(0));
-  result= check_user(thd, COM_CONNECT, NULL, 0, thd->db, true);
+  result= check_user(thd, COM_CONNECT, NULL, 0, db, true);
   emb_read_query_result(mysql);
   return result;
 }
 
 #else
-int check_embedded_connection(MYSQL *mysql)
+int check_embedded_connection(MYSQL *mysql, const char *db)
 {
   THD *thd= (THD*)mysql->thd;
   Security_context *sctx= thd->security_ctx;
@@ -661,7 +662,7 @@ int check_embedded_connection(MYSQL *mys
     passwd_len= 0;
 
   if((result= check_user(thd, COM_CONNECT, 
-			 scramble_buff, passwd_len, thd->db, true)))
+			 scramble_buff, passwd_len, db, true)))
      goto err;
 
   return 0;

--- 1.71/libmysqld/libmysqld.c	2006-07-28 15:51:54 -07:00
+++ 1.72/libmysqld/libmysqld.c	2006-07-28 15:51:54 -07:00
@@ -97,7 +97,6 @@ mysql_real_connect(MYSQL *mysql,const ch
 		   const char *passwd, const char *db,
 		   uint port, const char *unix_socket,ulong client_flag)
 {
-  char *db_name;
   char name_buff[USERNAME_LENGTH];
 
   DBUG_ENTER("mysql_real_connect");
@@ -165,7 +164,6 @@ mysql_real_connect(MYSQL *mysql,const ch
 
   port=0;
   unix_socket=0;
-  db_name = db ? my_strdup(db,MYF(MY_WME)) : NULL;
 
   /* Send client information for access check */
   client_flag|=CLIENT_CAPABILITIES;
@@ -176,14 +174,14 @@ mysql_real_connect(MYSQL *mysql,const ch
     client_flag|=CLIENT_CONNECT_WITH_DB;
 
   mysql->info_buffer= my_malloc(MYSQL_ERRMSG_SIZE, MYF(0));
-  mysql->thd= create_embedded_thd(client_flag, db_name);
+  mysql->thd= create_embedded_thd(client_flag);
 
-  init_embedded_mysql(mysql, client_flag, db_name);
+  init_embedded_mysql(mysql, client_flag);
 
   if (mysql_init_character_set(mysql))
     goto error;
 
-  if (check_embedded_connection(mysql))
+  if (check_embedded_connection(mysql, db))
     goto error;
 
   mysql->server_status= SERVER_STATUS_AUTOCOMMIT;

--- 1.5/mysql-test/r/mysqldump-max.result	2006-07-28 15:51:54 -07:00
+++ 1.6/mysql-test/r/mysqldump-max.result	2006-07-28 15:51:54 -07:00
@@ -115,7 +115,6 @@ CREATE TABLE `t1` (
   `name` varchar(32) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 INSERT  DELAYED IGNORE INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
@@ -125,7 +124,6 @@ CREATE TABLE `t2` (
   `name` varchar(32) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
 /*!40000 ALTER TABLE `t2` DISABLE KEYS */;
 INSERT  DELAYED IGNORE INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
 /*!40000 ALTER TABLE `t2` ENABLE KEYS */;
@@ -135,7 +133,6 @@ CREATE TABLE `t3` (
   `name` varchar(32) DEFAULT NULL
 ) ENGINE=MEMORY DEFAULT CHARSET=latin1;
 
-
 /*!40000 ALTER TABLE `t3` DISABLE KEYS */;
 INSERT  DELAYED IGNORE INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
 /*!40000 ALTER TABLE `t3` ENABLE KEYS */;
@@ -145,7 +142,6 @@ CREATE TABLE `t4` (
   `name` varchar(32) DEFAULT NULL
 ) ENGINE=MEMORY DEFAULT CHARSET=latin1;
 
-
 /*!40000 ALTER TABLE `t4` DISABLE KEYS */;
 INSERT  DELAYED IGNORE INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
 /*!40000 ALTER TABLE `t4` ENABLE KEYS */;
@@ -155,7 +151,6 @@ CREATE TABLE `t5` (
   `name` varchar(32) DEFAULT NULL
 ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
 
-
 /*!40000 ALTER TABLE `t5` DISABLE KEYS */;
 INSERT  DELAYED IGNORE INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
 /*!40000 ALTER TABLE `t5` ENABLE KEYS */;
@@ -165,7 +160,6 @@ CREATE TABLE `t6` (
   `name` varchar(32) DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
-
 /*!40000 ALTER TABLE `t6` DISABLE KEYS */;
 INSERT  IGNORE INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
 /*!40000 ALTER TABLE `t6` ENABLE KEYS */;
@@ -200,7 +194,6 @@ CREATE TABLE `t1` (
   `name` varchar(32) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 INSERT  DELAYED INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
@@ -210,7 +203,6 @@ CREATE TABLE `t2` (
   `name` varchar(32) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
 /*!40000 ALTER TABLE `t2` DISABLE KEYS */;
 INSERT  DELAYED INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
 /*!40000 ALTER TABLE `t2` ENABLE KEYS */;
@@ -220,7 +212,6 @@ CREATE TABLE `t3` (
   `name` varchar(32) DEFAULT NULL
 ) ENGINE=MEMORY DEFAULT CHARSET=latin1;
 
-
 /*!40000 ALTER TABLE `t3` DISABLE KEYS */;
 INSERT  DELAYED INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
 /*!40000 ALTER TABLE `t3` ENABLE KEYS */;
@@ -230,7 +221,6 @@ CREATE TABLE `t4` (
   `name` varchar(32) DEFAULT NULL
 ) ENGINE=MEMORY DEFAULT CHARSET=latin1;
 
-
 /*!40000 ALTER TABLE `t4` DISABLE KEYS */;
 INSERT  DELAYED INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
 /*!40000 ALTER TABLE `t4` ENABLE KEYS */;
@@ -240,7 +230,6 @@ CREATE TABLE `t5` (
   `name` varchar(32) DEFAULT NULL
 ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
 
-
 /*!40000 ALTER TABLE `t5` DISABLE KEYS */;
 INSERT  DELAYED INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
 /*!40000 ALTER TABLE `t5` ENABLE KEYS */;
@@ -249,7 +238,6 @@ CREATE TABLE `t6` (
   `id` int(8) DEFAULT NULL,
   `name` varchar(32) DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
 
 /*!40000 ALTER TABLE `t6` DISABLE KEYS */;
 INSERT INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');

--- 1.112/mysql-test/r/mysqldump.result	2006-07-28 15:51:54 -07:00
+++ 1.113/mysql-test/r/mysqldump.result	2006-07-28 15:51:54 -07:00
@@ -77,12 +77,11 @@ CREATE TABLE `t1` (
   `b` float DEFAULT NULL
 );
 
-
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
-UNLOCK TABLES;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -175,13 +174,12 @@ CREATE TABLE `t1` (
   `a` varchar(255) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=koi8r;
 
-
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 INSERT INTO `t1` VALUES ('абцде');
 INSERT INTO `t1` VALUES (NULL);
-UNLOCK TABLES;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -206,12 +204,11 @@ CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) TYPE=MyISAM;
 
-
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 INSERT INTO `t1` VALUES (1),(2);
-UNLOCK TABLES;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -230,12 +227,11 @@ CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) TYPE=MyISAM;
 
-
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 INSERT INTO `t1` VALUES (1),(2);
-UNLOCK TABLES;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -266,11 +262,10 @@ CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 LOCK TABLES `t1` WRITE;
-UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -292,11 +287,10 @@ CREATE TABLE "t1" (
   "a" int(11) DEFAULT NULL
 );
 
-
-/*!40000 ALTER TABLE "t1" DISABLE KEYS */;
 LOCK TABLES "t1" WRITE;
-UNLOCK TABLES;
+/*!40000 ALTER TABLE "t1" DISABLE KEYS */;
 /*!40000 ALTER TABLE "t1" ENABLE KEYS */;
+UNLOCK TABLES;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -321,11 +315,10 @@ CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 LOCK TABLES `t1` WRITE;
-UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -347,11 +340,10 @@ CREATE TABLE "t1" (
   "a" int(11) DEFAULT NULL
 );
 
-
-/*!40000 ALTER TABLE "t1" DISABLE KEYS */;
 LOCK TABLES "t1" WRITE;
-UNLOCK TABLES;
+/*!40000 ALTER TABLE "t1" DISABLE KEYS */;
 /*!40000 ALTER TABLE "t1" ENABLE KEYS */;
+UNLOCK TABLES;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -459,12 +451,11 @@ CREATE TABLE `t1` (
   `a` char(10) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 INSERT INTO `t1` VALUES ('ÄÖÜß');
-UNLOCK TABLES;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -486,12 +477,11 @@ CREATE TABLE `t1` (
   `a` char(10) DEFAULT NULL
 ) TYPE=MyISAM;
 
-
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-UNLOCK TABLES;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -510,12 +500,11 @@ CREATE TABLE `t1` (
   `a` char(10) DEFAULT NULL
 ) TYPE=MyISAM;
 
-
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-UNLOCK TABLES;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -534,12 +523,11 @@ CREATE TABLE `t1` (
   `a` char(10) DEFAULT NULL
 ) TYPE=MyISAM;
 
-
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 INSERT INTO `t1` VALUES ('ÄÖÜß');
-UNLOCK TABLES;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -568,12 +556,11 @@ CREATE TABLE `t2` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
-/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
 LOCK TABLES `t2` WRITE;
+/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
 INSERT INTO `t2` VALUES (4),(5),(6);
-UNLOCK TABLES;
 /*!40000 ALTER TABLE `t2` ENABLE KEYS */;
+UNLOCK TABLES;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -604,12 +591,11 @@ CREATE TABLE `t1` (
   `b` blob
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 INSERT INTO `t1` VALUES (0x602010000280100005E71A);
-UNLOCK TABLES;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -640,12 +626,11 @@ CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 INSERT  IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6);
-UNLOCK TABLES;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -672,7 +657,6 @@ CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 INSERT  DELAYED IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6);
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
@@ -1364,12 +1348,11 @@ CREATE TABLE `t1` (
   `F_fe73f687e5bc5280214e0486b273a5f9` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 INSERT INTO `t1` (`F_c4ca4238a0b923820dcc509a6f75849b`, `F_c81e728d9d4c2f636f067f89cc14862c`, `F_eccbc87e4b5ce2fe28308fd9f2a7baf3`, `F_a87ff679a2f3e71d9181a67b7542122c`, `F_e4da3b7fbbce2345d7772b0674a318d5`, `F_1679091c5a880faf6fb5e6087eb1b2dc`, `F_8f14e45fceea167a5a36dedd4bea2543`, `F_c9f0f895fb98ab9159f51fd0297e236d`, `F_45c48cce2e2d7fbdea1afc51c7c6ad26`, `F_d3d9446802a44259755d38e6d163e820`, `F_6512bd43d9caa6e02c990b0a82652dca`, `F_c20ad4d76fe97759aa27a0c99bff6710`, `F_c51ce410c124a10e0db5e4b97fc2af39`, `F_aab3238922bcc25a6f606eb525ffdc56`, `F_9bf31c7ff062936a96d3c8bd1f8f2ff3`, `F_c74d97b01eae257e44aa9d5bade97baf`, `F_70efdf2ec9b086079795c442636b55fb`, `F_6f4922f45568161a8cdf4ad2299f6d23`, `F_1f0e3dad99908345f7439f8ffabdffc4`, `F_98f13708210194c475687be6106a3b84`, `F_3c59dc048e8850243be8079a5c74d079`, `F_b6d767d2f8ed5d21a44b0e5886680cb9`, `F_37693cfc748049e45d87b8c7d8b9aacd`, `F_1ff1de774005f8da13f42943881c655f`, `F_8e296a067a37563370ded05f5a3bf3ec`, `F_4e732ced3463d06de0ca9a15b6153677`, `F_02e74f10e0327ad868d138f2b4fdd6f0`, `F_33e75ff09dd601bbe69f351039152189`, `F_6ea9ab1baa0efb9e19094440c317e21b`, `F_34173cb38f07f89ddbebc2ac9128303f`, `F_c16a5320fa475530d9583c34fd356ef5`, `F_6364d3f0f495b6ab9dcf8d3b5c6e0b01`, `F_182be0c5cdcd5072bb1864cdee4d3d6e`, `F_e369853df766fa44e1ed0ff613f563bd`, `F_1c383cd30b7c298ab50293adfecb7b18`, `F_19ca14e7ea6328a42e0eb13d585e4c22`, `F_a5bfc9e07964f8dddeb95fc584cd965d`, `F_a5771bce93e200c36f7cd9dfd0e5deaa`, `F_d67d8ab4f4c10bf22aa353e27879133c`, `F_d645920e395fedad7bbbed0eca3fe2e0`, `F_3416a75f4cea9109507cacd8e2f2aefc`, `F_a1d0c6e83f027327d8461063f4ac58a6`, `F_17e62166fc8586dfa4d1bc0e1742c08b`, `F_f7177163c833dff4b38fc8d2872f1ec6`, `F_6c8349cc7260ae62e3b1396831a8398f`, `F_d9d4f495e875a2e075a1a4a6e1b9770f`, `F_67c6a1e7ce56d3d6fa748ab6d9af3fd7`, `F_642e92efb79421734881b53e1e1b18b6`, `F_f457c545a9ded88f18ecee47145a72c0`, `F_c0c7c76d30bd3dcaefc96f40275bdc0a`, `F_2838023a778dfaecdc212708f721b788`, `F_9a1158154dfa42caddbd0694a4e9bdc8`, `F_d82c8d1619ad8176d665453cfb2e55f0`, `F_a684eceee76fc522773286a895bc8436`, `F_b53b3a3d6ab90ce0268229151c9bde11`, `F_9f61408e3afb633e50cdf1b20de6f466`, `F_72b32a1f754ba1c09b3695e0cb6cde7f`, `F_66f041e16a60928b05a7e228a89c3799`, `F_093f65e080a295f8076b1c5722a46aa2`, `F_072b030ba126b2f4b2374f342be9ed44`, `F_7f39f8317fbdb1988ef4c628eba02591`, `F_44f683a84163b3523afe57c2e008bc8c`, `F_03afdbd66e7929b125f8597834fa83a4`, `F_ea5d2f1c4608232e07d3aa3d998e5135`, `F_fc490ca45c00b1249bbe3554a4fdf6fb`, `F_3295c76acbf4caaed33c36b1b5fc2cb1`, `F_735b90b4568125ed6c3f678819b6e058`, `F_a3f390d88e4c41f2747bfa2f1b5f87db`, `F_14bfa6bb14875e45bba028a21ed38046`, `F_7cbbc409ec990f19c78c75bd1e06f215`, `F_e2c420d928d4bf8ce0ff2ec19b371514`, `F_32bb90e8976aab5298d5da10fe66f21d`, `F_d2ddea18f00665ce8623e36bd4e3c7c5`, `F_ad61ab143223efbc24c7d2583be69251`, `F_d09bf41544a3365a46c9077ebb5e35c3`, `F_fbd7939d674997cdb4692d34de8633c4`, `F_28dd2c7955ce926456240b2ff0100bde`, `F_35f4a8d465e6e1edc05f3d8ab658c551`, `F_d1fe173d08e959397adf34b1d77e88d7`, `F_f033ab37c30201f73f142449d037028d`, `F_43ec517d68b6edd3015b3edc9a11367b`, `F_9778d5d219c5080b9a6a17bef029331c`, `F_fe9fc289c3ff0af142b6d3bead98a923`, `F_68d30a9594728bc39aa24be94b319d21`, `F_3ef815416f775098fe977004015c6193`, `F_93db85ed909c13838ff95ccfa94cebd9`, `F_c7e1249ffc03eb9ded908c236bd1996d`, `F_2a38a4a9316c49e5a833517c45d31070`, `F_7647966b7343c29048673252e490f736`, `F_8613985ec49eb8f757ae6439e879bb2a`, `F_54229abfcfa5649e7003b83dd4755294`, `F_92cc227532d17e56e07902b254dfad10`, `F_98dce83da57b0395e163467c9dae521b`, `F_f4b9ec30ad9f68f89b29639786cb62ef`, `F_812b4ba287f5ee0bc9d43bbf5bbe87fb`, `F_26657d5ff9020d2abefe558796b99584`, `F_e2ef524fbf3d9fe611d5a8e90fefdc9c`, `F_ed3d2c21991e3bef5e069713af9fa6ca`, `F_ac627ab1ccbdb62ec96e702f07f6425b`, `F_f899139df5e1059396431415e770c6dd`, `F_38b3eff8baf56627478ec76a704e9b52`, `F_ec8956637a99787bd197eacd77acce5e`, `F_6974ce5ac660610b44d9b9fed0ff9548`, `F_c9e1074f5b3f9fc8ea15d152add07294`, `F_65b9eea6e1cc6bb9f0cd2a47751a186f`, `F_f0935e4cd5920aa6c7c996a5ee53a70f`, `F_a97da629b098b75c294dffdc3e463904`, `F_a3c65c2974270fd093ee8a9bf8ae7d0b`, `F_2723d092b63885e0d7c260cc007e8b9d`, `F_5f93f983524def3dca464469d2cf9f3e`, `F_698d51a19d8a121ce581499d7b701668`, `F_7f6ffaa6bb0b408017b62254211691b5`, `F_73278a4a86960eeb576a8fd4c9ec6997`, `F_5fd0b37cd7dbbb00f97ba6ce92bf5add`, `F_2b44928ae11fb9384c4cf38708677c48`, `F_c45147dee729311ef5b5c3003946c48f`, `F_eb160de1de89d9058fcb0b968dbbbd68`, `F_5ef059938ba799aaa845e1c2e8a762bd`, `F_07e1cd7dca89a1678042477183b7ac3f`, `F_da4fb5c6e93e74d3df8527599fa62642`, `F_4c56ff4ce4aaf9573aa5dff913df997a`, `F_a0a080f42e6f13b3a2df133f073095dd`, `F_202cb962ac59075b964b07152d234b70`, `F_c8ffe9a587b126f152ed3d89a146b445`, `F_3def184ad8f4755ff269862ea77393dd`, `F_069059b7ef840f0c74a814ec9237b6ec`, `F_ec5decca5ed3d6b8079e2e7e7bacc9f2`, `F_76dc611d6ebaafc66cc0879c71b5db5c`, `F_d1f491a404d6854880943e5c3cd9ca25`, `F_9b8619251a19057cff70779273e95aa6`, `F_1afa34a7f984eeabdbb0a7d494132ee5`, `F_65ded5353c5ee48d0b7d48c591b8f430`, `F_9fc3d7152ba9336a670e36d0ed79bc43`, `F_02522a2b2726fb0a03bb19f2d8d9524d`, `F_7f1de29e6da19d22b51c68001e7e0e54`, `F_42a0e188f5033bc65bf8d78622277c4e`, `F_3988c7f88ebcb58c6ce932b957b6f332`, `F_013d407166ec4fa56eb1e1f8cbe183b9`, `F_e00da03b685a0dd18fb6a08af0923de0`, `F_1385974ed5904a438616ff7bdb3f7439`, `F_0f28b5d49b3020afeecd95b4009adf4c`, `F_a8baa56554f96369ab93e4f3bb068c22`, `F_903ce9225fca3e988c2af215d4e544d3`, `F_0a09c8844ba8f0936c20bd791130d6b6`, `F_2b24d495052a8ce66358eb576b8912c8`, `F_a5e00132373a7031000fd987a3c9f87b`, `F_8d5e957f297893487bd98fa830fa6413`, `F_47d1e990583c9c67424d369f3414728e`, `F_f2217062e9a397a1dca429e7d70bc6ca`, `F_7ef605fc8dba5425d6965fbd4c8fbe1f`, `F_a8f15eda80c50adb0e71943adc8015cf`, `F_37a749d808e46495a8da1e5352d03cae`, `F_b3e3e393c77e35a4a3f3cbd1e429b5dc`, `F_1d7f7abc18fcb43975065399b0d1e48e`, `F_2a79ea27c279e471f4d180b08d62b00a`, `F_1c9ac0159c94d8d0cbedc973445af2da`, `F_6c4b761a28b734fe93831e3fb400ce87`, `F_06409663226af2f3114485aa4e0a23b4`, `F_140f6969d5213fd0ece03148e62e461e`, `F_b73ce398c39f506af761d2277d853a92`, `F_bd4c9ab730f5513206b999ec0d90d1fb`, `F_82aa4b0af34c2313a562076992e50aa3`, `F_0777d5c17d4066b82ab86dff8a46af6f`, `F_fa7cdfad1a5aaf8370ebeda47a1ff1c3`, `F_9766527f2b5d3e95d4a733fcfb77bd7e`, `F_7e7757b1e12abcb736ab9a754ffb617a`, `F_5878a7ab84fb43402106c575658472fa`, `F_006f52e9102a8d3be2fe5614f42ba989`, `F_3636638817772e42b59d74cff571fbb3`, `F_149e9677a5989fd342ae44213df68868`, `F_a4a042cf4fd6bfb47701cbc8a1653ada`, `F_1ff8a7b5dc7a7d1f0ed65aaa29c04b1e`, `F_f7e6c85504ce6e82442c770f7c8606f0`, `F_bf8229696f7a3bb4700cfddef19fa23f`, `F_82161242827b703e6acf9c726942a1e4`, `F_38af86134b65d0f10fe33d30dd76442e`, `F_96da2f590cd7246bbde0051047b0d6f7`, `F_8f85517967795eeef66c225f7883bdcb`, `F_8f53295a73878494e9bc8dd6c3c7104f`, `F_045117b0e0a11a242b9765e79cbf113f`, `F_fc221309746013ac554571fbd180e1c8`, `F_4c5bde74a8f110656874902f07378009`, `F_cedebb6e872f539bef8c3f919874e9d7`, `F_6cdd60ea0045eb7a6ec44c54d29ed402`, `F_eecca5b6365d9607ee5a9d336962c534`, `F_9872ed9fc22fc182d371c3e9ed316094`, `F_31fefc0e570cb3860f2a6d4b38c6490d`, `F_9dcb88e0137649590b755372b040afad`, `F_a2557a7b2e94197ff767970b67041697`, `F_cfecdb276f634854f3ef915e2e980c31`, `F_0aa1883c6411f7873cb83dacb17b0afc`, `F_58a2fc6ed39fd083f55d4182bf88826d`, `F_bd686fd640be98efaae0091fa301e613`, `F_a597e50502f5ff68e3e25b9114205d4a`, `F_0336dcbab05b9d5ad24f4333c7658a0e`, `F_084b6fbb10729ed4da8c3d3f5a3ae7c9`, `F_85d8ce590ad8981ca2c8286f79f59954`, `F_0e65972dce68dad4d52d063967f0a705`, `F_84d9ee44e457ddef7f2c4f25dc8fa865`, `F_3644a684f98ea8fe223c713b77189a77`, `F_757b505cfd34c64c85ca5b5690ee5293`, `F_854d6fae5ee42911677c739ee1734486`, `F_e2c0be24560d78c5e599c2a9c9d0bbd2`, `F_274ad4786c3abca69fa097b85867d9a4`, `F_eae27d77ca20db309e056e3d2dcd7d69`, `F_7eabe3a1649ffa2b3ff8c02ebfd5659f`, `F_69adc1e107f7f7d035d7baf04342e1ca`, `F_091d584fced301b442654dd8c23b3fc9`, `F_b1d10e7bafa4421218a51b1e1f1b0ba2`, `F_6f3ef77ac0e3619e98159e9b6febf557`, `F_eb163727917cbba1eea208541a643e74`, `F_1534b76d325a8f591b52d302e7181331`, `F_979d472a84804b9f647bc185a877a8b5`, `F_ca46c1b9512a7a8315fa3c5a946e8265`, `F_3b8a614226a953a8cd9526fca6fe9ba5`, `F_45fbc6d3e05ebd93369ce542e8f2322d`, `F_63dc7ed1010d3c3b8269faf0ba7491d4`, `F_e96ed478dab8595a7dbda4cbcbee168f`, `F_c0e190d8267e36708f955d7ab048990d`, `F_ec8ce6abb3e952a85b8551ba726a1227`, `F_060ad92489947d410d897474079c1477`, `F_bcbe3365e6ac95ea2c0343a2395834dd`, `F_115f89503138416a242f40fb7d7f338e`, `F_13fe9d84310e77f13a6d184dbf1232f3`, `F_d1c38a09acc34845c6be3a127a5aacaf`, `F_9cfdf10e8fc047a44b08ed031e1f0ed1`, `F_705f2172834666788607efbfca35afb3`, `F_74db120f0a8e5646ef5a30154e9f6deb`, `F_57aeee35c98205091e18d1140e9f38cf`, `F_6da9003b743b65f4c0ccd295cc484e57`, `F_9b04d152845ec0a378394003c96da594`, `F_be83ab3ecd0db773eb2dc1b0a17836a1`, `F_e165421110ba03099a1c0393373c5b43`, `F_289dff07669d7a23de0ef88d2f7129e7`, `F_577ef1154f3240ad5b9b413aa7346a1e`, `F_01161aaa0b6d1345dd8fe4e481144d84`, `F_539fd53b59e3bb12d203f45a912eeaf2`, `F_ac1dd209cbcc5e5d1c6e28598e8cbbe8`, `F_555d6702c950ecb729a966504af0a635`, `F_335f5352088d7d9bf74191e006d8e24c`, `F_f340f1b1f65b6df5b5e3f94d95b11daf`, `F_e4a6222cdb5b34375400904f03d8e6a5`, `F_cb70ab375662576bd1ac5aaf16b3fca4`, `F_9188905e74c28e489b44e954ec0b9bca`, `F_0266e33d3f546cb5436a10798e657d97`, `F_38db3aed920cf82ab059bfccbd02be6a`, `F_3cec07e9ba5f5bb252d13f5f431e4bbb`, `F_621bf66ddb7c962aa0d22ac97d69b793`, `F_077e29b11be80ab57e1a2ecabb7da330`, `F_6c9882bbac1c7093bd25041881277658`, `F_19f3cd308f1455b3fa09a282e0d496f4`, `F_03c6b06952c750899bb03d998e631860`, `F_c24cd76e1ce41366a4bbe8a49b02a028`, `F_c52f1bd66cc19d05628bd8bf27af3ad6`, `F_fe131d7f5a6b38b23cc967316c13dae2`, `F_f718499c1c8cef6730f9fd03c8125cab`, `F_d96409bf894217686ba124d7356686c9`, `F_502e4a16930e414107ee22b6198c578f`, `F_cfa0860e83a4c3a763a7e62d825349f7`, `F_a4f23670e1833f3fdb077ca70bbd5d66`, `F_b1a59b315fc9a3002ce38bbe070ec3f5`, `F_36660e59856b4de58a219bcf4e27eba3`, `F_8c19f571e251e61cb8dd3612f26d5ecf`, `F_d6baf65e0b240ce177cf70da146c8dc8`, `F_e56954b4f6347e897f954495eab16a88`, `F_f7664060cc52bc6f3d620bcedc94a4b6`, `F_eda80a3d5b344bc40f3bc04f65b7a357`, `F_8f121ce07d74717e0b1f21d122e04521`, `F_06138bc5af6023646ede0e1f7c1eac75`, `F_39059724f73a9969845dfe4146c5660e`, `F_7f100b7b36092fb9b06dfb4fac360931`, `F_7a614fd06c325499f1680b9896beedeb`, `F_4734ba6f3de83d861c3176a6273cac6d`, `F_d947bf06a885db0d477d707121934ff8`, `F_63923f49e5241343aa7acb6a06a751e7`, `F_db8e1af0cb3aca1ae2d0018624204529`, `F_20f07591c6fcb220ffe637cda29bb3f6`, `F_07cdfd23373b17c6b337251c22b7ea57`, `F_d395771085aab05244a4fb8fd91bf4ee`, `F_92c8c96e4c37100777c7190b76d28233`, `F_e3796ae838835da0b6f6ea37bcf8bcb7`, `F_6a9aeddfc689c1d0e3b9ccc3ab651bc5`, `F_0f49c89d1e7298bb9930789c8ed59d48`, `F_46ba9f2a6976570b0353203ec4474217`, `F_0e01938fc48a2cfb5f2217fbfb00722d`, `F_16a5cdae362b8d27a1d8f8c7b78b4330`, `F_918317b57931b6b7a7d29490fe5ec9f9`, `F_48aedb8880cab8c45637abc7493ecddd`, `F_839ab46820b524afda05122893c2fe8e`, `F_f90f2aca5c640289d0a29417bcb63a37`, `F_9c838d2e45b2ad1094d42f4ef36764f6`, `F_1700002963a49da13542e0726b7bb758`, `F_53c3bce66e43be4f209556518c2fcb54`, `F_6883966fd8f918a4aa29be29d2c386fb`, `F_49182f81e6a13cf5eaa496d51fea6406`, `F_d296c101daa88a51f6ca8cfc1ac79b50`, `F_9fd81843ad7f202f26c1a174c7357585`, `F_26e359e83860db1d11b6acca57d8ea88`, `F_ef0d3930a7b6c95bd2b32ed45989c61f`, `F_94f6d7e04a4d452035300f18b984988c`, `F_34ed066df378efacc9b924ec161e7639`, `F_577bcc914f9e55d5e4e4f82f9f00e7d4`, `F_11b9842e0a271ff252c1903e7132cd68`, `F_37bc2f75bf1bcfe8450a1a41c200364c`, `F_496e05e1aea0a9c4655800e8a7b9ea28`, `F_b2eb7349035754953b57a32e2841bda5`, `F_8e98d81f8217304975ccb23337bb5761`, `F_a8c88a0055f636e4a163a5e3d16adab7`, `F_eddea82ad2755b24c4e168c5fc2ebd40`, `F_06eb61b839a0cefee4967c67ccb099dc`, `F_9dfcd5e558dfa04aaf37f137a1d9d3e5`, `F_950a4152c2b4aa3ad78bdd6b366cc179`, `F_158f3069a435b314a80bdcb024f8e422`, `F_758874998f5bd0c393da094e1967a72b`, `F_ad13a2a07ca4b7642959dc0c4c740ab6`, `F_3fe94a002317b5f9259f82690aeea4cd`, `F_5b8add2a5d98b1a652ea7fd72d942dac`, `F_432aca3a1e345e339f35a30c8f65edce`, `F_8d3bba7425e7c98c50f52ca1b52d3735`, `F_320722549d1751cf3f247855f937b982`, `F_caf1a3dfb505ffed0d024130f58c5cfa`, `F_5737c6ec2e0716f3d8a7a5c4e0de0d9a`, `F_bc6dc48b743dc5d013b1abaebd2faed2`, `F_f2fc990265c712c49d51a18a32b39f0c`, `F_89f0fd5c927d466d6ec9a21b9ac34ffa`, `F_a666587afda6e89aec274a3657558a27`, `F_b83aac23b9528732c23cc7352950e880`, `F_cd00692c3bfe59267d5ecfac5310286c`, `F_6faa8040da20ef399b63a72d0e4ab575`, `F_fe73f687e5bc5280214e0486b273a5f9`) VALUES (NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-UNLOCK TABLES;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -1405,12 +1388,11 @@ CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 INSERT INTO `t1` VALUES (1),(2),(3);
-UNLOCK TABLES;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -1451,12 +1433,11 @@ CREATE TABLE `t2` (
   KEY `a` (`a`(5))
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
-/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
 LOCK TABLES `t2` WRITE;
+/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
 INSERT INTO `t2` VALUES ('alfred'),('angie'),('bingo'),('waffle'),('lemon');
-UNLOCK TABLES;
 /*!40000 ALTER TABLE `t2` ENABLE KEYS */;
+UNLOCK TABLES;
 DROP TABLE IF EXISTS `v2`;
 /*!50001 DROP VIEW IF EXISTS `v2`*/;
 /*!50001 CREATE TABLE `v2` (
@@ -1863,11 +1844,10 @@ CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 LOCK TABLES `t1` WRITE;
-UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
 DROP TABLE IF EXISTS `v1`;
 /*!50001 DROP VIEW IF EXISTS `v1`*/;
 /*!50001 CREATE TABLE `v1` (
@@ -1919,12 +1899,11 @@ CREATE TABLE `t2` (
   KEY `a` (`a`(5))
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
-/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
 LOCK TABLES `t2` WRITE;
+/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
 INSERT INTO `t2` VALUES ('alfred'),('angie'),('bingo'),('waffle'),('lemon');
-UNLOCK TABLES;
 /*!40000 ALTER TABLE `t2` ENABLE KEYS */;
+UNLOCK TABLES;
 DROP TABLE IF EXISTS `v2`;
 /*!50001 DROP VIEW IF EXISTS `v2`*/;
 /*!50001 CREATE TABLE `v2` (
@@ -1968,12 +1947,11 @@ CREATE TABLE `t1` (
   `a` char(10) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 INSERT INTO `t1` VALUES ('\'');
-UNLOCK TABLES;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -2011,12 +1989,11 @@ CREATE TABLE `t1` (
   `c` varchar(30) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 INSERT INTO `t1` VALUES (1,2,'one'),(2,4,'two'),(3,6,'three');
-UNLOCK TABLES;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
 DROP TABLE IF EXISTS `v1`;
 /*!50001 DROP VIEW IF EXISTS `v1`*/;
 /*!50001 CREATE TABLE `v1` (
@@ -2128,12 +2105,11 @@ CREATE TABLE `t1` (
   `b` bigint(20) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 INSERT INTO `t1` VALUES (1,NULL),(2,NULL),(4,NULL),(11,NULL);
-UNLOCK TABLES;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
 
 /*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
 DELIMITER ;;
@@ -2164,11 +2140,10 @@ CREATE TABLE `t2` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
-/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
 LOCK TABLES `t2` WRITE;
-UNLOCK TABLES;
+/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
 /*!40000 ALTER TABLE `t2` ENABLE KEYS */;
+UNLOCK TABLES;
 
 /*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
 DELIMITER ;;
@@ -2212,22 +2187,20 @@ CREATE TABLE `t1` (
   `b` bigint(20) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 INSERT INTO `t1` VALUES (1,NULL),(2,NULL),(4,NULL),(11,NULL);
-UNLOCK TABLES;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
 DROP TABLE IF EXISTS `t2`;
 CREATE TABLE `t2` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
-/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
 LOCK TABLES `t2` WRITE;
-UNLOCK TABLES;
+/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
 /*!40000 ALTER TABLE `t2` ENABLE KEYS */;
+UNLOCK TABLES;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -2341,12 +2314,11 @@ CREATE TABLE `t1` (
   `id` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 INSERT INTO `t1` VALUES (1),(2),(3),(4),(5);
-UNLOCK TABLES;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
 DELIMITER ;;
 /*!50003 DROP FUNCTION IF EXISTS `bug9056_func1` */;;
 /*!50003 SET SESSION SQL_MODE=""*/;;
@@ -2430,12 +2402,11 @@ CREATE TABLE `t1` (
   UNIQUE KEY `d` (`d`)
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 INSERT INTO `t1` VALUES ('2003-10-25 22:00:00'),('2003-10-25 23:00:00');
-UNLOCK TABLES;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -2465,12 +2436,11 @@ CREATE TABLE `t1` (
   UNIQUE KEY `d` (`d`)
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 INSERT INTO `t1` VALUES ('2003-10-26 02:00:00'),('2003-10-26 02:00:00');
-UNLOCK TABLES;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
@@ -2512,12 +2482,11 @@ CREATE TABLE "t1 test" (
   "a1" int(11) DEFAULT NULL
 );
 
-
-/*!40000 ALTER TABLE "t1 test" DISABLE KEYS */;
 LOCK TABLES "t1 test" WRITE;
+/*!40000 ALTER TABLE "t1 test" DISABLE KEYS */;
 INSERT INTO "t1 test" VALUES (1),(2),(3);
-UNLOCK TABLES;
 /*!40000 ALTER TABLE "t1 test" ENABLE KEYS */;
+UNLOCK TABLES;
 
 /*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
 DELIMITER ;;
@@ -2532,12 +2501,11 @@ CREATE TABLE "t2 test" (
   "a2" int(11) DEFAULT NULL
 );
 
-
-/*!40000 ALTER TABLE "t2 test" DISABLE KEYS */;
 LOCK TABLES "t2 test" WRITE;
+/*!40000 ALTER TABLE "t2 test" DISABLE KEYS */;
 INSERT INTO "t2 test" VALUES (1),(2),(3);
-UNLOCK TABLES;
 /*!40000 ALTER TABLE "t2 test" ENABLE KEYS */;
+UNLOCK TABLES;
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -2583,12 +2551,11 @@ CREATE TABLE `t1` (
   `c` varchar(32) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 INSERT INTO `t1` VALUES (1,'first value','xxxx'),(2,'second value','tttt'),(3,'third value','vvv vvv');
-UNLOCK TABLES;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
 DROP TABLE IF EXISTS `v0`;
 /*!50001 DROP VIEW IF EXISTS `v0`*/;
 /*!50001 CREATE TABLE `v0` (
@@ -2707,11 +2674,10 @@ CREATE TABLE `t1` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 LOCK TABLES `t1` WRITE;
-UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
 
 /*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
 DELIMITER ;;
@@ -2734,6 +2700,111 @@ DELIMITER ;
 
 DROP TRIGGER tr1;
 DROP TABLE t1;
+create table t1 (a binary(1), b blob);
+insert into t1 values ('','');
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+  `a` binary(1) default NULL,
+  `b` blob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+INSERT INTO `t1` VALUES (0x00,'');
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+  `a` binary(1) default NULL,
+  `b` blob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+INSERT INTO `t1` VALUES (0x00,'');
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+drop table t1;
+create table t1(a int);
+create table t2(a int);
+create table t3(a int);
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `t3`;
+CREATE TABLE `t3` (
+  `a` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+  `a` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+DROP TABLE IF EXISTS `t2`;
+CREATE TABLE `t2` (
+  `a` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+drop table t1, t2, t3;
+End of 4.1 tests
 create table t1 (a int);
 insert into t1 values (289), (298), (234), (456), (789);
 create definer = CURRENT_USER view v1 as select * from t1;
@@ -2824,6 +2895,124 @@ mysqldump {
 
 } mysqldump
 drop view v1;
+create database mysqldump_test_db;
+use mysqldump_test_db;
+create table t1 (id int);
+create view v1 as select * from t1;
+insert into t1 values (1232131);
+insert into t1 values (4711);
+insert into t1 values (3231);
+insert into t1 values (0815);
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+/*!40000 DROP DATABASE IF EXISTS `mysqldump_test_db`*/;
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_test_db` /*!40100 DEFAULT CHARACTER SET latin1 */;
+
+USE `mysqldump_test_db`;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+  `id` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+INSERT INTO `t1` VALUES (1232131),(4711),(3231),(815);
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `v1`;
+/*!50001 DROP VIEW IF EXISTS `v1`*/;
+/*!50001 CREATE TABLE `v1` (
+  `id` int(11)
+) */;
+/*!50001 DROP TABLE IF EXISTS `v1`*/;
+/*!50001 DROP VIEW IF EXISTS `v1`*/;
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50001 VIEW `v1` AS select `t1`.`id` AS `id` from `t1` */;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+drop view v1;
+drop table t1;
+drop database mysqldump_test_db;
+create database mysqldump_tables;
+use mysqldump_tables;
+create table basetable ( id serial, tag varchar(64) );
+create database mysqldump_views;
+use mysqldump_views;
+create view nasishnasifu as select mysqldump_tables.basetable.id from mysqldump_tables.basetable;
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_tables` /*!40100 DEFAULT CHARACTER SET latin1 */;
+
+USE `mysqldump_tables`;
+DROP TABLE IF EXISTS `basetable`;
+CREATE TABLE `basetable` (
+  `id` bigint(20) unsigned NOT NULL auto_increment,
+  `tag` varchar(64) default NULL,
+  UNIQUE KEY `id` (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+LOCK TABLES `basetable` WRITE;
+/*!40000 ALTER TABLE `basetable` DISABLE KEYS */;
+/*!40000 ALTER TABLE `basetable` ENABLE KEYS */;
+UNLOCK TABLES;
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_views` /*!40100 DEFAULT CHARACTER SET latin1 */;
+
+USE `mysqldump_views`;
+DROP TABLE IF EXISTS `nasishnasifu`;
+/*!50001 DROP VIEW IF EXISTS `nasishnasifu`*/;
+/*!50001 CREATE TABLE `nasishnasifu` (
+  `id` bigint(20) unsigned
+) */;
+/*!50001 DROP TABLE IF EXISTS `nasishnasifu`*/;
+/*!50001 DROP VIEW IF EXISTS `nasishnasifu`*/;
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50001 VIEW `mysqldump_views`.`nasishnasifu` AS select `mysqldump_tables`.`basetable`.`id` AS `id` from `mysqldump_tables`.`basetable` */;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+drop view nasishnasifu;
+drop database mysqldump_views;
+drop table mysqldump_tables.basetable;
+drop database mysqldump_tables;
 create table t1 (a text , b text);
 create table t2 (a text , b text);
 insert t1 values ("Duck, Duck", "goose");

--- 1.106/mysql-test/t/mysqldump.test	2006-07-28 15:51:54 -07:00
+++ 1.107/mysql-test/t/mysqldump.test	2006-07-28 15:51:54 -07:00
@@ -1207,6 +1207,41 @@ drop table t1;
 --exec $MYSQL_DUMP --force -N --compact --skip-comments test
 --echo } mysqldump
 drop view v1;
+
+# BUG#17201 Spurious 'DROP DATABASE' in output,
+# also confusion between tables and views.
+# Example code from Markus Popp
+
+create database mysqldump_test_db;
+use mysqldump_test_db;
+create table t1 (id int);
+create view v1 as select * from t1;
+insert into t1 values (1232131);
+insert into t1 values (4711);
+insert into t1 values (3231);
+insert into t1 values (0815);
+--exec $MYSQL_DUMP --skip-comments --add-drop-database --databases mysqldump_test_db
+drop view v1;
+drop table t1;
+drop database mysqldump_test_db;
+
+# Bug21014 Segmentation fault of mysqldump on view
+
+create database mysqldump_tables;
+use mysqldump_tables;
+create table basetable ( id serial, tag varchar(64) );
+
+create database mysqldump_views;
+use mysqldump_views;
+create view nasishnasifu as select mysqldump_tables.basetable.id from mysqldump_tables.basetable;
+
+--exec $MYSQL_DUMP --skip-comments --databases mysqldump_tables mysqldump_views;
+
+drop view nasishnasifu;
+drop database mysqldump_views;
+drop table mysqldump_tables.basetable;
+drop database mysqldump_tables;
+
 # Added for use-thread option
 #
 create table t1 (a text , b text);

--- 1.69/mysql-test/r/ps.result	2006-07-28 15:51:54 -07:00
+++ 1.70/mysql-test/r/ps.result	2006-07-28 15:51:54 -07:00
@@ -485,6 +485,20 @@ execute stmt;
 pnum
 deallocate prepare stmt;
 drop table t1, t2;
+drop table if exists t1;
+create temporary table if not exists t1 (a1 int);
+prepare stmt from "delete t1 from t1 where (cast(a1/3 as unsigned) * 3) = a1";
+drop temporary table t1;
+create temporary table if not exists t1 (a1 int);
+execute stmt;
+drop temporary table t1;
+create temporary table if not exists t1 (a1 int);
+execute stmt;
+drop temporary table t1;
+create temporary table if not exists t1 (a1 int);
+execute stmt;
+drop temporary table t1;
+deallocate prepare stmt;
 create table t1 (a varchar(20));
 insert into t1 values ('foo');
 prepare stmt FROM 'SELECT char_length (a) FROM t1';

--- 1.67/mysql-test/t/ps.test	2006-07-28 15:51:54 -07:00
+++ 1.68/mysql-test/t/ps.test	2006-07-28 15:51:54 -07:00
@@ -491,6 +491,30 @@ deallocate prepare stmt;
 drop table t1, t2;
 
 #
+# Bug#19399 "Stored Procedures 'Lost Connection' when dropping/creating
+#            tables"
+# Check that multi-delete tables are also cleaned up before re-execution.
+# 
+--disable_warnings
+drop table if exists t1;
+create temporary table if not exists t1 (a1 int);
+--enable_warnings
+# exact delete syntax is essential
+prepare stmt from "delete t1 from t1 where (cast(a1/3 as unsigned) * 3) = a1";
+drop temporary table t1;
+create temporary table if not exists t1 (a1 int);
+# the server crashed on  the next statement without the fix
+execute stmt;
+drop temporary table t1;
+create temporary table if not exists t1 (a1 int);
+# the problem was in memory corruption: repeat the test just in case
+execute stmt;
+drop temporary table t1;
+create temporary table if not exists t1 (a1 int);
+execute stmt;
+drop temporary table t1;
+deallocate prepare stmt;
+
 # Bug#6102 "Server crash with prepared statement and blank after
 # function name"
 # ensure that stored functions are cached when preparing a statement

--- 1.15/extra/yassl/include/openssl/ssl.h	2006-07-28 15:51:54 -07:00
+++ 1.16/extra/yassl/include/openssl/ssl.h	2006-07-28 15:51:54 -07:00
@@ -9,6 +9,10 @@
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
+ * There are special exceptions to the terms and conditions of the GPL as it
+ * is applied to yaSSL. View the full text of the exception in the file
+ * FLOSS-EXCEPTIONS in the directory of this software distribution.
+ *
  * yaSSL is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@@ -36,6 +40,10 @@
 #include "opensslv.h" /* for version number */
 #include "rsa.h"
 
+
+#define YASSL_VERSION "1.3.7"
+
+
 #if defined(__cplusplus)
 extern "C" {
 #endif
@@ -414,6 +422,7 @@ int         RAND_load_file(const char*, 
 
 /* for libcurl */
 int  RAND_status(void);
+int  RAND_bytes(unsigned char* buf, int num);
 
 int  DES_set_key(const_DES_cblock*, DES_key_schedule*);
 void DES_set_odd_parity(DES_cblock*);
@@ -421,6 +430,7 @@ void DES_ecb_encrypt(DES_cblock*, DES_cb
 
 void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX*, void* userdata);
 void SSL_SESSION_free(SSL_SESSION* session);
+int  SSL_peek(SSL* ssl, void* buf, int num);
 
 X509*     SSL_get_certificate(SSL* ssl);
 EVP_PKEY* SSL_get_privatekey(SSL* ssl);
@@ -512,6 +522,8 @@ typedef struct MD5_CTX {
 void MD5_Init(MD5_CTX*);
 void MD5_Update(MD5_CTX*, const void*, unsigned long);
 void MD5_Final(unsigned char*, MD5_CTX*);
+
+#define MD5_DIGEST_LENGTH 16
 
 
 #define SSL_DEFAULT_CIPHER_LIST ""   /* default all */

--- 1.12/extra/yassl/include/yassl_int.hpp	2006-07-28 15:51:54 -07:00
+++ 1.13/extra/yassl/include/yassl_int.hpp	2006-07-28 15:51:54 -07:00
@@ -9,6 +9,10 @@
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
+ * There are special exceptions to the terms and conditions of the GPL as it
+ * is applied to yaSSL. View the full text of the exception in the file
+ * FLOSS-EXCEPTIONS in the directory of this software distribution.
+ *
  * yaSSL is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@@ -429,9 +433,10 @@ private:
 
 // holds input and output buffers
 class Buffers {
+public: 
     typedef mySTL::list<input_buffer*>  inputList;
     typedef mySTL::list<output_buffer*> outputList;
-
+private:
     inputList  dataList_;                // list of users app data / handshake
     outputList handShakeList_;           // buffered handshake msgs
 public:
@@ -458,7 +463,7 @@ class Security {
     bool          resuming_;                      // trying to resume
 public:
     Security(ProtocolVersion, RandomPool&, ConnectionEnd, const Ciphers&,
-             SSL_CTX*);
+             SSL_CTX*, bool);
 
     const SSL_CTX*     GetContext()     const;
     const Connection&  get_connection() const;
@@ -521,6 +526,7 @@ public:
     void makeTLSMasterSecret();
     void addData(input_buffer* data);
     void fillData(Data&);
+    void PeekData(Data&);
     void addBuffer(output_buffer* b);
     void flushBuffer();
     void verifyState(const RecordLayerHeader&);

--- 1.17/extra/yassl/src/ssl.cpp	2006-07-28 15:51:55 -07:00
+++ 1.18/extra/yassl/src/ssl.cpp	2006-07-28 15:51:55 -07:00
@@ -9,6 +9,10 @@
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
+ * There are special exceptions to the terms and conditions of the GPL as it
+ * is applied to yaSSL. View the full text of the exception in the file
+ * FLOSS-EXCEPTIONS in the directory of this software distribution.
+ *
  * yaSSL is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@@ -64,12 +68,15 @@ int read_file(SSL_CTX* ctx, const char* 
         return SSL_BAD_FILE;
 
     if (type == CA) {
-        x509* ptr = PemToDer(file, Cert);
-        if (!ptr) {
+        // may have a bunch of CAs
+        x509* ptr;
+        while ( (ptr = PemToDer(input, Cert)) )
+            ctx->AddCA(ptr);
+
+        if (!feof(input)) {
             fclose(input);
             return SSL_BAD_FILE;
         }
-        ctx->AddCA(ptr);  // takes ownership
     }
     else {
         x509*& x = (type == Cert) ? ctx->certificate_ : ctx->privateKey_;
@@ -86,7 +93,7 @@ int read_file(SSL_CTX* ctx, const char* 
             }
         }
         else {
-            x = PemToDer(file, type);
+            x = PemToDer(input, type);
             if (!x) {
                 fclose(input);
                 return SSL_BAD_FILE;
@@ -1189,6 +1196,35 @@ void MD5_Final(unsigned char* hash, MD5_
 }
 
 
+int RAND_bytes(unsigned char* buf, int num)
+{
+    RandomPool ran;
+
+    if (ran.GetError()) return 0;
+
+    ran.Fill(buf, num);
+    return 1;
+}
+
+
+int SSL_peek(SSL* ssl, void* buffer, int sz)
+{
+    Data data(min(sz, MAX_RECORD_SIZE), static_cast<opaque*>(buffer));
+    return receiveData(*ssl, data, true);
+}
+
+
+int SSL_pending(SSL* ssl)
+{
+    // Just in case there's pending data that hasn't been processed yet...
+    char c;
+    SSL_peek(ssl, &c, 1);
+    
+    return ssl->bufferedData();
+}
+
+
+
     // functions for stunnel
 
     void RAND_screen()
@@ -1347,12 +1383,6 @@ void MD5_Final(unsigned char* hash, MD5_
 
 
     int SSL_set_wfd(SSL*, int)
-    {
-        return SSL_SUCCESS; // TODO:
-    }
-
-
-    int SSL_pending(SSL*)
     {
         return SSL_SUCCESS; // TODO:
     }

--- 1.11/extra/yassl/src/template_instnt.cpp	2006-07-28 15:51:55 -07:00
+++ 1.12/extra/yassl/src/template_instnt.cpp	2006-07-28 15:51:55 -07:00
@@ -9,6 +9,10 @@
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
+ * There are special exceptions to the terms and conditions of the GPL as it
+ * is applied to yaSSL. View the full text of the exception in the file
+ * FLOSS-EXCEPTIONS in the directory of this software distribution.
+ *
  * yaSSL is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

--- 1.9/extra/yassl/src/yassl_imp.cpp	2006-07-28 15:51:55 -07:00
+++ 1.10/extra/yassl/src/yassl_imp.cpp	2006-07-28 15:51:55 -07:00
@@ -9,6 +9,10 @@
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
+ * There are special exceptions to the terms and conditions of the GPL as it
+ * is applied to yaSSL. View the full text of the exception in the file
+ * FLOSS-EXCEPTIONS in the directory of this software distribution.
+ *
  * yaSSL is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@@ -428,7 +432,7 @@ opaque* DH_Server::get_serverKey() const
 
 // set available suites
 Parameters::Parameters(ConnectionEnd ce, const Ciphers& ciphers, 
-                       ProtocolVersion pv) : entity_(ce)
+                       ProtocolVersion pv, bool haveDH) : entity_(ce)
 {
     pending_ = true;	// suite not set yet
 
@@ -438,11 +442,11 @@ Parameters::Parameters(ConnectionEnd ce,
         SetCipherNames();
     }
     else 
-        SetSuites(pv);  // defaults
+        SetSuites(pv, ce == server_end && !haveDH);  // defaults
 }
 
 
-void Parameters::SetSuites(ProtocolVersion pv)
+void Parameters::SetSuites(ProtocolVersion pv, bool removeDH)
 {
     int i = 0;
     // available suites, best first
@@ -450,19 +454,23 @@ void Parameters::SetSuites(ProtocolVersi
     //      MAX_CIPHERS is big enough
 
     if (isTLS(pv)) {
+        if (!removeDH) {
         suites_[i++] = 0x00;
         suites_[i++] = TLS_DHE_RSA_WITH_AES_256_CBC_SHA;
         suites_[i++] = 0x00;
         suites_[i++] = TLS_DHE_DSS_WITH_AES_256_CBC_SHA;
+        }
         suites_[i++] = 0x00;
         suites_[i++] = TLS_RSA_WITH_AES_256_CBC_SHA;
 
-        suites_[i++] = 0x00;
-        suites_[i++] = TLS_RSA_WITH_AES_128_CBC_SHA;
+        if (!removeDH) {
         suites_[i++] = 0x00;
         suites_[i++] = TLS_DHE_RSA_WITH_AES_128_CBC_SHA;
         suites_[i++] = 0x00;
         suites_[i++] = TLS_DHE_DSS_WITH_AES_128_CBC_SHA;
+        }
+        suites_[i++] = 0x00;
+        suites_[i++] = TLS_RSA_WITH_AES_128_CBC_SHA;
 
         suites_[i++] = 0x00;
         suites_[i++] = TLS_RSA_WITH_AES_256_CBC_RMD160;
@@ -471,6 +479,7 @@ void Parameters::SetSuites(ProtocolVersi
         suites_[i++] = 0x00;
         suites_[i++] = TLS_RSA_WITH_3DES_EDE_CBC_RMD160;
 
+        if (!removeDH) {
         suites_[i++] = 0x00;
         suites_[i++] = TLS_DHE_RSA_WITH_AES_256_CBC_RMD160;
         suites_[i++] = 0x00;
@@ -485,6 +494,7 @@ void Parameters::SetSuites(ProtocolVersi
         suites_[i++] = 0x00;
         suites_[i++] = TLS_DHE_DSS_WITH_3DES_EDE_CBC_RMD160;
     }
+    }
 
     suites_[i++] = 0x00;
     suites_[i++] = SSL_RSA_WITH_RC4_128_SHA;  
@@ -496,6 +506,7 @@ void Parameters::SetSuites(ProtocolVersi
     suites_[i++] = 0x00;
     suites_[i++] = SSL_RSA_WITH_DES_CBC_SHA;
 
+    if (!removeDH) {
     suites_[i++] = 0x00;
     suites_[i++] = SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA;  
     suites_[i++] = 0x00;
@@ -505,6 +516,7 @@ void Parameters::SetSuites(ProtocolVersi
     suites_[i++] = SSL_DHE_RSA_WITH_DES_CBC_SHA;  
     suites_[i++] = 0x00;
     suites_[i++] = SSL_DHE_DSS_WITH_DES_CBC_SHA;
+    }
 
     suites_size_ = i;
 

--- 1.20/extra/yassl/src/yassl_int.cpp	2006-07-28 15:51:55 -07:00
+++ 1.21/extra/yassl/src/yassl_int.cpp	2006-07-28 15:51:55 -07:00
@@ -9,6 +9,10 @@
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
+ * There are special exceptions to the terms and conditions of the GPL as it
+ * is applied to yaSSL. View the full text of the exception in the file
+ * FLOSS-EXCEPTIONS in the directory of this software distribution.
+ *
  * yaSSL is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@@ -260,7 +264,8 @@ const ClientKeyFactory& sslFactory::getC
 // extract context parameters and store
 SSL::SSL(SSL_CTX* ctx) 
     : secure_(ctx->getMethod()->getVersion(), crypto_.use_random(),
-              ctx->getMethod()->getSide(), ctx->GetCiphers(), ctx)
+              ctx->getMethod()->getSide(), ctx->GetCiphers(), ctx,
+              ctx->GetDH_Parms().set_)
 {
     if (int err = crypto_.get_random().GetError()) {
         SetError(YasslError(err));
@@ -986,6 +991,36 @@ void SSL::fillData(Data& data)
 }
 
 
+// like Fill but keep data in buffer
+void SSL::PeekData(Data& data)
+{
+    if (GetError()) return;
+    uint dataSz   = data.get_length();        // input, data size to fill
+    uint elements = buffers_.getData().size();
+
+    data.set_length(0);                         // output, actual data filled
+    dataSz = min(dataSz, bufferedData());
+
+    Buffers::inputList::iterator front = buffers_.getData().begin();
+
+    while (elements) {
+        uint frontSz = (*front)->get_remaining();
+        uint readSz  = min(dataSz - data.get_length(), frontSz);
+        uint before  = (*front)->get_current();
+
+        (*front)->read(data.set_buffer() + data.get_length(), readSz);
+        data.set_length(data.get_length() + readSz);
+        (*front)->set_current(before);
+
+        if (data.get_length() == dataSz)
+            break;
+
+        elements--;
+        front++;
+    }
+}
+
+
 // flush output buffer
 void SSL::flushBuffer()
 {
@@ -1910,9 +1945,9 @@ Buffers::outputList& Buffers::useHandSha
 
 
 Security::Security(ProtocolVersion pv, RandomPool& ran, ConnectionEnd ce,
-                   const Ciphers& ciphers, SSL_CTX* ctx)
-   : conn_(pv, ran), parms_(ce, ciphers, pv), resumeSession_(ran), ctx_(ctx),
-     resuming_(false)
+                   const Ciphers& ciphers, SSL_CTX* ctx, bool haveDH)
+   : conn_(pv, ran), parms_(ce, ciphers, pv, haveDH), resumeSession_(ran),
+     ctx_(ctx), resuming_(false)
 {}
 
 

--- 1.173/sql/sql_prepare.cc	2006-07-28 15:51:55 -07:00
+++ 1.174/sql/sql_prepare.cc	2006-07-28 15:51:55 -07:00
@@ -2141,7 +2141,8 @@ void reinit_stmt_before_use(THD *thd, LE
       Reset old pointers to TABLEs: they are not valid since the tables
       were closed in the end of previous prepare or execute call.
     */
-    tables->table= 0;
+    tables->reinit_before_use(thd);
+
     /* Reset is_schema_table_processed value(needed for I_S tables */
     tables->is_schema_table_processed= FALSE;
 

--- 1.199/tests/mysql_client_test.c	2006-07-28 15:51:55 -07:00
+++ 1.200/tests/mysql_client_test.c	2006-07-28 15:51:55 -07:00
@@ -58,6 +58,7 @@ static unsigned int iter_count= 0;
 static my_bool have_innodb= FALSE;
 
 static const char *opt_basedir= "./";
+static const char *opt_vardir= "mysql-test/var";
 
 static longlong opt_getopt_ll_test= 0;
 
@@ -13099,7 +13100,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) ||
+                                               sizeof(buff), 0,0,1,NULL) ||
            (*mysql->methods->read_query_result)(mysql));
       DIE_UNLESS(rc);
       if (!opt_silent && i == 0)
@@ -14901,6 +14902,7 @@ static void test_bug17667()
 
   struct buffer_and_length *statement_cursor;
   FILE *log_file;
+  char *master_log_filename;
 
   myheader("test_bug17667");
 
@@ -14912,7 +14914,13 @@ static void test_bug17667()
   }
 
   sleep(1); /* The server may need time to flush the data to the log. */
-  log_file= fopen("var/log/master.log", "r");
+
+  master_log_filename = (char *) malloc(strlen(opt_vardir) + strlen("/log/master.log") + 1);
+  strcpy(master_log_filename, opt_vardir);
+  strcat(master_log_filename, "/log/master.log");
+  log_file= fopen(master_log_filename, "r");
+  free(master_log_filename);
+
   if (log_file != NULL) {
 
     for (statement_cursor= statements; statement_cursor->buffer != NULL;
@@ -14936,7 +14944,7 @@ static void test_bug17667()
   }
   else
   {
-    fprintf(stderr, "Could not find the log file, var/log/master.log, so "
+    fprintf(stderr, "Could not find the log file, VARDIR/log/master.log, so "
             "test_bug17667 is \ninconclusive.  Run test from the "
             "mysql-test/mysql-test-run* program \nto set up the correct "
             "environment for this test.\n\n");
@@ -15261,6 +15269,8 @@ static struct my_option client_test_long
   {"user", 'u', "User for login if not current user", (char **) &opt_user,
    (char **) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 #endif
+  {"vardir", 'v', "Data dir for tests.", (gptr*) &opt_vardir,
+   (gptr*) &opt_vardir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"getopt-ll-test", 'g', "Option for testing bug in getopt library",
    (char **) &opt_getopt_ll_test, (char **) &opt_getopt_ll_test, 0,
    GET_LL, REQUIRED_ARG, 0, 0, LONGLONG_MAX, 0, 0, 0},
Thread
bk commit into 5.1 tree (jimw:1.2244)Jim Winstead29 Jul