Commit 0022bb67 authored by serg@serg.mylan's avatar serg@serg.mylan

Merge bk-internal.mysql.com:/home/bk/mysql-5.1-new

into serg.mylan:/usr/home/serg/Abk/mysql-5.1
parents c7513d18 3072df16
......@@ -332,3 +332,12 @@ SELECT * FROM t1;
col1 col2 col3 col4 col5 col6 col7 col8 col9 col10 col11 col12 col13 col14 col15 col16 col17 col18 col19 col20 col21 col22 col23 col24 col25 col26 col27 col28 col29 col30 col31 col32 col33 col34 col35 col36 col37 col38 fix1 fix2 fix3 fix4 fix5 fix6 fix7 fix8 fix9 fix10 fix11 fix12 fix13 fix14 fix15 fix16 fix17 fix18 fix19 fix20 fix21 fix22 fix23 fix24 fix25 fix26 fix27 fix28 fix29 fix30
9 99 999 9999 99999 999999 9999999 99999999 999999999 9999999999 99999999999 999999999999 9999999999999 99999999999999 999999999999999 9999999999999999 99999999999999999 999999999999999999 9999999999999999999 99999999999999999999 999999999999999999999 9999999999999999999999 99999999999999999999999 999999999999999999999999 9999999999999999999999999 99999999999999999999999999 999999999999999999999999999 9999999999999999999999999999 99999999999999999999999999999 999999999999999999999999999999 9999999999999999999999999999999 99999999999999999999999999999999 999999999999999999999999999999999 9999999999999999999999999999999999 99999999999999999999999999999999999 999999999999999999999999999999999999 9999999999999999999999999999999999999 99999999999999999999999999999999999999 9999999999999999999999999999999999999.9 999999999999999999999999999999999999.99 99999999999999999999999999999999999.999 9999999999999999999999999999999999.9999 999999999999999999999999999999999.99999 99999999999999999999999999999999.999999 9999999999999999999999999999999.9999999 999999999999999999999999999999.99999999 99999999999999999999999999999.999999999 9999999999999999999999999999.9999999999 999999999999999999999999999.99999999999 99999999999999999999999999.999999999999 9999999999999999999999999.9999999999999 999999999999999999999999.99999999999999 99999999999999999999999.999999999999999 9999999999999999999999.9999999999999999 999999999999999999999.99999999999999999 99999999999999999999.999999999999999999 9999999999999999999.9999999999999999999 999999999999999999.99999999999999999999 99999999999999999.999999999999999999999 9999999999999999.9999999999999999999999 999999999999999.99999999999999999999999 99999999999999.999999999999999999999999 9999999999999.9999999999999999999999999 999999999999.99999999999999999999999999 99999999999.999999999999999999999999999 9999999999.9999999999999999999999999999 999999999.99999999999999999999999999999 99999999.999999999999999999999999999999
DROP TABLE t1;
create table t1 (bigint_col bigint unsigned);
insert into t1 values (17666000000000000000);
select * from t1 where bigint_col=17666000000000000000;
bigint_col
17666000000000000000
select * from t1 where bigint_col='17666000000000000000';
bigint_col
17666000000000000000
drop table t1;
......@@ -246,17 +246,17 @@ PARTITION BY RANGE(f1)
PARTITION part2 VALUES LESS THAN (1000));
INSERT INTO t1 VALUES(1, '---1---');
INSERT INTO t1 VALUES(2, '---2---');
select * from t1;
select * from t1 order by f1;
f1 f2
1 ---1---
2 ---2---
UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 2;
select * from t1;
select * from t1 order by f1;
f1 f2
1 ---1---
6 ---2---
UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 1;
select * from t1;
select * from t1 order by f1;
f1 f2
5 ---1---
6 ---2---
......
drop table if exists t1;
set names utf8;
create table t1 (s1 int)
partition by list (s1)
(partition c values in (1),
partition Ç values in (3));
insert into t1 values (1),(3);
select * from t1;
s1
1
3
flush tables;
set names latin1;
select * from t1;
s1
1
3
drop table t1;
......@@ -65,6 +65,9 @@ c1
SELECT extractValue(@xml,'/a/child::*');
extractValue(@xml,'/a/child::*')
b1 b2
SELECT extractValue(@xml,'/a/self::*');
extractValue(@xml,'/a/self::*')
a1 a2
SELECT extractValue(@xml,'/a/descendant::*');
extractValue(@xml,'/a/descendant::*')
b1 c1 b2
......@@ -546,6 +549,15 @@ select extractvalue('<a>A</a>','/<a>');
ERROR HY000: XPATH syntax error: '>'
select extractvalue('<a><b>b</b><b!>b!</b!></a>','//b!');
ERROR HY000: XPATH syntax error: '!'
select extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant::*');
extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant::*')
B C
select extractvalue('<a>A<b>B<c>C</c></b></a>','/a/self::*');
extractvalue('<a>A<b>B<c>C</c></b></a>','/a/self::*')
A
select extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant-or-self::*');
extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant-or-self::*')
A B C
select extractvalue('<A_B>A</A_B>','/A_B');
extractvalue('<A_B>A</A_B>','/A_B')
A
......@@ -270,3 +270,12 @@ VALUES (9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 999999999,
SELECT * FROM t1;
DROP TABLE t1;
#bug #9088 BIGINT WHERE CLAUSE
create table t1 (bigint_col bigint unsigned);
insert into t1 values (17666000000000000000);
select * from t1 where bigint_col=17666000000000000000;
select * from t1 where bigint_col='17666000000000000000';
drop table t1;
......@@ -252,9 +252,9 @@ PARTITION BY RANGE(f1)
PARTITION part2 VALUES LESS THAN (1000));
INSERT INTO t1 VALUES(1, '---1---');
INSERT INTO t1 VALUES(2, '---2---');
select * from t1;
select * from t1 order by f1;
UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 2;
select * from t1;
select * from t1 order by f1;
UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 1;
select * from t1;
select * from t1 order by f1;
drop table t1;
#
# Test for character set related things in combination
# with the partition storage engine
#
-- source include/have_partition.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
set names utf8;
create table t1 (s1 int)
partition by list (s1)
(partition c values in (1),
partition Ç values in (3));
insert into t1 values (1),(3);
select * from t1;
flush tables;
set names latin1;
select * from t1;
drop table t1;
......@@ -23,6 +23,7 @@ SELECT extractValue(@xml,'/*/*');
SELECT extractValue(@xml,'/*/*/*');
SELECT extractValue(@xml,'/a/child::*');
SELECT extractValue(@xml,'/a/self::*');
SELECT extractValue(@xml,'/a/descendant::*');
SELECT extractValue(@xml,'/a/descendant-or-self::*');
SELECT extractValue(@xml,'/a/attribute::*');
......@@ -245,6 +246,11 @@ select extractvalue('<a>A</a>','/<a>');
select extractvalue('<a><b>b</b><b!>b!</b!></a>','//b!');
#
# Bug #16315 XML: extractvalue() handles self badly
#
select extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant::*');
select extractvalue('<a>A<b>B<c>C</c></b></a>','/a/self::*');
select extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant-or-self::*');
# Bug #16320 XML: extractvalue() won't accept names containing underscores
#
select extractvalue('<A_B>A</A_B>','/A_B');
......@@ -4728,13 +4728,14 @@ int ha_ndbcluster::final_drop_index(TABLE *table_arg)
int ha_ndbcluster::rename_table(const char *from, const char *to)
{
NDBDICT *dict;
char old_dbname[FN_HEADLEN];
char new_tabname[FN_HEADLEN];
const NDBTAB *orig_tab;
int result;
DBUG_ENTER("ha_ndbcluster::rename_table");
DBUG_PRINT("info", ("Renaming %s to %s", from, to));
set_dbname(from);
set_dbname(from, old_dbname);
set_tabname(from);
set_tabname(to, new_tabname);
......@@ -4742,6 +4743,7 @@ int ha_ndbcluster::rename_table(const char *from, const char *to)
DBUG_RETURN(my_errno= HA_ERR_NO_CONNECTION);
Ndb *ndb= get_ndb();
ndb->setDatabaseName(old_dbname);
dict= ndb->getDictionary();
if (!(orig_tab= dict->getTable(m_tabname)))
ERR_RETURN(dict->getNdbError());
......@@ -4833,7 +4835,8 @@ int ha_ndbcluster::rename_table(const char *from, const char *to)
current_thd->query, current_thd->query_length,
m_dbname, new_tabname,
0, 0,
SOT_RENAME_TABLE);
SOT_RENAME_TABLE,
old_dbname, m_tabname);
}
if (share)
free_share(&share);
......
......@@ -885,7 +885,8 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
const char *db, const char *table_name,
uint32 ndb_table_id,
uint32 ndb_table_version,
enum SCHEMA_OP_TYPE type)
enum SCHEMA_OP_TYPE type,
const char *old_db, const char *old_table_name)
{
DBUG_ENTER("ndbcluster_log_schema_op");
Thd_ndb *thd_ndb= get_thd_ndb(thd);
......@@ -919,10 +920,19 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
query= tmp_buf2;
query_length= (uint) (strxmov(tmp_buf2, "drop table `",
table_name, "`", NullS) - tmp_buf2);
// fall through
case SOT_CREATE_TABLE:
// fall through
if (!share)
get_a_share= 1;
break;
case SOT_RENAME_TABLE:
/* redo the rename table query as is may contain several tables */
query= tmp_buf2;
query_length= (uint) (strxmov(tmp_buf2, "rename table `",
old_db, ".", old_table_name, "` to `",
db, ".", table_name, "`", NullS) - tmp_buf2);
if (!share)
get_a_share= 1;
break;
case SOT_CREATE_TABLE:
// fall through
case SOT_ALTER_TABLE:
if (!share)
......@@ -983,8 +993,8 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
}
Ndb *ndb= thd_ndb->ndb;
char old_db[FN_REFLEN];
strcpy(old_db, ndb->getDatabaseName());
char save_db[FN_REFLEN];
strcpy(save_db, ndb->getDatabaseName());
char tmp_buf[SCHEMA_QUERY_SIZE];
NDBDICT *dict= ndb->getDictionary();
......@@ -1091,7 +1101,7 @@ end:
if (trans)
ndb->closeTransaction(trans);
ndb->setDatabaseName(old_db);
ndb->setDatabaseName(save_db);
/*
Wait for other mysqld's to acknowledge the table operation
......@@ -1169,8 +1179,8 @@ ndbcluster_update_slock(THD *thd,
const NdbError *ndb_error= 0;
uint32 node_id= g_ndb_cluster_connection->node_id();
Ndb *ndb= check_ndb_in_thd(thd);
char old_db[128];
strcpy(old_db, ndb->getDatabaseName());
char save_db[FN_HEADLEN];
strcpy(save_db, ndb->getDatabaseName());
char tmp_buf[SCHEMA_QUERY_SIZE];
NDBDICT *dict= ndb->getDictionary();
......@@ -1292,7 +1302,7 @@ end:
db, table_name);
if (trans)
ndb->closeTransaction(trans);
ndb->setDatabaseName(old_db);
ndb->setDatabaseName(save_db);
DBUG_RETURN(0);
}
......
......@@ -95,7 +95,9 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
const char *db, const char *table_name,
uint32 ndb_table_id,
uint32 ndb_table_version,
enum SCHEMA_OP_TYPE type);
enum SCHEMA_OP_TYPE type,
const char *old_db= 0,
const char *old_table_name= 0);
int ndbcluster_handle_drop_table(Ndb *ndb, const char *event_name,
NDB_SHARE *share);
void ndb_rep_event_name(String *event_name,
......
......@@ -1931,9 +1931,10 @@ class Item_int_with_ref :public Item_int
{
Item *ref;
public:
Item_int_with_ref(longlong i, Item *ref_arg) :Item_int(i), ref(ref_arg)
Item_int_with_ref(longlong i, Item *ref_arg, my_bool unsigned_arg) :
Item_int(i), ref(ref_arg)
{
unsigned_flag= ref_arg->unsigned_flag;
unsigned_flag= unsigned_arg;
}
int save_in_field(Field *field, bool no_conversions)
{
......
......@@ -216,7 +216,8 @@ static bool convert_constant_item(THD *thd, Field *field, Item **item)
field->table->in_use->variables.sql_mode|= MODE_INVALID_DATES;
if (!(*item)->save_in_field(field, 1) && !((*item)->null_value))
{
Item *tmp=new Item_int_with_ref(field->val_int(), *item);
Item *tmp=new Item_int_with_ref(field->val_int(), *item,
test(field->flags & UNSIGNED_FLAG));
field->table->in_use->variables.sql_mode= orig_sql_mode;
if (tmp)
thd->change_item_tree(item, tmp);
......
......@@ -252,6 +252,18 @@ public:
};
/* Returns self */
class Item_nodeset_func_selfbyname: public Item_nodeset_func_axisbyname
{
public:
Item_nodeset_func_selfbyname(Item *a, const char *n_arg, uint l_arg,
String *pxml):
Item_nodeset_func_axisbyname(a, n_arg, l_arg, pxml) {}
const char *func_name() const { return "xpath_selfbyname"; }
String *val_nodeset(String *nodeset);
};
/* Returns children */
class Item_nodeset_func_childbyname: public Item_nodeset_func_axisbyname
{
......@@ -572,6 +584,20 @@ String * Item_nodeset_func_union::val_nodeset(String *nodeset)
}
String *Item_nodeset_func_selfbyname::val_nodeset(String *nodeset)
{
prepare(nodeset);
for (MY_XPATH_FLT *flt= fltbeg; flt < fltend; flt++)
{
uint pos= 0;
MY_XML_NODE *self= &nodebeg[flt->num];
if (validname(self))
((XPathFilter*)nodeset)->append_element(flt->num,pos++);
}
return nodeset;
}
String *Item_nodeset_func_childbyname::val_nodeset(String *nodeset)
{
prepare(nodeset);
......@@ -945,6 +971,9 @@ static Item* nametestfunc(MY_XPATH *xpath,
case MY_XPATH_AXIS_ATTRIBUTE:
res= new Item_nodeset_func_attributebyname(arg, beg, len, xpath->pxml);
break;
case MY_XPATH_AXIS_SELF:
res= new Item_nodeset_func_selfbyname(arg, beg, len, xpath->pxml);
break;
default:
res= new Item_nodeset_func_childbyname(arg, beg, len, xpath->pxml);
}
......
......@@ -3630,11 +3630,13 @@ bool mysql_unpack_partition(THD *thd, const uchar *part_buf,
Item *thd_free_list= thd->free_list;
bool result= TRUE;
partition_info *part_info;
CHARSET_INFO *old_character_set_client= thd->variables.character_set_client;
LEX *old_lex= thd->lex;
LEX lex;
DBUG_ENTER("mysql_unpack_partition");
thd->lex= &lex;
thd->variables.character_set_client= system_charset_info;
lex_start(thd, part_buf, part_info_len);
/*
We need to use the current SELECT_LEX since I need to keep the
......@@ -3760,6 +3762,7 @@ bool mysql_unpack_partition(THD *thd, const uchar *part_buf,
end:
thd->free_list= thd_free_list;
thd->lex= old_lex;
thd->variables.character_set_client= old_character_set_client;
DBUG_RETURN(result);
}
......
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