Commit 149d9e2f authored by unknown's avatar unknown
Browse files

Merge mskold@bk-internal.mysql.com:/home/bk/mysql-4.1-ndb

into mysql.com:/usr/local/home/marty/MySQL/mysql-4.1-ndb


ndb/src/ndbapi/NdbConnection.cpp:
  Auto merged
parents b368cb3f 939db862
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
drop database if exists test2;
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
attr1 INT NOT NULL,
@@ -349,3 +350,30 @@ select * from t7;
adress	a	b	c
No adress	8	NULL	12
drop table t7;
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
attr1 INT NOT NULL,
attr2 INT,
attr3 VARCHAR(10)
) ENGINE=ndbcluster;
INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413');
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 select pk1,attr1,attr2 from test.t1;
select * from t2 order by a;
a	b	c
9410	9412	NULL
9411	9413	17
select b from test.t1, t2 where c = test.t1.attr2;
b
9413
select b,test.t1.attr1 from test.t1, t2 where test.t1.pk1 < a;
b	attr1
9413	9412
drop table test.t1, t2;
drop database test2;
+49 −0
Original line number Diff line number Diff line
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
drop database if exists test2;
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
attr1 INT NOT NULL
@@ -206,3 +207,51 @@ begin;
drop table t2;
drop table t3;
drop table t4;
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
attr1 INT NOT NULL
) ENGINE=ndbcluster;
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;
begin;
insert into test.t1 values(1,1);
insert into t2 values(1,1,1);
insert into test.t1 values(2,2);
insert into t2 values(2,2,2);
select count(*) from test.t1;
count(*)
2
select count(*) from t2;
count(*)
2
select * from test.t1 where pk1 = 1;
pk1	attr1
1	1
select * from t2 where a = 1;
a	b	c
1	1	1
select test.t1.attr1 
from test.t1, test.t1 as t1x where test.t1.pk1 = t1x.pk1 + 1;
attr1
2
select t2.a 
from t2, t2 as t2x where t2.a = t2x.a + 1;
a
2
select test.t1.pk1, a from test.t1,t2 where b > test.t1.attr1;
pk1	a
1	2
rollback;
select count(*) from test.t1;
count(*)
0
select count(*) from t2;
count(*)
0
drop table test.t1, t2;
drop database test2;
+34 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

--disable_warnings
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
drop database if exists test2;
--enable_warnings

#
@@ -319,3 +320,36 @@ delete from t7 where b=23;
select * from t7;

drop table t7;

#
# Test multiple databases in one statement
#

CREATE TABLE t1 (
  pk1 INT NOT NULL PRIMARY KEY,
  attr1 INT NOT NULL,
  attr2 INT,
  attr3 VARCHAR(10)
) ENGINE=ndbcluster;

INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413');

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 select pk1,attr1,attr2 from test.t1;
select * from t2 order by a;
select b from test.t1, t2 where c = test.t1.attr2;
select b,test.t1.attr1 from test.t1, t2 where test.t1.pk1 < a;
 
drop table test.t1, t2;

drop database test2;

+43 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

--disable_warnings
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
drop database if exists test2;
--enable_warnings

#
@@ -253,3 +254,45 @@ drop table t2;
drop table t3;
drop table t4;

#
# Test multiple databases in one transaction
#

CREATE TABLE t1 (
  pk1 INT NOT NULL PRIMARY KEY,
  attr1 INT NOT NULL
) ENGINE=ndbcluster;

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;

begin;
insert into test.t1 values(1,1);
insert into t2 values(1,1,1);
insert into test.t1 values(2,2);
insert into t2 values(2,2,2);
select count(*) from test.t1;
select count(*) from t2;
select * from test.t1 where pk1 = 1;
select * from t2 where a = 1;
select test.t1.attr1 
from test.t1, test.t1 as t1x where test.t1.pk1 = t1x.pk1 + 1;
select t2.a 
from t2, t2 as t2x where t2.a = t2x.a + 1;
select test.t1.pk1, a from test.t1,t2 where b > test.t1.attr1;
rollback;

select count(*) from test.t1;
select count(*) from t2;

drop table test.t1, t2;

drop database test2;

+5 −0
Original line number Diff line number Diff line
@@ -1416,9 +1416,14 @@ public:
   */
  Uint64 getAutoIncrementValue(const char* aTableName, 
			       Uint32 cacheSize = 1);
  Uint64 getAutoIncrementValue(NdbDictionary::Table * aTable, 
			       Uint32 cacheSize = 1);
  Uint64 readAutoIncrementValue(const char* aTableName);
  Uint64 readAutoIncrementValue(NdbDictionary::Table * aTable);
  bool setAutoIncrementValue(const char* aTableName, Uint64 val, 
			     bool increase = false);
  bool setAutoIncrementValue(NdbDictionary::Table * aTable, Uint64 val, 
			     bool increase = false);
  Uint64 getTupleIdFromNdb(const char* aTableName, 
			   Uint32 cacheSize = 1000);
  Uint64 getTupleIdFromNdb(Uint32 aTableId, 
Loading