Commit b41b4530 authored by unknown's avatar unknown
Browse files

Merge poseidon.ndb.mysql.com:/home/tomas/mysql-4.1

into poseidon.ndb.mysql.com:/home/tomas/mysql-4.1-ndb

parents 33db6350 727f7a85
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -974,8 +974,11 @@ case $SYSTEM_TYPE-$MACHINE_TYPE-$ac_cv_prog_gcc in
    CFLAGS="$CFLAGS -DBIG_TABLES"
    CXXFLAGS="$CXXFLAGS -DBIG_TABLES"
    ;;
  *) ;;
esac
case $SYSTEM_TYPE-$ac_cv_prog_gcc in
# workaround for Sun Forte compile problem for ndb
  *solaris2.*-no)
  *solaris*-no)
    ndb_cxxflags_fix="$ndb_cxxflags_fix -instances=static"
    ;;
  *) ;;
+0 −17
Original line number Diff line number Diff line
@@ -642,23 +642,6 @@ typedef struct st_mysql_methods
#endif
} MYSQL_METHODS;

#ifdef HAVE_DEPRECATED_411_API
/* Deprecated calls (since MySQL 4.1.2) */

/* Use mysql_stmt_init + mysql_stmt_prepare instead */
MYSQL_STMT * STDCALL mysql_prepare(MYSQL * mysql, const char *query,
				   unsigned long length);
#define mysql_execute mysql_stmt_execute
#define mysql_fetch mysql_stmt_fetch
#define mysql_fetch_column mysql_stmt_fetch_column
#define mysql_bind_param mysql_stmt_bind_param
#define mysql_bind_result mysql_stmt_bind_result
#define mysql_param_count mysql_stmt_param_count
#define mysql_param_result mysql_stmt_param_metadata
#define mysql_get_metadata mysql_stmt_result_metadata
#define mysql_send_long_data mysql_stmt_send_long_data

#endif /* HAVE_DEPRECATED_411_API */

MYSQL_STMT * STDCALL mysql_stmt_init(MYSQL *mysql);
int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query,
+0 −16
Original line number Diff line number Diff line
@@ -1886,22 +1886,6 @@ my_bool cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
  DBUG_RETURN(0);
}

#ifdef HAVE_DEPRECATED_411_API
MYSQL_STMT * STDCALL mysql_prepare(MYSQL *mysql, const char *query,
                                   unsigned long query_length)
{
  MYSQL_STMT *stmt;
  DBUG_ENTER("mysql_prepare");

  stmt= mysql_stmt_init(mysql);
  if (stmt && mysql_stmt_prepare(stmt, query, query_length))
  {
    mysql_stmt_close(stmt);
    DBUG_RETURN(0);
  }
  DBUG_RETURN(stmt);
}
#endif

/*
  Allocate memory and init prepared statement structure.
+163 −106
Original line number Diff line number Diff line
drop table if exists t1;
drop database if exists mysqltest;
create table t1 (
a int not null primary key,
b tinytext
) engine=ndbcluster;
insert into t1 values(1, 'x');
update t1 set b = 'y';
select * from t1;
a	b
1	y
delete from t1;
drop table t1;
create table t1 (
a int not null primary key,
b text not null
) engine=ndbcluster;
insert into t1 values(1, '');
select * from t1;
a	b
1	
drop table t1;
drop database if exists test2;
set autocommit=0;
create table t1 (
a int not null primary key,
@@ -102,6 +82,53 @@ commit;
select count(*) from t1;
count(*)
0
replace t1 set a=1,b=@b1,c=111,d=@d1;
replace t1 set a=2,b=@b2,c=222,d=@d2;
commit;
explain select * from t1 where a = 1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	const	PRIMARY	PRIMARY	4	const	1	
select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
from t1 where a=1;
a	length(b)	substr(b,1+2*900,2)	length(d)	substr(d,1+3*900,3)
1	2256	b1	3000	dd1
select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
from t1 where a=2;
a	length(b)	substr(b,1+2*9000,2)	length(d)	substr(d,1+3*9000,3)
2	20000	b2	30000	dd2
replace t1 set a=1,b=@b2,c=111,d=@d2;
replace t1 set a=2,b=@b1,c=222,d=@d1;
commit;
select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
from t1 where a=1;
a	length(b)	substr(b,1+2*9000,2)	length(d)	substr(d,1+3*9000,3)
1	20000	b2	30000	dd2
select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
from t1 where a=2;
a	length(b)	substr(b,1+2*900,2)	length(d)	substr(d,1+3*900,3)
2	2256	b1	3000	dd1
replace t1 set a=1,b=concat(@b2,@b2),c=111,d=concat(@d2,@d2);
replace t1 set a=2,b=concat(@b1,@b1),c=222,d=concat(@d1,@d1);
commit;
select a,length(b),substr(b,1+4*9000,2),length(d),substr(d,1+6*9000,3)
from t1 where a=1;
a	length(b)	substr(b,1+4*9000,2)	length(d)	substr(d,1+6*9000,3)
1	40000	b2	60000	dd2
select a,length(b),substr(b,1+4*900,2),length(d),substr(d,1+6*900,3)
from t1 where a=2;
a	length(b)	substr(b,1+4*900,2)	length(d)	substr(d,1+6*900,3)
2	4512	b1	6000	dd1
replace t1 set a=1,b='xyz',c=111,d=null;
commit;
select a,b from t1 where d is null;
a	b
1	xyz
delete from t1 where a=1;
delete from t1 where a=2;
commit;
select count(*) from t1;
count(*)
0
insert into t1 values(1,@b1,111,@d1);
insert into t1 values(2,@b2,222,@d2);
commit;
@@ -241,90 +268,6 @@ a b c d
7	7xb7	777	7xdd7
8	8xb8	888	8xdd8
9	9xb9	999	9xdd9
select * from t1 order by a;
a	b	c	d
1	1xb1	111	1xdd1
2	2xb2	222	2xdd2
3	3xb3	333	3xdd3
4	4xb4	444	4xdd4
5	5xb5	555	5xdd5
6	6xb6	666	6xdd6
7	7xb7	777	7xdd7
8	8xb8	888	8xdd8
9	9xb9	999	9xdd9
alter table t1 add x int;
select * from t1 order by a;
a	b	c	d	x
1	1xb1	111	1xdd1	NULL
2	2xb2	222	2xdd2	NULL
3	3xb3	333	3xdd3	NULL
4	4xb4	444	4xdd4	NULL
5	5xb5	555	5xdd5	NULL
6	6xb6	666	6xdd6	NULL
7	7xb7	777	7xdd7	NULL
8	8xb8	888	8xdd8	NULL
9	9xb9	999	9xdd9	NULL
alter table t1 drop x;
select * from t1 order by a;
a	b	c	d
1	1xb1	111	1xdd1
2	2xb2	222	2xdd2
3	3xb3	333	3xdd3
4	4xb4	444	4xdd4
5	5xb5	555	5xdd5
6	6xb6	666	6xdd6
7	7xb7	777	7xdd7
8	8xb8	888	8xdd8
9	9xb9	999	9xdd9
create database mysqltest;
use mysqltest;
CREATE TABLE t2 (
a bigint unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned
) engine=ndbcluster;
insert into t2 values (1,1,1),(2,2,2);
select * from test.t1,t2 where test.t1.a = t2.a order by test.t1.a;
a	b	c	d	a	b	c
1	1xb1	111	1xdd1	1	1	1
2	2xb2	222	2xdd2	2	2	2
drop table t2;
use test;
select * from t1 order by a;
a	b	c	d
1	1xb1	111	1xdd1
2	2xb2	222	2xdd2
3	3xb3	333	3xdd3
4	4xb4	444	4xdd4
5	5xb5	555	5xdd5
6	6xb6	666	6xdd6
7	7xb7	777	7xdd7
8	8xb8	888	8xdd8
9	9xb9	999	9xdd9
alter table t1 add x int;
select * from t1 order by a;
a	b	c	d	x
1	1xb1	111	1xdd1	NULL
2	2xb2	222	2xdd2	NULL
3	3xb3	333	3xdd3	NULL
4	4xb4	444	4xdd4	NULL
5	5xb5	555	5xdd5	NULL
6	6xb6	666	6xdd6	NULL
7	7xb7	777	7xdd7	NULL
8	8xb8	888	8xdd8	NULL
9	9xb9	999	9xdd9	NULL
alter table t1 drop x;
select * from t1 order by a;
a	b	c	d
1	1xb1	111	1xdd1
2	2xb2	222	2xdd2
3	3xb3	333	3xdd3
4	4xb4	444	4xdd4
5	5xb5	555	5xdd5
6	6xb6	666	6xdd6
7	7xb7	777	7xdd7
8	8xb8	888	8xdd8
9	9xb9	999	9xdd9
delete from t1 where c >= 100;
commit;
select count(*) from t1;
@@ -375,8 +318,122 @@ rollback;
select count(*) from t1;
count(*)
0
insert into t1 values(1,'b1',111,'dd1');
insert into t1 values(2,'b2',222,'dd2');
insert into t1 values(3,'b3',333,'dd3');
insert into t1 values(4,'b4',444,'dd4');
insert into t1 values(5,'b5',555,'dd5');
insert into t1 values(6,'b6',666,'dd6');
insert into t1 values(7,'b7',777,'dd7');
insert into t1 values(8,'b8',888,'dd8');
insert into t1 values(9,'b9',999,'dd9');
commit;
select * from t1 order by a;
a	b	c	d
1	b1	111	dd1
2	b2	222	dd2
3	b3	333	dd3
4	b4	444	dd4
5	b5	555	dd5
6	b6	666	dd6
7	b7	777	dd7
8	b8	888	dd8
9	b9	999	dd9
alter table t1 add x int;
select * from t1 order by a;
a	b	c	d	x
1	b1	111	dd1	NULL
2	b2	222	dd2	NULL
3	b3	333	dd3	NULL
4	b4	444	dd4	NULL
5	b5	555	dd5	NULL
6	b6	666	dd6	NULL
7	b7	777	dd7	NULL
8	b8	888	dd8	NULL
9	b9	999	dd9	NULL
alter table t1 drop x;
select * from t1 order by a;
a	b	c	d
1	b1	111	dd1
2	b2	222	dd2
3	b3	333	dd3
4	b4	444	dd4
5	b5	555	dd5
6	b6	666	dd6
7	b7	777	dd7
8	b8	888	dd8
9	b9	999	dd9
create database test2;
use test2;
CREATE TABLE t2 (
a bigint unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned
) engine=ndbcluster;
insert into t2 values (1,1,1),(2,2,2);
select * from test.t1,t2 where test.t1.a = t2.a order by test.t1.a;
a	b	c	d	a	b	c
1	b1	111	dd1	1	1	1
2	b2	222	dd2	2	2	2
drop table t2;
use test;
select * from t1 order by a;
a	b	c	d
1	b1	111	dd1
2	b2	222	dd2
3	b3	333	dd3
4	b4	444	dd4
5	b5	555	dd5
6	b6	666	dd6
7	b7	777	dd7
8	b8	888	dd8
9	b9	999	dd9
alter table t1 add x int;
select * from t1 order by a;
a	b	c	d	x
1	b1	111	dd1	NULL
2	b2	222	dd2	NULL
3	b3	333	dd3	NULL
4	b4	444	dd4	NULL
5	b5	555	dd5	NULL
6	b6	666	dd6	NULL
7	b7	777	dd7	NULL
8	b8	888	dd8	NULL
9	b9	999	dd9	NULL
alter table t1 drop x;
select * from t1 order by a;
a	b	c	d
1	b1	111	dd1
2	b2	222	dd2
3	b3	333	dd3
4	b4	444	dd4
5	b5	555	dd5
6	b6	666	dd6
7	b7	777	dd7
8	b8	888	dd8
9	b9	999	dd9
drop table t1;
drop database test2;
create table t1 (
a int not null primary key,
b tinytext
) engine=ndbcluster;
insert into t1 values(1, 'x');
update t1 set b = 'y';
select * from t1;
a	b
1	x
delete from t1;
drop table t1;
create table t1 (
a int not null primary key,
b text not null
) engine=ndbcluster;
insert into t1 values(1, '');
select * from t1;
a	b
1	
drop table t1;
drop database mysqltest;
set autocommit=1;
use test;
CREATE TABLE t1 (
+115 −63
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@

--disable_warnings
drop table if exists t1;
drop database if exists mysqltest;
drop database if exists test2;
--enable_warnings

#
@@ -12,31 +12,7 @@ drop database if exists mysqltest;
# A prerequisite for this handler test is that "testBlobs" succeeds.
#

# -- bug-5252 tinytext crashes --

create table t1 (
  a int not null primary key,
  b tinytext
) engine=ndbcluster;

insert into t1 values(1, 'x');
update t1 set b = 'y';
select * from t1;
delete from t1;
drop table t1;

# -- bug-5013 insert empty string to text --

create table t1 (
  a int not null primary key,
  b text not null
) engine=ndbcluster;

insert into t1 values(1, '');
select * from t1;
drop table t1;

-- general test starts --
# -- general test starts --

# make test harder with autocommit off
set autocommit=0;
@@ -117,7 +93,6 @@ from t1 where a=2;
# pk update to null
update t1 set d=null where a=1;
commit;
# FIXME now fails at random due to weird mixup between the 2 rows
select a from t1 where d is null;

# pk delete
@@ -126,6 +101,49 @@ delete from t1 where a=2;
commit;
select count(*) from t1;

# -- replace ( bug-6018 ) --

# insert
replace t1 set a=1,b=@b1,c=111,d=@d1;
replace t1 set a=2,b=@b2,c=222,d=@d2;
commit;
explain select * from t1 where a = 1;

# pk read
select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
from t1 where a=1;
select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
from t1 where a=2;

# update
replace t1 set a=1,b=@b2,c=111,d=@d2;
replace t1 set a=2,b=@b1,c=222,d=@d1;
commit;
select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
from t1 where a=1;
select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
from t1 where a=2;

# update
replace t1 set a=1,b=concat(@b2,@b2),c=111,d=concat(@d2,@d2);
replace t1 set a=2,b=concat(@b1,@b1),c=222,d=concat(@d1,@d1);
commit;
select a,length(b),substr(b,1+4*9000,2),length(d),substr(d,1+6*9000,3)
from t1 where a=1;
select a,length(b),substr(b,1+4*900,2),length(d),substr(d,1+6*900,3)
from t1 where a=2;

# update to null
replace t1 set a=1,b='xyz',c=111,d=null;
commit;
select a,b from t1 where d is null;

# pk delete
delete from t1 where a=1;
delete from t1 where a=2;
commit;
select count(*) from t1;

# -- hash index ops --

insert into t1 values(1,@b1,111,@d1);
@@ -231,39 +249,6 @@ where c >= 100;
commit;
select * from t1 where c >= 100 order by a;

# alter table

select * from t1 order by a;
alter table t1 add x int;
select * from t1 order by a;
alter table t1 drop x;
select * from t1 order by a;

# multi db

create database mysqltest;
use mysqltest;

CREATE TABLE t2 (
  a bigint unsigned NOT NULL PRIMARY KEY,
  b int unsigned not null,
  c int unsigned
) engine=ndbcluster;

insert into t2 values (1,1,1),(2,2,2);
select * from test.t1,t2 where test.t1.a = t2.a order by test.t1.a;

drop table t2;
use test;

# alter table

select * from t1 order by a;
alter table t1 add x int;
select * from t1 order by a;
alter table t1 drop x;
select * from t1 order by a;

# range scan delete
delete from t1 where c >= 100;
commit;
@@ -306,10 +291,77 @@ select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
from t1 order by a;
rollback;
select count(*) from t1;

# -- alter table and multi db --

insert into t1 values(1,'b1',111,'dd1');
insert into t1 values(2,'b2',222,'dd2');
insert into t1 values(3,'b3',333,'dd3');
insert into t1 values(4,'b4',444,'dd4');
insert into t1 values(5,'b5',555,'dd5');
insert into t1 values(6,'b6',666,'dd6');
insert into t1 values(7,'b7',777,'dd7');
insert into t1 values(8,'b8',888,'dd8');
insert into t1 values(9,'b9',999,'dd9');
commit;

select * from t1 order by a;
alter table t1 add x int;
select * from t1 order by a;
alter table t1 drop x;
select * from t1 order by a;

create database test2;
use test2;

CREATE TABLE t2 (
  a bigint unsigned NOT NULL PRIMARY KEY,
  b int unsigned not null,
  c int unsigned
) engine=ndbcluster;

insert into t2 values (1,1,1),(2,2,2);
select * from test.t1,t2 where test.t1.a = t2.a order by test.t1.a;

drop table t2;
use test;

select * from t1 order by a;
alter table t1 add x int;
select * from t1 order by a;
alter table t1 drop x;
select * from t1 order by a;

# -- end general test --

drop table t1;
drop database test2;

# -- bug-5252 tinytext crashes --

create table t1 (
  a int not null primary key,
  b tinytext
) engine=ndbcluster;

insert into t1 values(1, 'x');
update t1 set b = 'y';
select * from t1;
delete from t1;
drop table t1;

# -- bug-5013 insert empty string to text --

create table t1 (
  a int not null primary key,
  b text not null
) engine=ndbcluster;

insert into t1 values(1, '');
select * from t1;
drop table t1;
drop database mysqltest;

# bug #5349
# -- bug #5349 --
set autocommit=1;
use test;
CREATE TABLE t1 (
@@ -327,7 +379,7 @@ select * from t1 order by a;
alter table t1 engine=ndb;
select * from t1 order by a;

# bug #5872
# -- bug #5872 --
alter table t1 engine=myisam;
select * from t1 order by a;
drop table t1;
Loading