mirror of
https://github.com/MariaDB/server.git
synced 2026-04-26 18:25:30 +02:00
Merge bk-internal:/home/bk/mysql-4.1
into mysql.com:/home/jimw/my/mysql-4.1-clean
This commit is contained in:
commit
cddb5f57dd
41 changed files with 760 additions and 149 deletions
|
|
@ -203,6 +203,7 @@ serg@sergbook.mysql.com
|
|||
sergefp@mysql.com
|
||||
sinisa@rhols221.adsl.netsonic.fi
|
||||
stewart@mysql.com
|
||||
svoj@mysql.com
|
||||
tfr@beta.frontier86.ee
|
||||
tfr@indrek.tfr.cafe.ee
|
||||
tfr@sarvik.tfr.cafe.ee
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ AC_INIT(sql/mysqld.cc)
|
|||
AC_CANONICAL_SYSTEM
|
||||
# The Docs Makefile.am parses this line!
|
||||
# remember to also change ndb version below and update version.c in ndb
|
||||
AM_INIT_AUTOMAKE(mysql, 4.1.10)
|
||||
AM_INIT_AUTOMAKE(mysql, 4.1.11)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
PROTOCOL_VERSION=10
|
||||
|
|
@ -16,7 +16,7 @@ SHARED_LIB_VERSION=14:0:0
|
|||
# ndb version
|
||||
NDB_VERSION_MAJOR=4
|
||||
NDB_VERSION_MINOR=1
|
||||
NDB_VERSION_BUILD=10
|
||||
NDB_VERSION_BUILD=11
|
||||
NDB_VERSION_STATUS=""
|
||||
|
||||
# Set all version vars based on $VERSION. How do we do this more elegant ?
|
||||
|
|
|
|||
|
|
@ -31,18 +31,25 @@ functions */
|
|||
|
||||
#define HAVE_SMEM 1
|
||||
|
||||
#if defined(__NT__)
|
||||
#define SYSTEM_TYPE "NT"
|
||||
#elif defined(__WIN2000__)
|
||||
#define SYSTEM_TYPE "WIN2000"
|
||||
#if defined(_WIN64) || defined(WIN64)
|
||||
#define SYSTEM_TYPE "Win64"
|
||||
#elif defined(_WIN32) || defined(WIN32)
|
||||
#define SYSTEM_TYPE "Win32"
|
||||
#else
|
||||
#define SYSTEM_TYPE "Win95/Win98"
|
||||
#define SYSTEM_TYPE "Windows"
|
||||
#endif
|
||||
|
||||
#if defined(_WIN64) || defined(WIN64)
|
||||
#define MACHINE_TYPE "ia64" /* Define to machine type name */
|
||||
#if defined(_M_IA64)
|
||||
#define MACHINE_TYPE "ia64"
|
||||
#elif defined(_M_IX86)
|
||||
#define MACHINE_TYPE "ia32"
|
||||
#elif defined(_M_ALPHA)
|
||||
#define MACHINE_TYPE "axp"
|
||||
#else
|
||||
#define MACHINE_TYPE "i32" /* Define to machine type name */
|
||||
#define MACHINE_TYPE "unknown" /* Define to machine type name */
|
||||
#endif
|
||||
|
||||
#if !(defined(_WIN64) || defined(WIN64))
|
||||
#ifndef _WIN32
|
||||
#define _WIN32 /* Compatible with old source */
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -435,32 +435,24 @@ static int _ftb_strstr(const byte *s0, const byte *e0,
|
|||
const byte *s1, const byte *e1,
|
||||
CHARSET_INFO *cs)
|
||||
{
|
||||
const byte *p0, *p1;
|
||||
my_bool s_after, e_before;
|
||||
|
||||
s_after=true_word_char(cs, s1[0]);
|
||||
e_before=true_word_char(cs, e1[-1]);
|
||||
p0=s0;
|
||||
const byte *p0= s0;
|
||||
my_bool s_after= true_word_char(cs, s1[0]);
|
||||
my_bool e_before= true_word_char(cs, e1[-1]);
|
||||
uint p0_len;
|
||||
my_match_t m[2];
|
||||
|
||||
while (p0 < e0)
|
||||
{
|
||||
while (p0 < e0 && cs->to_upper[(uint) (uchar) *p0++] !=
|
||||
cs->to_upper[(uint) (uchar) *s1])
|
||||
/* no-op */;
|
||||
if (p0 >= e0)
|
||||
return 0;
|
||||
|
||||
if (s_after && p0-1 > s0 && true_word_char(cs, p0[-2]))
|
||||
continue;
|
||||
|
||||
p1=s1+1;
|
||||
while (p0 < e0 && p1 < e1 && cs->to_upper[(uint) (uchar) *p0] ==
|
||||
cs->to_upper[(uint) (uchar) *p1])
|
||||
p0++, p1++;
|
||||
if (p1 == e1 && (!e_before || p0 == e0 || !true_word_char(cs, p0[0])))
|
||||
return 1;
|
||||
if (cs->coll->instr(cs, p0, e0 - p0, s1, e1 - s1, m, 2) != 2)
|
||||
return(0);
|
||||
if ((!s_after || p0 + m[1].beg == s0 || !true_word_char(cs, p0[m[1].beg-1])) &&
|
||||
(!e_before || p0 + m[1].end == e0 || !true_word_char(cs, p0[m[1].end])))
|
||||
return(1);
|
||||
p0+= m[1].beg;
|
||||
p0+= (p0_len= my_mbcharlen(cs, *(uchar *)p0)) ? p0_len : 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -163,3 +163,12 @@ select * from t1;
|
|||
a b
|
||||
7 7
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( a int PRIMARY KEY );
|
||||
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a;
|
||||
INSERT INTO t1 VALUES (0),(1),(2);
|
||||
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a LIMIT 1;
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
0
|
||||
2
|
||||
DROP TABLE t1;
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@ master-bin.000001 # Query 1 # create database `drop-temp+table-test`
|
|||
master-bin.000001 # Query 1 # use `drop-temp+table-test`; create temporary table shortn1 (a int)
|
||||
master-bin.000001 # Query 1 # use `drop-temp+table-test`; create temporary table `table:name` (a int)
|
||||
master-bin.000001 # Query 1 # use `drop-temp+table-test`; create temporary table shortn2 (a int)
|
||||
master-bin.000001 # Query 1 # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`shortn2`
|
||||
master-bin.000001 # Query 1 # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`table:name`
|
||||
master-bin.000001 # Query 1 # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`shortn1`
|
||||
master-bin.000001 # Query 1 # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`shortn2`,`drop-temp+table-test`.`table:name`,`drop-temp+table-test`.`shortn1`
|
||||
master-bin.000001 # Query 1 # use `drop-temp+table-test`; DO RELEASE_LOCK("a")
|
||||
drop database `drop-temp+table-test`;
|
||||
|
|
|
|||
|
|
@ -408,3 +408,10 @@ insert t1 values (1, "aaaa"), (2, "bbbb");
|
|||
insert t2 values (10, "aaaa"), (2, "cccc");
|
||||
replace t1 select * from t2;
|
||||
drop table t1, t2;
|
||||
CREATE TABLE t1 (t VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci, FULLTEXT (t));
|
||||
SET NAMES latin1;
|
||||
INSERT INTO t1 VALUES('Mit freundlichem Grüß aus Osnabrück');
|
||||
SELECT COUNT(*) FROM t1 WHERE MATCH(t) AGAINST ('"osnabrück"' IN BOOLEAN MODE);
|
||||
COUNT(*)
|
||||
1
|
||||
DROP TABLE t1;
|
||||
|
|
|
|||
|
|
@ -445,6 +445,89 @@ select count(*)-9 from t1 use index (ts) where ts <= '2001-01-01 23:59:59';
|
|||
count(*)-9
|
||||
0
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
a int primary key,
|
||||
s decimal(12),
|
||||
t decimal(12, 5),
|
||||
u decimal(12) unsigned,
|
||||
v decimal(12, 5) unsigned,
|
||||
key (s),
|
||||
key (t),
|
||||
key (u),
|
||||
key (v)
|
||||
) engine=ndb;
|
||||
insert into t1 values
|
||||
( 0, -000000000007, -0000061.00003, 000000000061, 0000965.00042),
|
||||
( 1, -000000000007, -0000061.00042, 000000000061, 0000965.00003),
|
||||
( 2, -071006035767, 4210253.00024, 000000000001, 0000001.84488),
|
||||
( 3, 000000007115, 0000000.77607, 000077350625, 0000018.00013),
|
||||
( 4, -000000068391, -0346486.00000, 000000005071, 0005334.00002),
|
||||
( 5, -521579890459, -1936874.00001, 000000000154, 0000003.00018),
|
||||
( 6, -521579890459, -1936874.00018, 000000000154, 0000003.00001),
|
||||
( 7, 000000000333, 0000051.39140, 000000907958, 0788643.08374),
|
||||
( 8, 000042731229, 0000009.00000, 000000000009, 6428667.00000),
|
||||
( 9, -000008159769, 0000918.00004, 000096951421, 7607730.00008);
|
||||
select count(*)- 5 from t1 use index (s) where s < -000000000007;
|
||||
count(*)- 5
|
||||
0
|
||||
select count(*)- 7 from t1 use index (s) where s <= -000000000007;
|
||||
count(*)- 7
|
||||
0
|
||||
select count(*)- 2 from t1 use index (s) where s = -000000000007;
|
||||
count(*)- 2
|
||||
0
|
||||
select count(*)- 5 from t1 use index (s) where s >= -000000000007;
|
||||
count(*)- 5
|
||||
0
|
||||
select count(*)- 3 from t1 use index (s) where s > -000000000007;
|
||||
count(*)- 3
|
||||
0
|
||||
select count(*)- 4 from t1 use index (t) where t < -0000061.00003;
|
||||
count(*)- 4
|
||||
0
|
||||
select count(*)- 5 from t1 use index (t) where t <= -0000061.00003;
|
||||
count(*)- 5
|
||||
0
|
||||
select count(*)- 1 from t1 use index (t) where t = -0000061.00003;
|
||||
count(*)- 1
|
||||
0
|
||||
select count(*)- 6 from t1 use index (t) where t >= -0000061.00003;
|
||||
count(*)- 6
|
||||
0
|
||||
select count(*)- 5 from t1 use index (t) where t > -0000061.00003;
|
||||
count(*)- 5
|
||||
0
|
||||
select count(*)- 2 from t1 use index (u) where u < 000000000061;
|
||||
count(*)- 2
|
||||
0
|
||||
select count(*)- 4 from t1 use index (u) where u <= 000000000061;
|
||||
count(*)- 4
|
||||
0
|
||||
select count(*)- 2 from t1 use index (u) where u = 000000000061;
|
||||
count(*)- 2
|
||||
0
|
||||
select count(*)- 8 from t1 use index (u) where u >= 000000000061;
|
||||
count(*)- 8
|
||||
0
|
||||
select count(*)- 6 from t1 use index (u) where u > 000000000061;
|
||||
count(*)- 6
|
||||
0
|
||||
select count(*)- 5 from t1 use index (v) where v < 0000965.00042;
|
||||
count(*)- 5
|
||||
0
|
||||
select count(*)- 6 from t1 use index (v) where v <= 0000965.00042;
|
||||
count(*)- 6
|
||||
0
|
||||
select count(*)- 1 from t1 use index (v) where v = 0000965.00042;
|
||||
count(*)- 1
|
||||
0
|
||||
select count(*)- 5 from t1 use index (v) where v >= 0000965.00042;
|
||||
count(*)- 5
|
||||
0
|
||||
select count(*)- 4 from t1 use index (v) where v > 0000965.00042;
|
||||
count(*)- 4
|
||||
0
|
||||
drop table t1;
|
||||
create table t1(a int primary key, b int not null, index(b));
|
||||
insert into t1 values (1,1), (2,2);
|
||||
set autocommit=0;
|
||||
|
|
|
|||
12
mysql-test/r/rpl_drop_temp.result
Normal file
12
mysql-test/r/rpl_drop_temp.result
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
create database if not exists mysqltest;
|
||||
create temporary table mysqltest.t1 (n int);
|
||||
create temporary table mysqltest.t2 (n int);
|
||||
show status like 'Slave_open_temp_tables';
|
||||
Variable_name Value
|
||||
Slave_open_temp_tables 0
|
||||
32
mysql-test/r/rpl_multi_query.result
Normal file
32
mysql-test/r/rpl_multi_query.result
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
drop database if exists mysqltest;
|
||||
create database mysqltest;
|
||||
create table mysqltest.t1 ( n int);
|
||||
insert into mysqltest.t1 values(1)/
|
||||
insert into mysqltest.t1 values(2);
|
||||
insert into mysqltest.t1 values(3);
|
||||
insert into mysqltest.t1 values(4);
|
||||
insert into mysqltest.t1 values(5)/
|
||||
select * from mysqltest.t1;
|
||||
n
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
show binlog events from 79;
|
||||
Log_name Pos Event_type Server_id Orig_log_pos Info
|
||||
master-bin.000001 # Query 1 # drop database if exists mysqltest
|
||||
master-bin.000001 # Query 1 # create database mysqltest
|
||||
master-bin.000001 # Query 1 # use `test`; create table mysqltest.t1 ( n int)
|
||||
master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(1)
|
||||
master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(2)
|
||||
master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(3)
|
||||
master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(4)
|
||||
master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(5)
|
||||
drop database mysqltest;
|
||||
|
|
@ -2168,3 +2168,103 @@ ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
|
|||
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL;
|
||||
ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
categoryId int(11) NOT NULL,
|
||||
courseId int(11) NOT NULL,
|
||||
startDate datetime NOT NULL,
|
||||
endDate datetime NOT NULL,
|
||||
createDate datetime NOT NULL,
|
||||
modifyDate timestamp NOT NULL,
|
||||
attributes text NOT NULL
|
||||
);
|
||||
INSERT INTO t1 VALUES (1,41,'2004-02-09','2010-01-01','2004-02-09','2004-02-09',''),
|
||||
(1,86,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
|
||||
(1,87,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
|
||||
(2,52,'2004-03-15','2004-10-01','2004-03-15','2004-09-17',''),
|
||||
(2,53,'2004-03-16','2004-10-01','2004-03-16','2004-09-17',''),
|
||||
(2,88,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
|
||||
(2,89,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
|
||||
(3,51,'2004-02-09','2010-01-01','2004-02-09','2004-02-09',''),
|
||||
(5,12,'2004-02-18','2010-01-01','2004-02-18','2004-02-18','');
|
||||
CREATE TABLE t2 (
|
||||
userId int(11) NOT NULL,
|
||||
courseId int(11) NOT NULL,
|
||||
date datetime NOT NULL
|
||||
);
|
||||
INSERT INTO t2 VALUES (5141,71,'2003-11-18'),
|
||||
(5141,72,'2003-11-25'),(5141,41,'2004-08-06'),
|
||||
(5141,52,'2004-08-06'),(5141,53,'2004-08-06'),
|
||||
(5141,12,'2004-08-06'),(5141,86,'2004-10-21'),
|
||||
(5141,87,'2004-10-21'),(5141,88,'2004-10-21'),
|
||||
(5141,89,'2004-10-22'),(5141,51,'2004-10-26');
|
||||
CREATE TABLE t3 (
|
||||
groupId int(11) NOT NULL,
|
||||
parentId int(11) NOT NULL,
|
||||
startDate datetime NOT NULL,
|
||||
endDate datetime NOT NULL,
|
||||
createDate datetime NOT NULL,
|
||||
modifyDate timestamp NOT NULL,
|
||||
ordering int(11)
|
||||
);
|
||||
INSERT INTO t3 VALUES (12,9,'1000-01-01','3999-12-31','2004-01-29','2004-01-29',NULL);
|
||||
CREATE TABLE t4 (
|
||||
id int(11) NOT NULL,
|
||||
groupTypeId int(11) NOT NULL,
|
||||
groupKey varchar(50) NOT NULL,
|
||||
name text,
|
||||
ordering int(11),
|
||||
description text,
|
||||
createDate datetime NOT NULL,
|
||||
modifyDate timestamp NOT NULL
|
||||
);
|
||||
INSERT INTO t4 VALUES (9,5,'stationer','stationer',0,'Stationer','2004-01-29','2004-01-29'),
|
||||
(12,5,'group2','group2',0,'group2','2004-01-29','2004-01-29');
|
||||
CREATE TABLE t5 (
|
||||
userId int(11) NOT NULL,
|
||||
groupId int(11) NOT NULL,
|
||||
createDate datetime NOT NULL,
|
||||
modifyDate timestamp NOT NULL
|
||||
);
|
||||
INSERT INTO t5 VALUES (5141,12,'2004-08-06','2004-08-06');
|
||||
select
|
||||
count(distinct t2.userid) pass,
|
||||
groupstuff.*,
|
||||
count(t2.courseid) crse,
|
||||
t1.categoryid,
|
||||
t2.courseid,
|
||||
date_format(date, '%b%y') as colhead
|
||||
from t2
|
||||
join t1 on t2.courseid=t1.courseid
|
||||
join
|
||||
(
|
||||
select
|
||||
t5.userid,
|
||||
parentid,
|
||||
parentgroup,
|
||||
childid,
|
||||
groupname,
|
||||
grouptypeid
|
||||
from t5
|
||||
join
|
||||
(
|
||||
select t4.id as parentid,
|
||||
t4.name as parentgroup,
|
||||
t4.id as childid,
|
||||
t4.name as groupname,
|
||||
t4.grouptypeid
|
||||
from t4
|
||||
) as gin on t5.groupid=gin.childid
|
||||
) as groupstuff on t2.userid = groupstuff.userid
|
||||
group by
|
||||
groupstuff.groupname, colhead , t2.courseid;
|
||||
pass userid parentid parentgroup childid groupname grouptypeid crse categoryid courseid colhead
|
||||
1 5141 12 group2 12 group2 5 1 5 12 Aug04
|
||||
1 5141 12 group2 12 group2 5 1 1 41 Aug04
|
||||
1 5141 12 group2 12 group2 5 1 2 52 Aug04
|
||||
1 5141 12 group2 12 group2 5 1 2 53 Aug04
|
||||
1 5141 12 group2 12 group2 5 1 3 51 Oct04
|
||||
1 5141 12 group2 12 group2 5 1 1 86 Oct04
|
||||
1 5141 12 group2 12 group2 5 1 1 87 Oct04
|
||||
1 5141 12 group2 12 group2 5 1 2 88 Oct04
|
||||
1 5141 12 group2 12 group2 5 1 2 89 Oct04
|
||||
drop table if exists t1, t2, t3, t4, t5;
|
||||
|
|
|
|||
|
|
@ -141,3 +141,14 @@ delete t1 from t1 where a = 3;
|
|||
check table t1;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #8392: delete with ORDER BY containing a direct reference to the table
|
||||
#
|
||||
|
||||
CREATE TABLE t1 ( a int PRIMARY KEY );
|
||||
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a;
|
||||
INSERT INTO t1 VALUES (0),(1),(2);
|
||||
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a LIMIT 1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
|
|
|||
|
|
@ -322,3 +322,11 @@ insert t2 values (10, "aaaa"), (2, "cccc");
|
|||
replace t1 select * from t2;
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# bug#8351
|
||||
#
|
||||
CREATE TABLE t1 (t VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci, FULLTEXT (t));
|
||||
SET NAMES latin1;
|
||||
INSERT INTO t1 VALUES('Mit freundlichem Grüß aus Osnabrück');
|
||||
SELECT COUNT(*) FROM t1 WHERE MATCH(t) AGAINST ('"osnabrück"' IN BOOLEAN MODE);
|
||||
DROP TABLE t1;
|
||||
|
|
|
|||
|
|
@ -249,6 +249,58 @@ select count(*)-9 from t1 use index (ts) where ts <= '2001-01-01 23:59:59';
|
|||
|
||||
drop table t1;
|
||||
|
||||
# decimal (not the new 5.0 thing)
|
||||
|
||||
create table t1 (
|
||||
a int primary key,
|
||||
s decimal(12),
|
||||
t decimal(12, 5),
|
||||
u decimal(12) unsigned,
|
||||
v decimal(12, 5) unsigned,
|
||||
key (s),
|
||||
key (t),
|
||||
key (u),
|
||||
key (v)
|
||||
) engine=ndb;
|
||||
#
|
||||
insert into t1 values
|
||||
( 0, -000000000007, -0000061.00003, 000000000061, 0000965.00042),
|
||||
( 1, -000000000007, -0000061.00042, 000000000061, 0000965.00003),
|
||||
( 2, -071006035767, 4210253.00024, 000000000001, 0000001.84488),
|
||||
( 3, 000000007115, 0000000.77607, 000077350625, 0000018.00013),
|
||||
( 4, -000000068391, -0346486.00000, 000000005071, 0005334.00002),
|
||||
( 5, -521579890459, -1936874.00001, 000000000154, 0000003.00018),
|
||||
( 6, -521579890459, -1936874.00018, 000000000154, 0000003.00001),
|
||||
( 7, 000000000333, 0000051.39140, 000000907958, 0788643.08374),
|
||||
( 8, 000042731229, 0000009.00000, 000000000009, 6428667.00000),
|
||||
( 9, -000008159769, 0000918.00004, 000096951421, 7607730.00008);
|
||||
#
|
||||
select count(*)- 5 from t1 use index (s) where s < -000000000007;
|
||||
select count(*)- 7 from t1 use index (s) where s <= -000000000007;
|
||||
select count(*)- 2 from t1 use index (s) where s = -000000000007;
|
||||
select count(*)- 5 from t1 use index (s) where s >= -000000000007;
|
||||
select count(*)- 3 from t1 use index (s) where s > -000000000007;
|
||||
#
|
||||
select count(*)- 4 from t1 use index (t) where t < -0000061.00003;
|
||||
select count(*)- 5 from t1 use index (t) where t <= -0000061.00003;
|
||||
select count(*)- 1 from t1 use index (t) where t = -0000061.00003;
|
||||
select count(*)- 6 from t1 use index (t) where t >= -0000061.00003;
|
||||
select count(*)- 5 from t1 use index (t) where t > -0000061.00003;
|
||||
#
|
||||
select count(*)- 2 from t1 use index (u) where u < 000000000061;
|
||||
select count(*)- 4 from t1 use index (u) where u <= 000000000061;
|
||||
select count(*)- 2 from t1 use index (u) where u = 000000000061;
|
||||
select count(*)- 8 from t1 use index (u) where u >= 000000000061;
|
||||
select count(*)- 6 from t1 use index (u) where u > 000000000061;
|
||||
#
|
||||
select count(*)- 5 from t1 use index (v) where v < 0000965.00042;
|
||||
select count(*)- 6 from t1 use index (v) where v <= 0000965.00042;
|
||||
select count(*)- 1 from t1 use index (v) where v = 0000965.00042;
|
||||
select count(*)- 5 from t1 use index (v) where v >= 0000965.00042;
|
||||
select count(*)- 4 from t1 use index (v) where v > 0000965.00042;
|
||||
|
||||
drop table t1;
|
||||
|
||||
# bug#7798
|
||||
create table t1(a int primary key, b int not null, index(b));
|
||||
insert into t1 values (1,1), (2,2);
|
||||
|
|
|
|||
2
mysql-test/t/rpl_drop_temp-slave.opt
Normal file
2
mysql-test/t/rpl_drop_temp-slave.opt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
--replicate-ignore-table=mysqltest.t2
|
||||
|
||||
13
mysql-test/t/rpl_drop_temp.test
Normal file
13
mysql-test/t/rpl_drop_temp.test
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
source include/master-slave.inc;
|
||||
--disable_warnings
|
||||
create database if not exists mysqltest;
|
||||
--enable_warnings
|
||||
|
||||
create temporary table mysqltest.t1 (n int);
|
||||
create temporary table mysqltest.t2 (n int);
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
disconnect master;
|
||||
connection slave;
|
||||
--real_sleep 3; # time for DROP to be written
|
||||
show status like 'Slave_open_temp_tables';
|
||||
29
mysql-test/t/rpl_multi_query.test
Normal file
29
mysql-test/t/rpl_multi_query.test
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# Test for BUG#8436: verify that a multi-query (i.e. one query
|
||||
# containing several queries (assuming client has
|
||||
# CLIENT_MULTI_STATEMENTS) will be binlogged ONE-query-per-event (not
|
||||
# one binlog event containing all queries)
|
||||
|
||||
# PS doesn't support multi-statements
|
||||
--disable_ps_protocol
|
||||
|
||||
source include/master-slave.inc;
|
||||
--disable_warnings
|
||||
drop database if exists mysqltest;
|
||||
--enable_warnings
|
||||
create database mysqltest;
|
||||
|
||||
delimiter /;
|
||||
create table mysqltest.t1 ( n int);
|
||||
insert into mysqltest.t1 values(1)/
|
||||
insert into mysqltest.t1 values(2);
|
||||
insert into mysqltest.t1 values(3);
|
||||
insert into mysqltest.t1 values(4);
|
||||
insert into mysqltest.t1 values(5)/
|
||||
delimiter ;/
|
||||
sync_slave_with_master;
|
||||
select * from mysqltest.t1;
|
||||
connection master;
|
||||
--replace_column 2 # 5 #
|
||||
show binlog events from 79;
|
||||
drop database mysqltest;
|
||||
sync_slave_with_master;
|
||||
|
|
@ -1437,3 +1437,104 @@ select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
|
|||
-- error 1247
|
||||
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL;
|
||||
drop table t1;
|
||||
|
||||
# Test for BUG#8218
|
||||
|
||||
CREATE TABLE t1 (
|
||||
categoryId int(11) NOT NULL,
|
||||
courseId int(11) NOT NULL,
|
||||
startDate datetime NOT NULL,
|
||||
endDate datetime NOT NULL,
|
||||
createDate datetime NOT NULL,
|
||||
modifyDate timestamp NOT NULL,
|
||||
attributes text NOT NULL
|
||||
);
|
||||
INSERT INTO t1 VALUES (1,41,'2004-02-09','2010-01-01','2004-02-09','2004-02-09',''),
|
||||
(1,86,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
|
||||
(1,87,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
|
||||
(2,52,'2004-03-15','2004-10-01','2004-03-15','2004-09-17',''),
|
||||
(2,53,'2004-03-16','2004-10-01','2004-03-16','2004-09-17',''),
|
||||
(2,88,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
|
||||
(2,89,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
|
||||
(3,51,'2004-02-09','2010-01-01','2004-02-09','2004-02-09',''),
|
||||
(5,12,'2004-02-18','2010-01-01','2004-02-18','2004-02-18','');
|
||||
|
||||
CREATE TABLE t2 (
|
||||
userId int(11) NOT NULL,
|
||||
courseId int(11) NOT NULL,
|
||||
date datetime NOT NULL
|
||||
);
|
||||
INSERT INTO t2 VALUES (5141,71,'2003-11-18'),
|
||||
(5141,72,'2003-11-25'),(5141,41,'2004-08-06'),
|
||||
(5141,52,'2004-08-06'),(5141,53,'2004-08-06'),
|
||||
(5141,12,'2004-08-06'),(5141,86,'2004-10-21'),
|
||||
(5141,87,'2004-10-21'),(5141,88,'2004-10-21'),
|
||||
(5141,89,'2004-10-22'),(5141,51,'2004-10-26');
|
||||
|
||||
|
||||
CREATE TABLE t3 (
|
||||
groupId int(11) NOT NULL,
|
||||
parentId int(11) NOT NULL,
|
||||
startDate datetime NOT NULL,
|
||||
endDate datetime NOT NULL,
|
||||
createDate datetime NOT NULL,
|
||||
modifyDate timestamp NOT NULL,
|
||||
ordering int(11)
|
||||
);
|
||||
INSERT INTO t3 VALUES (12,9,'1000-01-01','3999-12-31','2004-01-29','2004-01-29',NULL);
|
||||
|
||||
CREATE TABLE t4 (
|
||||
id int(11) NOT NULL,
|
||||
groupTypeId int(11) NOT NULL,
|
||||
groupKey varchar(50) NOT NULL,
|
||||
name text,
|
||||
ordering int(11),
|
||||
description text,
|
||||
createDate datetime NOT NULL,
|
||||
modifyDate timestamp NOT NULL
|
||||
);
|
||||
INSERT INTO t4 VALUES (9,5,'stationer','stationer',0,'Stationer','2004-01-29','2004-01-29'),
|
||||
(12,5,'group2','group2',0,'group2','2004-01-29','2004-01-29');
|
||||
|
||||
CREATE TABLE t5 (
|
||||
userId int(11) NOT NULL,
|
||||
groupId int(11) NOT NULL,
|
||||
createDate datetime NOT NULL,
|
||||
modifyDate timestamp NOT NULL
|
||||
);
|
||||
INSERT INTO t5 VALUES (5141,12,'2004-08-06','2004-08-06');
|
||||
|
||||
select
|
||||
count(distinct t2.userid) pass,
|
||||
groupstuff.*,
|
||||
count(t2.courseid) crse,
|
||||
t1.categoryid,
|
||||
t2.courseid,
|
||||
date_format(date, '%b%y') as colhead
|
||||
from t2
|
||||
join t1 on t2.courseid=t1.courseid
|
||||
join
|
||||
(
|
||||
select
|
||||
t5.userid,
|
||||
parentid,
|
||||
parentgroup,
|
||||
childid,
|
||||
groupname,
|
||||
grouptypeid
|
||||
from t5
|
||||
join
|
||||
(
|
||||
select t4.id as parentid,
|
||||
t4.name as parentgroup,
|
||||
t4.id as childid,
|
||||
t4.name as groupname,
|
||||
t4.grouptypeid
|
||||
from t4
|
||||
) as gin on t5.groupid=gin.childid
|
||||
) as groupstuff on t2.userid = groupstuff.userid
|
||||
group by
|
||||
groupstuff.groupname, colhead , t2.courseid;
|
||||
|
||||
drop table if exists t1, t2, t3, t4, t5;
|
||||
|
||||
|
|
|
|||
|
|
@ -302,7 +302,8 @@ public:
|
|||
ExtBigunsigned = NdbSqlUtil::Type::Bigunsigned,
|
||||
ExtFloat = NdbSqlUtil::Type::Float,
|
||||
ExtDouble = NdbSqlUtil::Type::Double,
|
||||
ExtDecimal = NdbSqlUtil::Type::Decimal,
|
||||
ExtOlddecimal = NdbSqlUtil::Type::Olddecimal,
|
||||
ExtOlddecimalunsigned = NdbSqlUtil::Type::Olddecimalunsigned,
|
||||
ExtChar = NdbSqlUtil::Type::Char,
|
||||
ExtVarchar = NdbSqlUtil::Type::Varchar,
|
||||
ExtBinary = NdbSqlUtil::Type::Binary,
|
||||
|
|
@ -411,9 +412,20 @@ public:
|
|||
AttributeSize = DictTabInfo::a64Bit;
|
||||
AttributeArraySize = AttributeExtLength;
|
||||
return true;
|
||||
case DictTabInfo::ExtDecimal:
|
||||
// not yet implemented anywhere
|
||||
break;
|
||||
case DictTabInfo::ExtOlddecimal:
|
||||
AttributeType = DictTabInfo::StringType;
|
||||
AttributeSize = DictTabInfo::an8Bit;
|
||||
AttributeArraySize =
|
||||
(1 + AttributeExtPrecision + (int(AttributeExtScale) > 0)) *
|
||||
AttributeExtLength;
|
||||
return true;
|
||||
case DictTabInfo::ExtOlddecimalunsigned:
|
||||
AttributeType = DictTabInfo::StringType;
|
||||
AttributeSize = DictTabInfo::an8Bit;
|
||||
AttributeArraySize =
|
||||
(0 + AttributeExtPrecision + (int(AttributeExtScale) > 0)) *
|
||||
AttributeExtLength;
|
||||
return true;
|
||||
case DictTabInfo::ExtChar:
|
||||
case DictTabInfo::ExtBinary:
|
||||
AttributeType = DictTabInfo::StringType;
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ public:
|
|||
Bigunsigned, ///< 64 Bit. 8 byte signed integer, can be used in array
|
||||
Float, ///< 32-bit float. 4 bytes float, can be used in array
|
||||
Double, ///< 64-bit float. 8 byte float, can be used in array
|
||||
Decimal, ///< Precision, Scale are applicable
|
||||
Olddecimal, ///< MySQL < 5.0 signed decimal, Precision, Scale
|
||||
Char, ///< Len. A fixed array of 1-byte chars
|
||||
Varchar, ///< Max len
|
||||
Binary, ///< Len
|
||||
|
|
@ -190,7 +190,8 @@ public:
|
|||
Text, ///< Text blob
|
||||
Time = 25, ///< Time without date
|
||||
Year = 26, ///< Year 1901-2155 (1 byte)
|
||||
Timestamp = 27 ///< Unix time
|
||||
Timestamp = 27, ///< Unix time
|
||||
Olddecimalunsigned = 28
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -276,25 +277,25 @@ public:
|
|||
|
||||
/**
|
||||
* Set precision of column.
|
||||
* @note Only applicable for builtin type Decimal
|
||||
* @note Only applicable for decimal types
|
||||
*/
|
||||
void setPrecision(int);
|
||||
|
||||
/**
|
||||
* Get precision of column.
|
||||
* @note Only applicable for builtin type Decimal
|
||||
* @note Only applicable for decimal types
|
||||
*/
|
||||
int getPrecision() const;
|
||||
|
||||
/**
|
||||
* Set scale of column.
|
||||
* @note Only applicable for builtin type Decimal
|
||||
* @note Only applicable for decimal types
|
||||
*/
|
||||
void setScale(int);
|
||||
|
||||
/**
|
||||
* Get scale of column.
|
||||
* @note Only applicable for builtin type Decimal
|
||||
* @note Only applicable for decimal types
|
||||
*/
|
||||
int getScale() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public:
|
|||
Bigunsigned, // 64 Bit
|
||||
Float, // 32-bit float
|
||||
Double, // 64-bit float
|
||||
Decimal, // Precision, Scale
|
||||
Olddecimal, // Precision, Scale
|
||||
Char, // Len
|
||||
Varchar, // Max len
|
||||
Binary, // Len
|
||||
|
|
@ -86,7 +86,8 @@ public:
|
|||
Text, // Text blob
|
||||
Time = 25, // Time without date
|
||||
Year = 26, // Year (size 1 byte)
|
||||
Timestamp = 27 // Unix seconds (uint32)
|
||||
Timestamp = 27, // Unix seconds (uint32)
|
||||
Olddecimalunsigned = 28
|
||||
};
|
||||
Enum m_typeId;
|
||||
Cmp* m_cmp; // comparison method
|
||||
|
|
@ -109,6 +110,11 @@ public:
|
|||
static bool usable_in_hash_index(Uint32 typeId, const void* cs);
|
||||
static bool usable_in_ordered_index(Uint32 typeId, const void* cs);
|
||||
|
||||
/**
|
||||
* Compare decimal numbers.
|
||||
*/
|
||||
static int cmp_olddecimal(const uchar* s1, const uchar* s2, unsigned n);
|
||||
|
||||
private:
|
||||
/**
|
||||
* List of all types. Must match Type::Enum.
|
||||
|
|
@ -129,7 +135,7 @@ private:
|
|||
static Cmp cmpBigunsigned;
|
||||
static Cmp cmpFloat;
|
||||
static Cmp cmpDouble;
|
||||
static Cmp cmpDecimal;
|
||||
static Cmp cmpOlddecimal;
|
||||
static Cmp cmpChar;
|
||||
static Cmp cmpVarchar;
|
||||
static Cmp cmpBinary;
|
||||
|
|
@ -141,6 +147,7 @@ private:
|
|||
static Cmp cmpTime;
|
||||
static Cmp cmpYear;
|
||||
static Cmp cmpTimestamp;
|
||||
static Cmp cmpOlddecimalunsigned;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -76,117 +76,121 @@ NdbSqlUtil::char_like(const char* s1, unsigned n1,
|
|||
|
||||
const NdbSqlUtil::Type
|
||||
NdbSqlUtil::m_typeList[] = {
|
||||
{
|
||||
{ // 0
|
||||
Type::Undefined,
|
||||
NULL
|
||||
},
|
||||
{
|
||||
{ // 1
|
||||
Type::Tinyint,
|
||||
cmpTinyint
|
||||
},
|
||||
{
|
||||
{ // 2
|
||||
Type::Tinyunsigned,
|
||||
cmpTinyunsigned
|
||||
},
|
||||
{
|
||||
{ // 3
|
||||
Type::Smallint,
|
||||
cmpSmallint
|
||||
},
|
||||
{
|
||||
{ // 4
|
||||
Type::Smallunsigned,
|
||||
cmpSmallunsigned
|
||||
},
|
||||
{
|
||||
{ // 5
|
||||
Type::Mediumint,
|
||||
cmpMediumint
|
||||
},
|
||||
{
|
||||
{ // 6
|
||||
Type::Mediumunsigned,
|
||||
cmpMediumunsigned
|
||||
},
|
||||
{
|
||||
{ // 7
|
||||
Type::Int,
|
||||
cmpInt
|
||||
},
|
||||
{
|
||||
{ // 8
|
||||
Type::Unsigned,
|
||||
cmpUnsigned
|
||||
},
|
||||
{
|
||||
{ // 9
|
||||
Type::Bigint,
|
||||
cmpBigint
|
||||
},
|
||||
{
|
||||
{ // 10
|
||||
Type::Bigunsigned,
|
||||
cmpBigunsigned
|
||||
},
|
||||
{
|
||||
{ // 11
|
||||
Type::Float,
|
||||
cmpFloat
|
||||
},
|
||||
{
|
||||
{ // 12
|
||||
Type::Double,
|
||||
cmpDouble
|
||||
},
|
||||
{
|
||||
Type::Decimal,
|
||||
NULL // cmpDecimal
|
||||
{ // 13
|
||||
Type::Olddecimal,
|
||||
cmpOlddecimal
|
||||
},
|
||||
{
|
||||
{ // 14
|
||||
Type::Char,
|
||||
cmpChar
|
||||
},
|
||||
{
|
||||
{ // 15
|
||||
Type::Varchar,
|
||||
cmpVarchar
|
||||
},
|
||||
{
|
||||
{ // 16
|
||||
Type::Binary,
|
||||
cmpBinary
|
||||
},
|
||||
{
|
||||
{ // 17
|
||||
Type::Varbinary,
|
||||
cmpVarbinary
|
||||
},
|
||||
{
|
||||
{ // 18
|
||||
Type::Datetime,
|
||||
cmpDatetime
|
||||
},
|
||||
{
|
||||
{ // 19
|
||||
Type::Date,
|
||||
cmpDate
|
||||
},
|
||||
{
|
||||
{ // 20
|
||||
Type::Blob,
|
||||
cmpBlob
|
||||
},
|
||||
{
|
||||
{ // 21
|
||||
Type::Text,
|
||||
cmpText
|
||||
},
|
||||
{
|
||||
{ // 22
|
||||
Type::Undefined, // 5.0 Bit
|
||||
NULL
|
||||
},
|
||||
{
|
||||
{ // 23
|
||||
Type::Undefined, // 5.0 Longvarchar
|
||||
NULL
|
||||
},
|
||||
{
|
||||
{ // 24
|
||||
Type::Undefined, // 5.0 Longvarbinary
|
||||
NULL
|
||||
},
|
||||
{
|
||||
{ // 25
|
||||
Type::Time,
|
||||
cmpTime
|
||||
},
|
||||
{
|
||||
{ // 26
|
||||
Type::Year,
|
||||
cmpYear
|
||||
},
|
||||
{
|
||||
{ // 27
|
||||
Type::Timestamp,
|
||||
cmpTimestamp
|
||||
},
|
||||
{ // 28
|
||||
Type::Olddecimalunsigned,
|
||||
cmpOlddecimalunsigned
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -411,12 +415,54 @@ NdbSqlUtil::cmpDouble(const void* info, const Uint32* p1, const Uint32* p2, Uint
|
|||
}
|
||||
|
||||
int
|
||||
NdbSqlUtil::cmpDecimal(const void* info, const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 size)
|
||||
NdbSqlUtil::cmp_olddecimal(const uchar* s1, const uchar* s2, unsigned n)
|
||||
{
|
||||
int sgn = +1;
|
||||
unsigned i = 0;
|
||||
while (i < n) {
|
||||
int c1 = s1[i];
|
||||
int c2 = s2[i];
|
||||
if (c1 == c2) {
|
||||
if (c1 == '-')
|
||||
sgn = -1;
|
||||
} else if (c1 == '-') {
|
||||
return -1;
|
||||
} else if (c2 == '-') {
|
||||
return +1;
|
||||
} else if (c1 < c2) {
|
||||
return -1 * sgn;
|
||||
} else {
|
||||
return +1 * sgn;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
NdbSqlUtil::cmpOlddecimal(const void* info, const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 size)
|
||||
{
|
||||
assert(full >= size && size > 0);
|
||||
// not used by MySQL or NDB
|
||||
assert(false);
|
||||
return 0;
|
||||
if (full == size) {
|
||||
union { const Uint32* p; const uchar* v; } u1, u2;
|
||||
u1.p = p1;
|
||||
u2.p = p2;
|
||||
return cmp_olddecimal(u1.v, u2.v, full << 2);
|
||||
}
|
||||
return CmpUnknown;
|
||||
}
|
||||
|
||||
int
|
||||
NdbSqlUtil::cmpOlddecimalunsigned(const void* info, const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 size)
|
||||
{
|
||||
assert(full >= size && size > 0);
|
||||
if (full == size) {
|
||||
union { const Uint32* p; const uchar* v; } u1, u2;
|
||||
u1.p = p1;
|
||||
u2.p = p2;
|
||||
return cmp_olddecimal(u1.v, u2.v, full << 2);
|
||||
}
|
||||
return CmpUnknown;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -918,8 +918,11 @@ operator<<(NdbOut& out, const NdbDictionary::Column& col)
|
|||
case NdbDictionary::Column::Double:
|
||||
out << "Double";
|
||||
break;
|
||||
case NdbDictionary::Column::Decimal:
|
||||
out << "Decimal(" << col.getScale() << "," << col.getPrecision() << ")";
|
||||
case NdbDictionary::Column::Olddecimal:
|
||||
out << "Olddecimal(" << col.getPrecision() << "," << col.getScale() << ")";
|
||||
break;
|
||||
case NdbDictionary::Column::Olddecimalunsigned:
|
||||
out << "Olddecimalunsigned(" << col.getPrecision() << "," << col.getScale() << ")";
|
||||
break;
|
||||
case NdbDictionary::Column::Char:
|
||||
out << "Char(" << col.getLength() << ";" << csname << ")";
|
||||
|
|
|
|||
|
|
@ -114,7 +114,8 @@ NdbColumnImpl::init(Type t)
|
|||
m_length = 1;
|
||||
m_cs = NULL;
|
||||
break;
|
||||
case Decimal:
|
||||
case Olddecimal:
|
||||
case Olddecimalunsigned:
|
||||
m_precision = 10;
|
||||
m_scale = 0;
|
||||
m_length = 1;
|
||||
|
|
@ -1176,7 +1177,8 @@ columnTypeMapping[] = {
|
|||
{ DictTabInfo::ExtBigunsigned, NdbDictionary::Column::Bigunsigned },
|
||||
{ DictTabInfo::ExtFloat, NdbDictionary::Column::Float },
|
||||
{ DictTabInfo::ExtDouble, NdbDictionary::Column::Double },
|
||||
{ DictTabInfo::ExtDecimal, NdbDictionary::Column::Decimal },
|
||||
{ DictTabInfo::ExtOlddecimal, NdbDictionary::Column::Olddecimal },
|
||||
{ DictTabInfo::ExtOlddecimalunsigned, NdbDictionary::Column::Olddecimalunsigned },
|
||||
{ DictTabInfo::ExtChar, NdbDictionary::Column::Char },
|
||||
{ DictTabInfo::ExtVarchar, NdbDictionary::Column::Varchar },
|
||||
{ DictTabInfo::ExtBinary, NdbDictionary::Column::Binary },
|
||||
|
|
|
|||
|
|
@ -156,7 +156,8 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r)
|
|||
return out;
|
||||
}
|
||||
|
||||
uint length = r.getColumn()->getLength();
|
||||
const NdbDictionary::Column* c = r.getColumn();
|
||||
uint length = c->getLength();
|
||||
if (length > 1)
|
||||
out << "[";
|
||||
|
||||
|
|
@ -208,6 +209,18 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r)
|
|||
case NdbDictionary::Column::Double:
|
||||
out << r.double_value();
|
||||
break;
|
||||
case NdbDictionary::Column::Olddecimal:
|
||||
{
|
||||
short len = 1 + c->getPrecision() + (c->getScale() > 0);
|
||||
out.print("%.*s", len, r.aRef());
|
||||
}
|
||||
break;
|
||||
case NdbDictionary::Column::Olddecimalunsigned:
|
||||
{
|
||||
short len = 0 + c->getPrecision() + (c->getScale() > 0);
|
||||
out.print("%.*s", len, r.aRef());
|
||||
}
|
||||
break;
|
||||
// for dates cut-and-paste from field.cc
|
||||
case NdbDictionary::Column::Datetime:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -567,7 +567,8 @@ convertColumnTypeToAttrType(NdbDictionary::Column::Type _type)
|
|||
case NdbDictionary::Column::Unsigned:
|
||||
return UnSigned;
|
||||
case NdbDictionary::Column::Float:
|
||||
case NdbDictionary::Column::Decimal:
|
||||
case NdbDictionary::Column::Olddecimal:
|
||||
case NdbDictionary::Column::Olddecimalunsigned:
|
||||
case NdbDictionary::Column::Double:
|
||||
return Float;
|
||||
case NdbDictionary::Column::Char:
|
||||
|
|
|
|||
|
|
@ -44,9 +44,12 @@ BackupConsumer::create_table_string(const TableS & table,
|
|||
case NdbDictionary::Column::Float:
|
||||
pos += sprintf(buf+pos, "%s", "float");
|
||||
break;
|
||||
case NdbDictionary::Column::Decimal:
|
||||
case NdbDictionary::Column::Olddecimal:
|
||||
pos += sprintf(buf+pos, "%s", "decimal");
|
||||
break;
|
||||
case NdbDictionary::Column::Olddecimalunsigned:
|
||||
pos += sprintf(buf+pos, "%s", "decimal unsigned");
|
||||
break;
|
||||
case NdbDictionary::Column::Char:
|
||||
pos += sprintf(buf+pos, "%s", "char");
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -472,7 +472,7 @@ innobase_mysql_tmpfile(void)
|
|||
{
|
||||
char filename[FN_REFLEN];
|
||||
int fd2 = -1;
|
||||
File fd = create_temp_file(filename, NullS, "ib",
|
||||
File fd = create_temp_file(filename, mysql_tmpdir, "ib",
|
||||
#ifdef __WIN__
|
||||
O_BINARY | O_TRUNC | O_SEQUENTIAL |
|
||||
O_TEMPORARY | O_SHORT_LIVED |
|
||||
|
|
|
|||
|
|
@ -2276,10 +2276,14 @@ void ha_ndbcluster::print_results()
|
|||
fprintf(DBUG_FILE, "Double\t%f", value);
|
||||
break;
|
||||
}
|
||||
case NdbDictionary::Column::Decimal: {
|
||||
case NdbDictionary::Column::Olddecimal: {
|
||||
char *value= field->ptr;
|
||||
|
||||
fprintf(DBUG_FILE, "Decimal\t'%-*s'", field->pack_length(), value);
|
||||
fprintf(DBUG_FILE, "Olddecimal\t'%-*s'", field->pack_length(), value);
|
||||
break;
|
||||
}
|
||||
case NdbDictionary::Column::Olddecimalunsigned: {
|
||||
char *value= field->ptr;
|
||||
fprintf(DBUG_FILE, "Olddecimalunsigned\t'%-*s'", field->pack_length(), value);
|
||||
break;
|
||||
}
|
||||
case NdbDictionary::Column::Char:{
|
||||
|
|
@ -3312,10 +3316,6 @@ static int create_ndb_column(NDBCOL &col,
|
|||
const enum enum_field_types mysql_type= field->real_type();
|
||||
switch (mysql_type) {
|
||||
// Numeric types
|
||||
case MYSQL_TYPE_DECIMAL:
|
||||
col.setType(NDBCOL::Char);
|
||||
col.setLength(field->pack_length());
|
||||
break;
|
||||
case MYSQL_TYPE_TINY:
|
||||
if (field->flags & UNSIGNED_FLAG)
|
||||
col.setType(NDBCOL::Tinyunsigned);
|
||||
|
|
@ -3359,6 +3359,26 @@ static int create_ndb_column(NDBCOL &col,
|
|||
col.setType(NDBCOL::Double);
|
||||
col.setLength(1);
|
||||
break;
|
||||
case MYSQL_TYPE_DECIMAL:
|
||||
{
|
||||
Field_decimal *f= (Field_decimal*)field;
|
||||
uint precision= f->pack_length();
|
||||
uint scale= f->decimals();
|
||||
if (field->flags & UNSIGNED_FLAG)
|
||||
{
|
||||
col.setType(NDBCOL::Olddecimalunsigned);
|
||||
precision-= (scale > 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
col.setType(NDBCOL::Olddecimal);
|
||||
precision-= 1 + (scale > 0);
|
||||
}
|
||||
col.setPrecision(precision);
|
||||
col.setScale(scale);
|
||||
col.setLength(1);
|
||||
}
|
||||
break;
|
||||
// Date types
|
||||
case MYSQL_TYPE_DATETIME:
|
||||
col.setType(NDBCOL::Datetime);
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ public:
|
|||
static void *operator new(size_t size, MEM_ROOT *mem_root)
|
||||
{ return (void*) alloc_root(mem_root, (uint) size); }
|
||||
static void operator delete(void *ptr,size_t size) {}
|
||||
static void operator delete(void *ptr,size_t size, MEM_ROOT *mem_root) {}
|
||||
static void operator delete(void *ptr, MEM_ROOT *mem_root) {}
|
||||
|
||||
enum Type {FIELD_ITEM, FUNC_ITEM, SUM_FUNC_ITEM, STRING_ITEM,
|
||||
INT_ITEM, REAL_ITEM, NULL_ITEM, VARBIN_ITEM,
|
||||
|
|
|
|||
|
|
@ -1645,7 +1645,8 @@ String *Item_func_format::val_str(String *str)
|
|||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
double nr =args[0]->val();
|
||||
uint32 diff,length,str_length;
|
||||
int diff;
|
||||
uint32 length, str_length;
|
||||
uint dec;
|
||||
if ((null_value=args[0]->null_value))
|
||||
return 0; /* purecov: inspected */
|
||||
|
|
@ -1670,9 +1671,12 @@ String *Item_func_format::val_str(String *str)
|
|||
pos[0]= pos[-(int) diff];
|
||||
while (diff)
|
||||
{
|
||||
pos[0]=pos[-(int) diff]; pos--;
|
||||
pos[0]=pos[-(int) diff]; pos--;
|
||||
pos[0]=pos[-(int) diff]; pos--;
|
||||
*pos= *(pos - diff);
|
||||
pos--;
|
||||
*pos= *(pos - diff);
|
||||
pos--;
|
||||
*pos= *(pos - diff);
|
||||
pos--;
|
||||
pos[0]=',';
|
||||
pos--;
|
||||
diff--;
|
||||
|
|
|
|||
|
|
@ -485,58 +485,62 @@ void close_temporary(TABLE *table,bool delete_table)
|
|||
void close_temporary_tables(THD *thd)
|
||||
{
|
||||
TABLE *table,*next;
|
||||
char *query, *name_in_query, *end;
|
||||
uint greatest_key_length= 0;
|
||||
char *query, *end;
|
||||
uint query_buf_size;
|
||||
bool found_user_tables = 0;
|
||||
|
||||
if (!thd->temporary_tables)
|
||||
return;
|
||||
|
||||
/*
|
||||
We write a DROP TEMPORARY TABLE for each temp table left, so that our
|
||||
replication slave can clean them up. Not one multi-table DROP TABLE binlog
|
||||
event: this would cause problems if slave uses --replicate-*-table.
|
||||
*/
|
||||
LINT_INIT(end);
|
||||
query_buf_size= 50; // Enough for DROP ... TABLE IF EXISTS
|
||||
|
||||
/* We'll re-use always same buffer so make it big enough for longest name */
|
||||
for (table=thd->temporary_tables ; table ; table=table->next)
|
||||
greatest_key_length= max(greatest_key_length, table->key_length);
|
||||
/*
|
||||
We are going to add 4 ` around the db/table names, so 1 does not look
|
||||
enough; indeed it is enough, because table->key_length is greater (by 8,
|
||||
because of server_id and thread_id) than db||table.
|
||||
*/
|
||||
query_buf_size+= table->key_length+1;
|
||||
|
||||
if ((query = alloc_root(thd->mem_root, greatest_key_length+50)))
|
||||
if ((query = alloc_root(thd->mem_root, query_buf_size)))
|
||||
// Better add "if exists", in case a RESET MASTER has been done
|
||||
name_in_query= strmov(query, "DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `");
|
||||
end=strmov(query, "DROP /*!40005 TEMPORARY */ TABLE IF EXISTS ");
|
||||
|
||||
for (table=thd->temporary_tables ; table ; table=next)
|
||||
{
|
||||
/*
|
||||
In we are OOM for 'query' this is not fatal. We skip temporary tables
|
||||
not created directly by the user.
|
||||
*/
|
||||
if (query && mysql_bin_log.is_open() && (table->real_name[0] != '#'))
|
||||
if (query) // we might be out of memory, but this is not fatal
|
||||
{
|
||||
// skip temporary tables not created directly by the user
|
||||
if (table->real_name[0] != '#')
|
||||
found_user_tables = 1;
|
||||
/*
|
||||
Here we assume table_cache_key always starts
|
||||
with \0 terminated db name
|
||||
*/
|
||||
end = strxmov(name_in_query, table->table_cache_key, "`.`",
|
||||
table->real_name, "`", NullS);
|
||||
Query_log_event qinfo(thd, query, (ulong)(end-query), 0, FALSE);
|
||||
/*
|
||||
Imagine the thread had created a temp table, then was doing a SELECT, and
|
||||
the SELECT was killed. Then it's not clever to mark the statement above as
|
||||
"killed", because it's not really a statement updating data, and there
|
||||
are 99.99% chances it will succeed on slave. And, if thread is
|
||||
killed now, it's not clever either.
|
||||
If a real update (one updating a persistent table) was killed on the
|
||||
master, then this real update will be logged with error_code=killed,
|
||||
rightfully causing the slave to stop.
|
||||
*/
|
||||
qinfo.error_code= 0;
|
||||
mysql_bin_log.write(&qinfo);
|
||||
end = strxmov(end,"`",table->table_cache_key,"`.`",
|
||||
table->real_name,"`,", NullS);
|
||||
}
|
||||
next=table->next;
|
||||
close_temporary(table);
|
||||
}
|
||||
if (query && found_user_tables && mysql_bin_log.is_open())
|
||||
{
|
||||
/* The -1 is to remove last ',' */
|
||||
thd->clear_error();
|
||||
Query_log_event qinfo(thd, query, (ulong)(end-query)-1, 0, FALSE);
|
||||
/*
|
||||
Imagine the thread had created a temp table, then was doing a SELECT, and
|
||||
the SELECT was killed. Then it's not clever to mark the statement above as
|
||||
"killed", because it's not really a statement updating data, and there
|
||||
are 99.99% chances it will succeed on slave.
|
||||
If a real update (one updating a persistent table) was killed on the
|
||||
master, then this real update will be logged with error_code=killed,
|
||||
rightfully causing the slave to stop.
|
||||
*/
|
||||
qinfo.error_code= 0;
|
||||
mysql_bin_log.write(&qinfo);
|
||||
}
|
||||
thd->temporary_tables=0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -707,6 +707,8 @@ struct Item_change_record: public ilink
|
|||
Item *old_value;
|
||||
/* Placement new was hidden by `new' in ilink (TODO: check): */
|
||||
static void *operator new(size_t size, void *mem) { return mem; }
|
||||
static void operator delete(void *ptr, size_t size) {}
|
||||
static void operator delete(void *ptr, void *mem) { /* never called */ }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1295,7 +1295,11 @@ public:
|
|||
|
||||
#include <myisam.h>
|
||||
|
||||
/* Param to create temporary tables when doing SELECT:s */
|
||||
/*
|
||||
Param to create temporary tables when doing SELECT:s
|
||||
NOTE
|
||||
This structure is copied using memcpy as a part of JOIN.
|
||||
*/
|
||||
|
||||
class TMP_TABLE_PARAM :public Sql_alloc
|
||||
{
|
||||
|
|
@ -1307,7 +1311,6 @@ private:
|
|||
public:
|
||||
List<Item> copy_funcs;
|
||||
List<Item> save_copy_funcs;
|
||||
List_iterator_fast<Item> copy_funcs_it;
|
||||
Copy_field *copy_field, *copy_field_end;
|
||||
Copy_field *save_copy_field, *save_copy_field_end;
|
||||
byte *group_buff;
|
||||
|
|
@ -1324,7 +1327,7 @@ public:
|
|||
uint convert_blob_length;
|
||||
|
||||
TMP_TABLE_PARAM()
|
||||
:copy_funcs_it(copy_funcs), copy_field(0), group_parts(0),
|
||||
:copy_field(0), group_parts(0),
|
||||
group_length(0), group_null_parts(0), convert_blob_length(0)
|
||||
{}
|
||||
~TMP_TABLE_PARAM()
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
|
|||
|
||||
bzero((char*) &tables,sizeof(tables));
|
||||
tables.table = table;
|
||||
tables.alias = table_list->alias;
|
||||
|
||||
table->sort.io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE),
|
||||
MYF(MY_FAE | MY_ZEROFILL));
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ public:
|
|||
static void *operator new(size_t size, MEM_ROOT *mem_root)
|
||||
{ return (void*) alloc_root(mem_root, (uint) size); }
|
||||
static void operator delete(void *ptr,size_t size) {}
|
||||
static void operator delete(void *ptr,size_t size, MEM_ROOT *mem_root) {}
|
||||
static void operator delete(void *ptr, MEM_ROOT *mem_root) {}
|
||||
st_select_lex_node(): linkage(UNSPECIFIED_TYPE) {}
|
||||
virtual ~st_select_lex_node() {}
|
||||
inline st_select_lex_node* get_master() { return master; }
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ public:
|
|||
static void *operator new(size_t size, MEM_ROOT *mem_root)
|
||||
{ return (void*) alloc_root(mem_root, (uint) size); }
|
||||
static void operator delete(void *ptr, size_t size) { TRASH(ptr, size); }
|
||||
static void operator delete(void *ptr, size_t size, MEM_ROOT *mem_root)
|
||||
{ TRASH(ptr, size); }
|
||||
static void operator delete(void *ptr, MEM_ROOT *mem_root)
|
||||
{ /* never called */ }
|
||||
static void operator delete[](void *ptr, size_t size) { TRASH(ptr, size); }
|
||||
#ifdef HAVE_purify
|
||||
bool dummy;
|
||||
|
|
|
|||
|
|
@ -656,12 +656,12 @@ static int check_connection(THD *thd)
|
|||
{
|
||||
uint connect_errors= 0;
|
||||
NET *net= &thd->net;
|
||||
ulong pkt_len= 0;
|
||||
char *end;
|
||||
|
||||
DBUG_PRINT("info",
|
||||
("New connection received on %s", vio_description(net->vio)));
|
||||
|
||||
vio_in_addr(net->vio,&thd->remote.sin_addr);
|
||||
|
||||
if (!thd->host) // If TCP/IP connection
|
||||
{
|
||||
char ip[30];
|
||||
|
|
@ -671,6 +671,7 @@ static int check_connection(THD *thd)
|
|||
if (!(thd->ip= my_strdup(ip,MYF(0))))
|
||||
return (ER_OUT_OF_RESOURCES);
|
||||
thd->host_or_ip= thd->ip;
|
||||
vio_in_addr(net->vio,&thd->remote.sin_addr);
|
||||
#if !defined(HAVE_SYS_UN_H) || defined(HAVE_mit_thread)
|
||||
/* Fast local hostname resolve for Win32 */
|
||||
if (!strcmp(thd->ip,"127.0.0.1"))
|
||||
|
|
@ -706,10 +707,10 @@ static int check_connection(THD *thd)
|
|||
DBUG_PRINT("info",("Host: %s",thd->host));
|
||||
thd->host_or_ip= thd->host;
|
||||
thd->ip= 0;
|
||||
/* Reset sin_addr */
|
||||
bzero((char*) &thd->remote, sizeof(thd->remote));
|
||||
}
|
||||
vio_keepalive(net->vio, TRUE);
|
||||
ulong pkt_len= 0;
|
||||
char *end;
|
||||
{
|
||||
/* buff[] needs to big enough to hold the server_version variable */
|
||||
char buff[SERVER_VERSION_LENGTH + SCRAMBLE_LENGTH + 64];
|
||||
|
|
@ -1472,6 +1473,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||
{
|
||||
if (alloc_query(thd, packet, packet_length))
|
||||
break; // fatal error is set
|
||||
char *packet_end= thd->query + thd->query_length;
|
||||
mysql_log.write(thd,command,"%s",thd->query);
|
||||
DBUG_PRINT("query",("%-.4096s",thd->query));
|
||||
mysql_parse(thd,thd->query, thd->query_length);
|
||||
|
|
@ -1487,7 +1489,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||
if (thd->lock || thd->open_tables || thd->derived_tables)
|
||||
close_thread_tables(thd);
|
||||
#endif
|
||||
ulong length= thd->query_length-(ulong)(packet-thd->query);
|
||||
ulong length= (ulong)(packet_end-packet);
|
||||
|
||||
/* Remove garbage at start of query */
|
||||
while (my_isspace(thd->charset(), *packet) && length > 0)
|
||||
|
|
@ -1924,9 +1926,14 @@ mysql_execute_command(THD *thd)
|
|||
}
|
||||
/*
|
||||
Skip if we are in the slave thread, some table rules have been
|
||||
given and the table list says the query should not be replicated
|
||||
given and the table list says the query should not be replicated.
|
||||
Exception is DROP TEMPORARY TABLE IF EXISTS: we always execute it
|
||||
(otherwise we have stale files on slave caused by exclusion of one tmp
|
||||
table).
|
||||
*/
|
||||
if (all_tables_not_ok(thd,tables))
|
||||
if (!(lex->sql_command == SQLCOM_DROP_TABLE &&
|
||||
lex->drop_temporary && lex->drop_if_exists) &&
|
||||
all_tables_not_ok(thd,tables))
|
||||
{
|
||||
/* we warn the slave SQL thread */
|
||||
my_error(ER_SLAVE_IGNORED_TABLE, MYF(0));
|
||||
|
|
@ -4118,6 +4125,20 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
|
|||
send_error(thd, 0, NullS);
|
||||
else
|
||||
{
|
||||
/*
|
||||
Binlog logs a string starting from thd->query and having length
|
||||
thd->query_length; so we set thd->query_length correctly (to not
|
||||
log several statements in one event, when we executed only first).
|
||||
We set it to not see the ';' (otherwise it would get into binlog
|
||||
and Query_log_event::print() would give ';;' output).
|
||||
This also helps display only the current query in SHOW
|
||||
PROCESSLIST.
|
||||
Note that we don't need LOCK_thread_count to modify query_length.
|
||||
*/
|
||||
if (lex->found_colon &&
|
||||
(thd->query_length= (ulong)(lex->found_colon - thd->query)))
|
||||
thd->query_length--;
|
||||
/* Actually execute the query */
|
||||
mysql_execute_command(thd);
|
||||
query_cache_end_of_result(thd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8614,8 +8614,7 @@ copy_fields(TMP_TABLE_PARAM *param)
|
|||
for (; ptr != end; ptr++)
|
||||
(*ptr->do_copy)(ptr);
|
||||
|
||||
List_iterator_fast<Item> &it=param->copy_funcs_it;
|
||||
it.rewind();
|
||||
List_iterator_fast<Item> it(param->copy_funcs);
|
||||
Item_copy_string *item;
|
||||
while ((item = (Item_copy_string*) it++))
|
||||
item->copy();
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public:
|
|||
{ return (void*) alloc_root(mem_root, (uint) size); }
|
||||
static void operator delete(void *ptr_arg,size_t size)
|
||||
{}
|
||||
static void operator delete(void *ptr_arg,size_t size, MEM_ROOT *mem_root)
|
||||
static void operator delete(void *ptr_arg, MEM_ROOT *mem_root)
|
||||
{}
|
||||
~String() { free(); }
|
||||
|
||||
|
|
|
|||
|
|
@ -272,6 +272,18 @@ my_bool vio_peer_addr(Vio * vio, char *buf, uint16 *port)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
Get in_addr for a TCP/IP connection
|
||||
|
||||
SYNOPSIS
|
||||
vio_in_addr()
|
||||
vio vio handle
|
||||
in put in_addr here
|
||||
|
||||
NOTES
|
||||
one must call vio_peer_addr() before calling this one
|
||||
*/
|
||||
|
||||
void vio_in_addr(Vio *vio, struct in_addr *in)
|
||||
{
|
||||
DBUG_ENTER("vio_in_addr");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue