Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
69bf342a
Commit
69bf342a
authored
Jul 10, 2006
by
ingo/mydev@chilla.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge chilla.local:/home/mydev/mysql-5.1-amerge
into chilla.local:/home/mydev/mysql-5.1-aid
parents
4cdb1469
99a2489e
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
335 additions
and
194 deletions
+335
-194
mysql-test/r/federated.result
mysql-test/r/federated.result
+88
-1
mysql-test/t/federated.test
mysql-test/t/federated.test
+18
-14
sql/ha_federated.cc
sql/ha_federated.cc
+218
-176
sql/ha_federated.h
sql/ha_federated.h
+11
-3
No files found.
mysql-test/r/federated.result
View file @
69bf342a
...
...
@@ -1558,6 +1558,8 @@ id
3
4
5
DROP TABLE federated.t1;
DROP TABLE federated.t1;
DROP TABLE IF EXISTS federated.bug_17377_table;
CREATE TABLE federated.bug_17377_table (
`fld_cid` bigint(20) NOT NULL auto_increment,
...
...
@@ -1601,7 +1603,92 @@ fld_cid fld_name fld_parentid fld_delt
5 Torkel 0 0
DROP TABLE federated.t1;
DROP TABLE federated.bug_17377_table;
DROP TABLE federated.t1;
create table federated.t1 (i1 int, i2 int, i3 int);
create table federated.t2 (id int, c1 varchar(20), c2 varchar(20));
create table federated.t1 (i1 int, i2 int, i3 int) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
create table federated.t2 (id int, c1 varchar(20), c2 varchar(20)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t2';
insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2);
insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test");
select * from federated.t1 order by i1;
i1 i2 i3
1 5 10
2 2 2
3 7 12
4 5 2
9 10 15
select * from federated.t2;
id c1 c2
9 abc def
5 opq lmn
2 test t t test
update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id;
select * from federated.t1 order by i1;
i1 i2 i3
1 5 10
2 15 2
3 7 12
4 5 2
9 15 15
select * from federated.t2 order by id;
id c1 c2
2 test t ppc
5 opq lmn
9 abc ppc
delete federated.t1.*,federated.t2.* from federated.t1,federated.t2 where t1.i2=t2.id;
select * from federated.t1 order by i1;
i1 i2 i3
2 15 2
3 7 12
9 15 15
select * from federated.t2 order by id;
id c1 c2
2 test t ppc
9 abc ppc
drop table federated.t1, federated.t2;
drop table federated.t1, federated.t2;
create table federated.t1 (i1 int, i2 int, i3 int, primary key (i1));
create table federated.t2 (id int, c1 varchar(20), c2 varchar(20), primary key (id));
create table federated.t1 (i1 int auto_increment not null, i2 int, i3 int, primary key (i1)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
create table federated.t2 (id int auto_increment not null, c1 varchar(20), c2 varchar(20), primary key(id)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t2';
insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2);
insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test");
select * from federated.t1 order by i1;
i1 i2 i3
1 5 10
2 2 2
3 7 12
4 5 2
9 10 15
select * from federated.t2 order by id;
id c1 c2
2 test t t test
5 opq lmn
9 abc def
update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id;
select * from federated.t1 order by i1;
i1 i2 i3
1 5 10
2 15 2
3 7 12
4 5 2
9 15 15
select * from federated.t2 order by id;
id c1 c2
2 test t ppc
5 opq lmn
9 abc ppc
delete federated.t1.*,federated.t2.* from federated.t1,federated.t2 where t1.i2=t2.id;
select * from federated.t1 order by i1;
i1 i2 i3
2 15 2
3 7 12
9 15 15
select * from federated.t2 order by id;
id c1 c2
2 test t ppc
9 abc ppc
drop table federated.t1, federated.t2;
drop table federated.t1, federated.t2;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
DROP TABLE IF EXISTS federated.t1;
...
...
mysql-test/t/federated.test
View file @
69bf342a
...
...
@@ -1256,6 +1256,10 @@ SELECT LAST_INSERT_ID();
INSERT
INTO
federated
.
t1
VALUES
();
SELECT
LAST_INSERT_ID
();
SELECT
*
FROM
federated
.
t1
;
DROP
TABLE
federated
.
t1
;
connection
slave
;
DROP
TABLE
federated
.
t1
;
#
# Bug#17377 Federated Engine returns wrong Data, always the rows
...
...
@@ -1310,19 +1314,19 @@ select * from federated.t1 where fld_parentid=0 and fld_delt=0;
DROP
TABLE
federated
.
t1
;
connection
slave
;
DROP
TABLE
federated
.
bug_17377_table
;
DROP
TABLE
federated
.
t1
;
#
# Test multi updates and deletes without keys
# BUG 19773 Crash when using multi-table updates, deletes
# with federated tables
#
# The following can be enabled when bug #19773 has been fixed
--
disable_parsing
connection
slave
;
create
table
federated
.
t1
(
i1
int
,
i2
int
,
i3
int
);
create
table
federated
.
t2
(
id
int
,
c1
varchar
(
20
),
c2
varchar
(
20
));
connection
master
;
--
replace_result
$SLAVE_MYPORT
SLAVE_PORT
eval
create
table
federated
.
t1
(
i1
int
,
i2
int
,
i3
int
)
ENGINE
=
FEDERATED
CONNECTION
=
'mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'
;
--
replace_result
$SLAVE_MYPORT
SLAVE_PORT
eval
create
table
federated
.
t2
(
id
int
,
c1
varchar
(
20
),
c2
varchar
(
20
))
ENGINE
=
FEDERATED
CONNECTION
=
'mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2'
;
insert
into
federated
.
t1
values
(
1
,
5
,
10
),(
3
,
7
,
12
),(
4
,
5
,
2
),(
9
,
10
,
15
),(
2
,
2
,
2
);
insert
into
federated
.
t2
values
(
9
,
"abc"
,
"def"
),(
5
,
"opq"
,
"lmn"
),(
2
,
"test t"
,
"t test"
);
...
...
@@ -1331,22 +1335,23 @@ select * from federated.t2;
update
federated
.
t1
,
federated
.
t2
set
t1
.
i2
=
15
,
t2
.
c2
=
"ppc"
where
t1
.
i1
=
t2
.
id
;
select
*
from
federated
.
t1
order
by
i1
;
select
*
from
federated
.
t2
order
by
id
;
delete
t1
.*
,
t2
.*
from
federated
.
t1
,
federated
.
t2
where
t1
.
i2
=
t2
.
id
;
delete
federated
.
t1
.*
,
federated
.
t2
.*
from
federated
.
t1
,
federated
.
t2
where
t1
.
i2
=
t2
.
id
;
select
*
from
federated
.
t1
order
by
i1
;
select
*
from
federated
.
t2
order
by
id
;
drop
table
federated
.
t1
,
federated
.
t2
;
connection
slave
;
drop
table
federated
.
t1
,
federated
.
t2
;
connection
master
;
# Test multi updates and deletes with keys
connection
slave
;
create
table
federated
.
t1
(
i1
int
,
i2
int
,
i3
int
,
primary
key
(
i1
));
create
table
federated
.
t2
(
id
int
,
c1
varchar
(
20
),
c2
varchar
(
20
),
primary
key
(
id
));
connection
master
;
eval
create
table
federated
.
t1
(
i1
int
auto_increment
not
null
,
i2
int
,
i3
int
,
primary
key
(
i1
))
ENGINE
=
FEDERATED
ENGINE
=
FEDERATED
CONNECTION
=
'mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'
;
eval
create
table
federated
.
t2
(
id
int
auto_increment
not
null
,
c1
varchar
(
20
),
c2
varchar
(
20
),
primary
key
(
id
))
ENGINE
=
FEDERATED
ENGINE
=
FEDERATED
CONNECTION
=
'mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2'
;
--
replace_result
$SLAVE_MYPORT
SLAVE_PORT
eval
create
table
federated
.
t1
(
i1
int
auto_increment
not
null
,
i2
int
,
i3
int
,
primary
key
(
i1
))
ENGINE
=
FEDERATED
CONNECTION
=
'mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'
;
--
replace_result
$SLAVE_MYPORT
SLAVE_PORT
eval
create
table
federated
.
t2
(
id
int
auto_increment
not
null
,
c1
varchar
(
20
),
c2
varchar
(
20
),
primary
key
(
id
))
ENGINE
=
FEDERATED
CONNECTION
=
'mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2'
;
insert
into
federated
.
t1
values
(
1
,
5
,
10
),(
3
,
7
,
12
),(
4
,
5
,
2
),(
9
,
10
,
15
),(
2
,
2
,
2
);
insert
into
federated
.
t2
values
(
9
,
"abc"
,
"def"
),(
5
,
"opq"
,
"lmn"
),(
2
,
"test t"
,
"t test"
);
select
*
from
federated
.
t1
order
by
i1
;
...
...
@@ -1354,13 +1359,12 @@ select * from federated.t2 order by id;
update
federated
.
t1
,
federated
.
t2
set
t1
.
i2
=
15
,
t2
.
c2
=
"ppc"
where
t1
.
i1
=
t2
.
id
;
select
*
from
federated
.
t1
order
by
i1
;
select
*
from
federated
.
t2
order
by
id
;
delete
t1
.*
,
t2
.*
from
federated
.
t1
,
federated
.
t2
where
t1
.
i2
=
t2
.
id
;
delete
federated
.
t1
.*
,
federated
.
t2
.*
from
federated
.
t1
,
federated
.
t2
where
t1
.
i2
=
t2
.
id
;
select
*
from
federated
.
t1
order
by
i1
;
select
*
from
federated
.
t2
order
by
id
;
drop
table
federated
.
t1
,
federated
.
t2
;
connection
slave
;
drop
table
federated
.
t1
,
federated
.
t2
;
connection
master
;
--
enable_parsing
--
source
include
/
federated_cleanup
.
inc
source
include
/
federated_cleanup
.
inc
;
sql/ha_federated.cc
View file @
69bf342a
This diff is collapsed.
Click to expand it.
sql/ha_federated.h
View file @
69bf342a
...
...
@@ -130,6 +130,7 @@ typedef struct st_federated_share {
remote host info, parse_url supplies
*/
char
*
scheme
;
char
*
connect_string
;
char
*
hostname
;
char
*
username
;
char
*
password
;
...
...
@@ -139,7 +140,7 @@ typedef struct st_federated_share {
char
*
socket
;
char
*
sport
;
ushort
port
;
uint
table_name_length
,
use_count
;
uint
table_name_length
,
connect_string_length
,
use_count
;
pthread_mutex_t
mutex
;
THR_LOCK
lock
;
}
FEDERATED_SHARE
;
...
...
@@ -153,7 +154,6 @@ class ha_federated: public handler
FEDERATED_SHARE
*
share
;
/* Shared lock info */
MYSQL
*
mysql
;
/* MySQL connection */
MYSQL_RES
*
stored_result
;
uint
ref_length
;
uint
fetch_num
;
// stores the fetch num
MYSQL_ROW_OFFSET
current_position
;
// Current position used by ::position()
int
remote_error_number
;
...
...
@@ -164,7 +164,8 @@ private:
return 0 on success
return errorcode otherwise
*/
uint
convert_row_to_internal_format
(
byte
*
buf
,
MYSQL_ROW
row
);
uint
convert_row_to_internal_format
(
byte
*
buf
,
MYSQL_ROW
row
,
MYSQL_RES
*
row
);
bool
create_where_from_key
(
String
*
to
,
KEY
*
key_info
,
const
key_range
*
start_key
,
const
key_range
*
end_key
,
...
...
@@ -304,6 +305,13 @@ public:
int
connection_rollback
();
int
connection_autocommit
(
bool
state
);
int
execute_simple_query
(
const
char
*
query
,
int
len
);
int
read_next
(
byte
*
buf
,
MYSQL_RES
*
result
);
int
index_read_idx_with_result_set
(
byte
*
buf
,
uint
index
,
const
byte
*
key
,
uint
key_len
,
ha_rkey_function
find_flag
,
MYSQL_RES
**
result
);
};
int
federated_db_init
(
void
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment