Commit 0a22d0c0 authored by tulin@dl145c.mysql.com's avatar tulin@dl145c.mysql.com

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.1

into dl145c.mysql.com:/home/ndbdev/tomas/mysql-5.1
parents 734895c7 b1271392
...@@ -2059,7 +2059,8 @@ static void dump_table(uint numFields, char *table) ...@@ -2059,7 +2059,8 @@ static void dump_table(uint numFields, char *table)
we'll dump in hex only BLOB columns. we'll dump in hex only BLOB columns.
*/ */
is_blob= (opt_hex_blob && field->charsetnr == 63 && is_blob= (opt_hex_blob && field->charsetnr == 63 &&
(field->type == MYSQL_TYPE_STRING || (field->type == MYSQL_TYPE_BIT ||
field->type == MYSQL_TYPE_STRING ||
field->type == MYSQL_TYPE_VAR_STRING || field->type == MYSQL_TYPE_VAR_STRING ||
field->type == MYSQL_TYPE_VARCHAR || field->type == MYSQL_TYPE_VARCHAR ||
field->type == MYSQL_TYPE_BLOB || field->type == MYSQL_TYPE_BLOB ||
......
...@@ -188,14 +188,14 @@ INSERT INTO `t1` VALUES ...@@ -188,14 +188,14 @@ INSERT INTO `t1` VALUES
(6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'100000',b'010010',b'011111',4,5,5,5,5,5,5,5,5,5,3,2,1), (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'100000',b'010010',b'011111',4,5,5,5,5,5,5,5,5,5,3,2,1),
(7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'001100',b'111111',4,5,5,5,5,5,5,5,5,5,3,2,1), (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'001100',b'111111',4,5,5,5,5,5,5,5,5,5,3,2,1),
(8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1); (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
INSERT INTO `t1` VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'','?','>',4,5,5,5,5,5,5,5,5,5,3,2,1); INSERT INTO `t1` VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x01,0x3F,0x3E,4,5,5,5,5,5,5,5,5,5,3,2,1);
INSERT INTO `t1` VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'','\0','=',4,5,5,5,5,5,5,5,5,5,3,2,1); INSERT INTO `t1` VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x02,0x00,0x3D,4,5,5,5,5,5,5,5,5,5,3,2,1);
INSERT INTO `t1` VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'','',';',4,5,5,5,5,5,5,5,5,5,3,2,1); INSERT INTO `t1` VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x04,0x0F,0x3B,4,5,5,5,5,5,5,5,5,5,3,2,1);
INSERT INTO `t1` VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'','0','7',4,5,5,5,5,5,5,5,5,5,3,2,1); INSERT INTO `t1` VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x08,0x30,0x37,4,5,5,5,5,5,5,5,5,5,3,2,1);
INSERT INTO `t1` VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'','!','/',4,5,5,5,5,5,5,5,5,5,3,2,1); INSERT INTO `t1` VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x10,0x21,0x2F,4,5,5,5,5,5,5,5,5,5,3,2,1);
INSERT INTO `t1` VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,' ','','',4,5,5,5,5,5,5,5,5,5,3,2,1); INSERT INTO `t1` VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x20,0x12,0x1F,4,5,5,5,5,5,5,5,5,5,3,2,1);
INSERT INTO `t1` VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'\0',' ','?',4,5,5,5,5,5,5,5,5,5,3,2,1); INSERT INTO `t1` VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x00,0x0C,0x3F,4,5,5,5,5,5,5,5,5,5,3,2,1);
INSERT INTO `t1` VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'?','\0','\0',4,5,5,5,5,5,5,5,5,5,3,2,1); INSERT INTO `t1` VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x3F,0x00,0x00,4,5,5,5,5,5,5,5,5,5,3,2,1);
drop table t1; drop table t1;
create table t1 ( create table t1 (
pk1 bit(9) not null primary key, pk1 bit(9) not null primary key,
......
...@@ -68,4 +68,13 @@ PRIMARY KEY(a, b, c) - UniqueHashIndex ...@@ -68,4 +68,13 @@ PRIMARY KEY(a, b, c) - UniqueHashIndex
NDBT_ProgramExit: 0 - OK NDBT_ProgramExit: 0 - OK
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`b` char(10) character set latin1 collate latin1_bin NOT NULL default '',
`c` int(11) NOT NULL default '0',
`d` int(11) default NULL,
PRIMARY KEY USING HASH (`a`,`b`,`c`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (b)
DROP TABLE t1; DROP TABLE t1;
...@@ -102,4 +102,13 @@ a b c ...@@ -102,4 +102,13 @@ a b c
1 1 1 1 1 1
DELETE from t1 WHERE b = 6; DELETE from t1 WHERE b = 6;
DELETE from t1 WHERE a = 6; DELETE from t1 WHERE a = 6;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` int(11) NOT NULL,
`c` int(11) NOT NULL,
PRIMARY KEY (`b`),
UNIQUE KEY `a` (`a`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (b) (PARTITION x1 VALUES LESS THAN (5) ENGINE = NDBCLUSTER, PARTITION x2 VALUES LESS THAN (10) ENGINE = NDBCLUSTER, PARTITION x3 VALUES LESS THAN (20) ENGINE = NDBCLUSTER)
drop table t1; drop table t1;
...@@ -96,7 +96,7 @@ INSERT INTO `t1` VALUES ...@@ -96,7 +96,7 @@ INSERT INTO `t1` VALUES
(6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'100000',b'010010',b'011111',4,5,5,5,5,5,5,5,5,5,3,2,1), (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'100000',b'010010',b'011111',4,5,5,5,5,5,5,5,5,5,3,2,1),
(7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'001100',b'111111',4,5,5,5,5,5,5,5,5,5,3,2,1), (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'001100',b'111111',4,5,5,5,5,5,5,5,5,5,3,2,1),
(8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1); (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test t1 --exec $MYSQL_DUMP --hex-blob --compact --order-by-primary --skip-extended-insert --no-create-info test t1
drop table t1; drop table t1;
--error 1005 --error 1005
......
...@@ -55,4 +55,11 @@ insert into t1 values (1,"a",1,1),(2,"a",1,1),(3,"a",1,1); ...@@ -55,4 +55,11 @@ insert into t1 values (1,"a",1,1),(2,"a",1,1),(3,"a",1,1);
# should show only one attribute with DISTRIBUTION KEY # should show only one attribute with DISTRIBUTION KEY
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | sed 's/Version: [0-9]*//' | sed 's/\(Length of frm data: \)[0-9]*/\1#/' --exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | sed 's/Version: [0-9]*//' | sed 's/\(Length of frm data: \)[0-9]*/\1#/'
#
# Test that explicit partition info is not shown in show create table
# result should not contain (PARTITION P0 ... etc) since this is what shows up in
# mysqldump, and we don't want that info there
#
show create table t1;
DROP TABLE t1; DROP TABLE t1;
...@@ -82,5 +82,11 @@ select * from t1 where a=1 and b in (1,6,10,21) order by b; ...@@ -82,5 +82,11 @@ select * from t1 where a=1 and b in (1,6,10,21) order by b;
DELETE from t1 WHERE b = 6; DELETE from t1 WHERE b = 6;
DELETE from t1 WHERE a = 6; DELETE from t1 WHERE a = 6;
#
# Test that explicit partition info _is_ shown in show create table
# result _should_ contain (PARTITION x1 ... etc)
#
show create table t1;
drop table t1; drop table t1;
...@@ -675,7 +675,8 @@ bool check_partition_info(partition_info *part_info,enum db_type eng_type, ...@@ -675,7 +675,8 @@ bool check_partition_info(partition_info *part_info,enum db_type eng_type,
handler *file, ulonglong max_rows); handler *file, ulonglong max_rows);
bool fix_partition_func(THD *thd, const char *name, TABLE *table); bool fix_partition_func(THD *thd, const char *name, TABLE *table);
char *generate_partition_syntax(partition_info *part_info, char *generate_partition_syntax(partition_info *part_info,
uint *buf_length, bool use_sql_alloc); uint *buf_length, bool use_sql_alloc,
bool add_default_info);
bool partition_key_modified(TABLE *table, List<Item> &fields); bool partition_key_modified(TABLE *table, List<Item> &fields);
void get_partition_set(const TABLE *table, byte *buf, const uint index, void get_partition_set(const TABLE *table, byte *buf, const uint index,
const key_range *key_spec, const key_range *key_spec,
......
...@@ -1961,6 +1961,7 @@ static int add_partition_values(File fptr, partition_info *part_info, ...@@ -1961,6 +1961,7 @@ static int add_partition_values(File fptr, partition_info *part_info,
buf_length A pointer to the returned buffer length buf_length A pointer to the returned buffer length
use_sql_alloc Allocate buffer from sql_alloc if true use_sql_alloc Allocate buffer from sql_alloc if true
otherwise use my_malloc otherwise use my_malloc
add_default_info Add info generated by default
RETURN VALUES RETURN VALUES
NULL error NULL error
buf, buf_length Buffer and its length buf, buf_length Buffer and its length
...@@ -1986,7 +1987,8 @@ static int add_partition_values(File fptr, partition_info *part_info, ...@@ -1986,7 +1987,8 @@ static int add_partition_values(File fptr, partition_info *part_info,
char *generate_partition_syntax(partition_info *part_info, char *generate_partition_syntax(partition_info *part_info,
uint *buf_length, uint *buf_length,
bool use_sql_alloc) bool use_sql_alloc,
bool add_default_info)
{ {
uint i,j, no_parts, no_subparts; uint i,j, no_parts, no_subparts;
partition_element *part_elem; partition_element *part_elem;
...@@ -2013,9 +2015,11 @@ char *generate_partition_syntax(partition_info *part_info, ...@@ -2013,9 +2015,11 @@ char *generate_partition_syntax(partition_info *part_info,
switch (part_info->part_type) switch (part_info->part_type)
{ {
case RANGE_PARTITION: case RANGE_PARTITION:
add_default_info= TRUE;
err+= add_part_key_word(fptr, range_str); err+= add_part_key_word(fptr, range_str);
break; break;
case LIST_PARTITION: case LIST_PARTITION:
add_default_info= TRUE;
err+= add_part_key_word(fptr, list_str); err+= add_part_key_word(fptr, list_str);
break; break;
case HASH_PARTITION: case HASH_PARTITION:
...@@ -2051,6 +2055,8 @@ char *generate_partition_syntax(partition_info *part_info, ...@@ -2051,6 +2055,8 @@ char *generate_partition_syntax(partition_info *part_info,
err+= add_end_parenthesis(fptr); err+= add_end_parenthesis(fptr);
err+= add_space(fptr); err+= add_space(fptr);
} }
if (add_default_info)
{
err+= add_begin_parenthesis(fptr); err+= add_begin_parenthesis(fptr);
List_iterator<partition_element> part_it(part_info->partitions); List_iterator<partition_element> part_it(part_info->partitions);
no_parts= part_info->no_parts; no_parts= part_info->no_parts;
...@@ -2095,6 +2101,7 @@ char *generate_partition_syntax(partition_info *part_info, ...@@ -2095,6 +2101,7 @@ char *generate_partition_syntax(partition_info *part_info,
else else
err+= add_end_parenthesis(fptr); err+= add_end_parenthesis(fptr);
} while (++i < no_parts); } while (++i < no_parts);
}
if (err) if (err)
goto close_file; goto close_file;
buffer_length= my_seek(fptr, 0L,MY_SEEK_END,MYF(0)); buffer_length= my_seek(fptr, 0L,MY_SEEK_END,MYF(0));
......
...@@ -961,7 +961,7 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet) ...@@ -961,7 +961,7 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet)
packet->append("\n)", 2); packet->append("\n)", 2);
if (!(thd->variables.sql_mode & MODE_NO_TABLE_OPTIONS) && !foreign_db_mode) if (!(thd->variables.sql_mode & MODE_NO_TABLE_OPTIONS) && !foreign_db_mode)
{ {
#ifdef HAVE_PARTITION_DB #if 0 //def HAVE_PARTITION_DB
if (!table->s->part_info) if (!table->s->part_info)
#endif #endif
{ {
...@@ -1047,7 +1047,7 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet) ...@@ -1047,7 +1047,7 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet)
if (table->s->part_info && if (table->s->part_info &&
((part_syntax= generate_partition_syntax(table->s->part_info, ((part_syntax= generate_partition_syntax(table->s->part_info,
&part_syntax_len, &part_syntax_len,
FALSE)))) FALSE,FALSE))))
{ {
packet->append(part_syntax, part_syntax_len); packet->append(part_syntax, part_syntax_len);
my_free(part_syntax, MYF(0)); my_free(part_syntax, MYF(0));
......
...@@ -1629,7 +1629,7 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name, ...@@ -1629,7 +1629,7 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name,
*/ */
if (!(part_syntax_buf= generate_partition_syntax(part_info, if (!(part_syntax_buf= generate_partition_syntax(part_info,
&syntax_len, &syntax_len,
TRUE))) TRUE,TRUE)))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
part_info->part_info_string= part_syntax_buf; part_info->part_info_string= part_syntax_buf;
part_info->part_info_len= syntax_len; part_info->part_info_len= syntax_len;
...@@ -4274,7 +4274,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -4274,7 +4274,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
/*select_field_count*/ 0); /*select_field_count*/ 0);
if (!(part_syntax_buf= generate_partition_syntax(part_info, if (!(part_syntax_buf= generate_partition_syntax(part_info,
&syntax_len, &syntax_len,
TRUE))) TRUE,TRUE)))
{ {
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
...@@ -4310,7 +4310,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -4310,7 +4310,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
} }
if (!(part_syntax_buf= generate_partition_syntax(part_info, if (!(part_syntax_buf= generate_partition_syntax(part_info,
&syntax_len, &syntax_len,
TRUE))) TRUE,TRUE)))
{ {
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
......
...@@ -19,7 +19,13 @@ ...@@ -19,7 +19,13 @@
#include <m_string.h> #include <m_string.h>
#undef ULONGLONG_MAX #undef ULONGLONG_MAX
/* Needed under MetroWerks Compiler, since MetroWerks compiler does not properly handle a constant expression containing a mod operator */
#if defined(__NETWARE__) && defined(__MWERKS__)
ulonglong tmp;
#define ULONGLONG_MAX (tmp =(~(ulonglong) 0))
#else
#define ULONGLONG_MAX (~(ulonglong) 0) #define ULONGLONG_MAX (~(ulonglong) 0)
#endif /* __NETWARE__ && __MWERKS__ */
#define MAX_NEGATIVE_NUMBER ((ulonglong) LL(0x8000000000000000)) #define MAX_NEGATIVE_NUMBER ((ulonglong) LL(0x8000000000000000))
#define INIT_CNT 9 #define INIT_CNT 9
#define LFACTOR ULL(1000000000) #define LFACTOR ULL(1000000000)
......
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