Commit c7e72e8d authored by unknown's avatar unknown

Fix to use Monty's changes in frm format

Enable latin1 by default


configure.in:
  Always compile latin1
sql/ha_myisam.cc:
  Fix for "SHOW KEYS FROM table" and various key types
sql/sql_show.cc:
  Fix to use Monty's changes in frm format
sql/sql_table.cc:
  Fix to use Monty's changes in frm format
sql/structs.h:
  Fix to use Monty's changes in frm format
sql/table.cc:
  Fix to use Monty's changes in frm format
parent e8b6c964
...@@ -2086,6 +2086,9 @@ do ...@@ -2086,6 +2086,9 @@ do
esac esac
done done
dnl Always compile latin1
AC_DEFINE(HAVE_CHARSET_latin1)
if test "$use_mb" = "yes" if test "$use_mb" = "yes"
then then
AC_DEFINE(USE_MB) AC_DEFINE(USE_MB)
......
...@@ -126,6 +126,10 @@ const char *ha_myisam::index_type(uint key_number) ...@@ -126,6 +126,10 @@ const char *ha_myisam::index_type(uint key_number)
{ {
return ((table->key_info[key_number].flags & HA_FULLTEXT) ? return ((table->key_info[key_number].flags & HA_FULLTEXT) ?
"FULLTEXT" : "FULLTEXT" :
(table->key_info[key_number].flags & HA_SPATIAL) ?
"SPATIAL" :
(table->key_info[key_number].algorithm == HA_KEY_ALG_RTREE) ?
"RTREE" :
"BTREE"); "BTREE");
} }
...@@ -1006,7 +1010,7 @@ int ha_myisam::create(const char *name, register TABLE *table, ...@@ -1006,7 +1010,7 @@ int ha_myisam::create(const char *name, register TABLE *table,
for (i=0; i < table->keys ; i++, pos++) for (i=0; i < table->keys ; i++, pos++)
{ {
keydef[i].flag= (pos->flags & (HA_NOSAME | HA_FULLTEXT | HA_SPATIAL)); keydef[i].flag= (pos->flags & (HA_NOSAME | HA_FULLTEXT | HA_SPATIAL));
keydef[i].key_alg=pos->key_alg; // +BAR keydef[i].key_alg=pos->algorithm;
keydef[i].seg=keyseg; keydef[i].seg=keyseg;
keydef[i].keysegs=pos->key_parts; keydef[i].keysegs=pos->key_parts;
for (j=0 ; j < pos->key_parts ; j++) for (j=0 ; j < pos->key_parts ; j++)
......
...@@ -890,7 +890,7 @@ store_create_info(THD *thd, TABLE *table, String *packet) ...@@ -890,7 +890,7 @@ store_create_info(THD *thd, TABLE *table, String *packet)
append_identifier(thd,packet,key_info->name); append_identifier(thd,packet,key_info->name);
// +BAR: send USING only in non-default case: non-spatial rtree // +BAR: send USING only in non-default case: non-spatial rtree
if((key_info->key_alg == HA_KEY_ALG_RTREE) && !(key_info->flags & HA_SPATIAL)) if((key_info->algorithm == HA_KEY_ALG_RTREE) && !(key_info->flags & HA_SPATIAL))
packet->append(" USING RTREE",12); packet->append(" USING RTREE",12);
packet->append(" (", 2); packet->append(" (", 2);
......
...@@ -454,7 +454,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, ...@@ -454,7 +454,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
key_info->flags = HA_NOSAME; key_info->flags = HA_NOSAME;
} }
key_info->key_alg = key->algorithm; key_info->algorithm = key->algorithm;
key_info->key_parts=(uint8) key->columns.elements; key_info->key_parts=(uint8) key->columns.elements;
key_info->key_part=key_part_info; key_info->key_part=key_part_info;
key_info->usable_key_parts= key_number; key_info->usable_key_parts= key_number;
...@@ -477,6 +477,9 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, ...@@ -477,6 +477,9 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
checking for proper key parts number: checking for proper key parts number:
*/ */
printf("key_info->flags=%d key_info->algorithm=%d\n",
key_info->flags,key_info->algorithm);
if(key_info->flags == HA_SPATIAL){ if(key_info->flags == HA_SPATIAL){
if(key_info->key_parts!=1){ if(key_info->key_parts!=1){
my_printf_error(ER_WRONG_ARGUMENTS, my_printf_error(ER_WRONG_ARGUMENTS,
...@@ -485,7 +488,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, ...@@ -485,7 +488,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
} }
}else }else
{ {
if(key_info->key_alg == HA_KEY_ALG_RTREE){ if(key_info->algorithm == HA_KEY_ALG_RTREE){
if((key_info->key_parts&1)==1){ if((key_info->key_parts&1)==1){
my_printf_error(ER_WRONG_ARGUMENTS, my_printf_error(ER_WRONG_ARGUMENTS,
ER(ER_WRONG_ARGUMENTS),MYF(0),"RTREE INDEX"); ER(ER_WRONG_ARGUMENTS),MYF(0),"RTREE INDEX");
...@@ -1584,7 +1587,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -1584,7 +1587,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
Key::PRIMARY : Key::UNIQUE) : Key::PRIMARY : Key::UNIQUE) :
(key_info->flags & HA_FULLTEXT ? (key_info->flags & HA_FULLTEXT ?
Key::FULLTEXT : Key::MULTIPLE)), Key::FULLTEXT : Key::MULTIPLE)),
key_info->key_alg, key_info->algorithm,
key_name,key_parts)); key_name,key_parts));
} }
key_it.rewind(); key_it.rewind();
......
...@@ -64,7 +64,6 @@ typedef struct st_key_part_info { /* Info about a key part */ ...@@ -64,7 +64,6 @@ typedef struct st_key_part_info { /* Info about a key part */
typedef struct st_key { typedef struct st_key {
uint key_length; /* Tot length of key */ uint key_length; /* Tot length of key */
uint flags; /* dupp key and pack flags */ uint flags; /* dupp key and pack flags */
enum ha_key_alg key_alg; /* +BAR Algorithm BTREE or RTREE */
uint key_parts; /* How many key_parts */ uint key_parts; /* How many key_parts */
uint extra_length; uint extra_length;
uint usable_key_parts; /* Should normally be = key_parts */ uint usable_key_parts; /* Should normally be = key_parts */
......
...@@ -201,6 +201,13 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, ...@@ -201,6 +201,13 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
for (i=0 ; i < keys ; i++, keyinfo++) for (i=0 ; i < keys ; i++, keyinfo++)
keyinfo->algorithm= (enum ha_key_alg) *(strpos++); keyinfo->algorithm= (enum ha_key_alg) *(strpos++);
} }
else
{
/* Set key types to BTREE, BAR TODO: how to be with HASH/RBTREE? */
keyinfo=outparam->key_info;
for (i=0 ; i < keys ; i++, keyinfo++)
keyinfo->algorithm= HA_KEY_ALG_BTREE;
}
outparam->reclength = uint2korr((head+16)); outparam->reclength = uint2korr((head+16));
if (*(head+26) == 1) if (*(head+26) == 1)
outparam->system=1; /* one-record-database */ outparam->system=1; /* one-record-database */
...@@ -408,10 +415,12 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, ...@@ -408,10 +415,12 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
} }
} }
keyinfo->key_alg=HA_KEY_ALG_BTREE; // BAR : btree by default if (keyinfo->name[0]=='S')
keyinfo->flags |= HA_SPATIAL;
#define BAR_DIRTY_HACK
#ifdef BAR_DIRTY_HACK #ifdef BAR_DIRTY_HACK
keyinfo->key_alg=HA_KEY_ALG_BTREE; // BAR : btree by default
// BAR FIXME: Dirty hack while waiting for new .frm format // BAR FIXME: Dirty hack while waiting for new .frm format
switch(keyinfo->name[0]){ switch(keyinfo->name[0]){
case 'R': case 'R':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment