=== modified file 'drizzled/handler_structs.h'
--- drizzled/handler_structs.h  2009-10-16 02:33:06 +0000
+++ drizzled/handler_structs.h  2009-10-27 02:01:17 +0000
@@ -90,7 +90,6 @@
   uint64_t auto_increment_value;
   uint32_t table_options;
   uint32_t used_fields;
-  uint32_t key_block_size;
   enum row_type row_type;
   drizzled::plugin::StorageEngine *db_type;
   uint32_t options;                         /* OR of HA_CREATE_ options */

=== modified file 'drizzled/show.cc'
--- drizzled/show.cc    2009-10-16 00:38:56 +0000
+++ drizzled/show.cc    2009-10-27 02:01:17 +0000
@@ -649,10 +649,10 @@
       packet->append(STRING_WITH_LEN(" ROW_FORMAT="));
       packet->append(ha_row_type[(uint32_t) create_info.row_type]);
     }
-    if (table->s->key_block_size)
+    if (table->s->hasKeyBlockSize())
     {
       packet->append(STRING_WITH_LEN(" KEY_BLOCK_SIZE="));
-      buff= to_string(table->s->key_block_size);
+      buff= to_string(table->s->getKeyBlockSize());
       packet->append(buff.c_str(), buff.length());
     }
     if (share->block_size)
@@ -684,7 +684,7 @@
     packet->append(STRING_WITH_LEN(" USING HASH"));
 
   if ((key_info->flags & HA_USES_BLOCK_SIZE) &&
-      table->s->key_block_size != key_info->block_size)
+      table->s->getKeyBlockSize() != key_info->block_size)
   {
     packet->append(STRING_WITH_LEN(" KEY_BLOCK_SIZE="));
     end= int64_t10_to_str(key_info->block_size, buff, 10);

=== modified file 'drizzled/sql_table.cc'
--- drizzled/sql_table.cc       2009-10-16 10:27:33 +0000
+++ drizzled/sql_table.cc       2009-10-27 02:01:17 +0000
@@ -828,6 +828,7 @@
 
 int mysql_prepare_create_table(Session *session,
                                HA_CREATE_INFO *create_info,
+                               message::Table *create_proto,
                                AlterInfo *alter_info,
                                bool tmp_table,
                                uint32_t *db_options,
@@ -1245,7 +1246,7 @@
     */
     key_info->block_size= (key->key_create_info.block_size ?
                            key->key_create_info.block_size :
-                           create_info->key_block_size);
+                           create_proto->options().key_block_size());
 
     if (key_info->block_size)
       key_info->flags|= HA_USES_BLOCK_SIZE;
@@ -1620,7 +1621,7 @@
 
   set_table_default_charset(create_info, (char*) db);
 
-  if (mysql_prepare_create_table(session, create_info, alter_info,
+  if (mysql_prepare_create_table(session, create_info, table_proto, alter_info,
                                  internal_tmp_table,
                                  &db_options, file,
                                  &key_info_buffer, &key_count,

=== modified file 'drizzled/sql_table.h'
--- drizzled/sql_table.h        2009-10-16 10:27:33 +0000
+++ drizzled/sql_table.h        2009-10-27 02:01:17 +0000
@@ -87,6 +87,7 @@
 */
 int mysql_prepare_create_table(Session *session,
                                HA_CREATE_INFO *create_info,
+                               drizzled::message::Table *create_proto,
                                AlterInfo *alter_info,
                                bool tmp_table,
                                uint32_t *db_options,

=== modified file 'drizzled/sql_yacc.yy'
--- drizzled/sql_yacc.yy        2009-10-12 23:23:18 +0000
+++ drizzled/sql_yacc.yy        2009-10-27 02:01:17 +0000
@@ -1391,7 +1391,10 @@
             statement::CreateTable *statement= (statement::CreateTable 
*)Lex->statement;
 
             statement->create_info.used_fields|= HA_CREATE_USED_KEY_BLOCK_SIZE;
-            statement->create_info.key_block_size= $3;
+
+            message::Table::TableOptions *tableopts;
+            tableopts= ((statement::CreateTable 
*)Lex->statement)->create_table_proto.mutable_options();
+            tableopts->set_key_block_size($3);
           }
         ;
 

=== modified file 'drizzled/statement/alter_table.cc'
--- drizzled/statement/alter_table.cc   2009-10-12 23:23:18 +0000
+++ drizzled/statement/alter_table.cc   2009-10-27 02:01:17 +0000
@@ -188,8 +188,13 @@
     table->file->info(HA_STATUS_AUTO);
     create_info->auto_increment_value= table->file->stats.auto_increment_value;
   }
-  if (! (used_fields & HA_CREATE_USED_KEY_BLOCK_SIZE))
-    create_info->key_block_size= table->s->key_block_size;
+  if (! (used_fields & HA_CREATE_USED_KEY_BLOCK_SIZE)
+      && table->s->hasKeyBlockSize())
+    table_options->set_key_block_size(table->s->getKeyBlockSize());
+
+  if ((used_fields & HA_CREATE_USED_KEY_BLOCK_SIZE)
+      && table_options->key_block_size() == 0)
+    table_options->clear_key_block_size();
 
   table->restoreRecordAsDefault(); /* Empty record for DEFAULT */
   CreateField *def;
@@ -1506,7 +1511,8 @@
   table_options= table_proto->mutable_options();
   table_options->clear_max_rows();
 
-  if (mysql_prepare_create_table(session, &local_create_info, &alter_info,
+  if (mysql_prepare_create_table(session, &local_create_info, table_proto,
+                                 &alter_info,
                                  tmp_table, &db_options,
                                  schema_table->table->file,
                                  &schema_table->table->s->key_info, &keys, 0))

=== modified file 'drizzled/table.cc'
--- drizzled/table.cc   2009-10-16 10:27:33 +0000
+++ drizzled/table.cc   2009-10-27 02:01:17 +0000
@@ -493,9 +493,6 @@
   share->keys_for_keyread.reset();
   set_prefix(share->keys_in_use, share->keys);
 
-  share->key_block_size= table_options.has_key_block_size() ?
-    table_options.key_block_size() : 0;
-
   share->fields= table.field_size();
 
   share->field= (Field**) alloc_root(&share->mem_root,

=== modified file 'drizzled/table_proto_write.cc'
--- drizzled/table_proto_write.cc       2009-10-12 23:23:18 +0000
+++ drizzled/table_proto_write.cc       2009-10-27 02:01:17 +0000
@@ -360,9 +360,6 @@
   if (create_info->auto_increment_value)
     table_options->set_auto_increment_value(create_info->auto_increment_value);
 
-  if (create_info->key_block_size)
-    table_options->set_key_block_size(create_info->key_block_size);
-
   for (unsigned int i= 0; i < keys; i++)
   {
     message::Table::Index *idx;

=== modified file 'drizzled/table_share.h'
--- drizzled/table_share.h      2009-10-06 19:14:39 +0000
+++ drizzled/table_share.h      2009-10-27 02:01:17 +0000
@@ -123,6 +123,16 @@
     return (table_proto) ? table_proto->options().comment().length() : 0; 
   }
 
+  inline bool hasKeyBlockSize()
+  {
+    return (table_proto) ? table_proto->options().has_key_block_size() : false;
+  }
+
+  inline uint32_t getKeyBlockSize()
+  {
+    return (table_proto) ? table_proto->options().key_block_size() : 0;
+  }
+
   inline uint64_t getMaxRows()
   {
     return max_rows;
@@ -141,7 +151,6 @@
   enum tmp_table_type tmp_table;
 
   uint32_t ref_count;       /* How many Table objects uses this */
-  uint32_t key_block_size;                     /* create key_block_size, if 
used */
   uint32_t null_bytes;
   uint32_t last_null_bit_pos;
   uint32_t fields;                             /* Number of fields */

=== modified file 'plugin/innobase/handler/ha_innodb.cc'
--- plugin/innobase/handler/ha_innodb.cc        2009-10-16 10:27:33 +0000
+++ plugin/innobase/handler/ha_innodb.cc        2009-10-27 02:01:17 +0000
@@ -5366,7 +5366,8 @@
        Session*        session,        /*!< in: connection thread. */
        Table*          form,           /*!< in: information on table
                                        columns and indexes */
-       HA_CREATE_INFO* create_info)    /*!< in: create info. */
+       HA_CREATE_INFO* create_info,
+        drizzled::message::Table *create_proto)
 {
        ibool   kbs_specified   = FALSE;
        ibool   ret             = TRUE;
@@ -5383,11 +5384,9 @@
        ut_ad(create_info != NULL);
 
        /* First check if KEY_BLOCK_SIZE was specified. */
-       if (create_info->key_block_size
-           || (create_info->used_fields & HA_CREATE_USED_KEY_BLOCK_SIZE)) {
-
+       if (create_proto->options().has_key_block_size()) {
                kbs_specified = TRUE;
-               switch (create_info->key_block_size) {
+               switch (create_proto->options().key_block_size()) {
                case 1:
                case 2:
                case 4:
@@ -5402,7 +5401,7 @@
                                            " KEY_BLOCK_SIZE = %lu."
                                            " Valid values are"
                                            " [1, 2, 4, 8, 16]",
-                                           create_info->key_block_size);
+                                           
create_proto->options().key_block_size());
                        ret = FALSE;
                }
        }
@@ -5532,7 +5531,7 @@
        HA_CREATE_INFO* create_info,    /*!< in: more information of the
                                        created table, contains also the
                                        create statement string */
-        drizzled::message::Table*)
+        drizzled::message::Table* create_proto)
 {
        int             error;
        dict_table_t*   innobase_table;
@@ -5608,18 +5607,17 @@
        iflags = 0;
 
        /* Validate create options if innodb_strict_mode is set. */
-       if (!create_options_are_valid(session, form, create_info)) {
+       if (!create_options_are_valid(session, form, create_info, 
create_proto)) {
                error = ER_ILLEGAL_HA_CREATE_OPTION;
                goto cleanup;
        }
 
-       if (create_info->key_block_size
-           || (create_info->used_fields & HA_CREATE_USED_KEY_BLOCK_SIZE)) {
+       if (create_proto->options().has_key_block_size()) {
                /* Determine the page_zip.ssize corresponding to the
                requested page size (key_block_size) in kilobytes. */
 
                ulint   ssize, ksize;
-               ulint   key_block_size = create_info->key_block_size;
+               ulint   key_block_size = 
create_proto->options().key_block_size();
 
                for (ssize = ksize = 1; ssize <= DICT_TF_ZSSIZE_MAX;
                     ssize++, ksize <<= 1) {
@@ -5654,7 +5652,7 @@
                                            ER_ILLEGAL_HA_CREATE_OPTION,
                                            "InnoDB: ignoring"
                                            " KEY_BLOCK_SIZE=%lu.",
-                                           create_info->key_block_size);
+                                           
create_proto->options().key_block_size());
                }
        }
 
@@ -5674,7 +5672,7 @@
                                        ER_ILLEGAL_HA_CREATE_OPTION,
                                        "InnoDB: ignoring KEY_BLOCK_SIZE=%lu"
                                        " unless ROW_FORMAT=COMPRESSED.",
-                                       create_info->key_block_size);
+                                       
create_proto->options().key_block_size());
                                iflags = 0;
                        }
                } else {

-- 
Stewart Smith

_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to