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
b5e313f3
Commit
b5e313f3
authored
Jan 31, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/extern/mysql/bk/mysql-5.0
into mysql.com:/extern/mysql/work/bug15737/mysql-5.0
parents
79e09501
b16c7d2a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
104 additions
and
1 deletion
+104
-1
innobase/include/btr0sea.ic
innobase/include/btr0sea.ic
+1
-1
mysql-test/r/federated.result
mysql-test/r/federated.result
+42
-0
mysql-test/t/federated.test
mysql-test/t/federated.test
+30
-0
sql/ha_federated.cc
sql/ha_federated.cc
+30
-0
sql/ha_federated.h
sql/ha_federated.h
+1
-0
No files found.
innobase/include/btr0sea.ic
View file @
b5e313f3
...
...
@@ -16,7 +16,7 @@ Updates the search info. */
void
btr_search_info_update_slow(
/*========================*/
btr_search_t* info, /* in: search info */
btr_search_t* info, /* in
/out
: search info */
btr_cur_t* cursor);/* in: cursor which was just positioned */
/************************************************************************
...
...
mysql-test/r/federated.result
View file @
b5e313f3
...
...
@@ -1517,6 +1517,48 @@ bitty
drop table federated.t1;
drop table federated.t1;
DROP TABLE IF EXISTS federated.t1;
Warnings:
Note 1051 Unknown table 't1'
CREATE TABLE federated.t1 (
`id` int(20) NOT NULL auto_increment,
PRIMARY KEY (`id`));
DROP TABLE IF EXISTS federated.t1;
Warnings:
Note 1051 Unknown table 't1'
CREATE TABLE federated.t1 (
`id` int(20) NOT NULL auto_increment,
PRIMARY KEY (`id`)
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:9308/federated/t1';
INSERT INTO federated.t1 VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
1
INSERT INTO federated.t1 VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
2
INSERT INTO federated.t1 VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
3
INSERT INTO federated.t1 VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
4
INSERT INTO federated.t1 VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
5
SELECT * FROM federated.t1;
id
1
2
3
4
5
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
mysql-test/t/federated.test
View file @
b5e313f3
...
...
@@ -1224,4 +1224,34 @@ drop table federated.t1;
connection
slave
;
drop
table
federated
.
t1
;
#
# BUG# 14768 test auto_increment last_insert_id()
#
connection
slave
;
DROP
TABLE
IF
EXISTS
federated
.
t1
;
CREATE
TABLE
federated
.
t1
(
`id`
int
(
20
)
NOT
NULL
auto_increment
,
PRIMARY
KEY
(
`id`
));
connection
master
;
DROP
TABLE
IF
EXISTS
federated
.
t1
;
eval
CREATE
TABLE
federated
.
t1
(
`id`
int
(
20
)
NOT
NULL
auto_increment
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
"FEDERATED"
DEFAULT
CHARSET
=
latin1
CONNECTION
=
'mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'
;
INSERT
INTO
federated
.
t1
VALUES
();
SELECT
LAST_INSERT_ID
();
INSERT
INTO
federated
.
t1
VALUES
();
SELECT
LAST_INSERT_ID
();
INSERT
INTO
federated
.
t1
VALUES
();
SELECT
LAST_INSERT_ID
();
INSERT
INTO
federated
.
t1
VALUES
();
SELECT
LAST_INSERT_ID
();
INSERT
INTO
federated
.
t1
VALUES
();
SELECT
LAST_INSERT_ID
();
SELECT
*
FROM
federated
.
t1
;
source
include
/
federated_cleanup
.
inc
;
sql/ha_federated.cc
View file @
b5e313f3
...
...
@@ -1393,6 +1393,12 @@ static int free_share(FEDERATED_SHARE *share)
hash_delete
(
&
federated_open_tables
,
(
byte
*
)
share
);
my_free
((
gptr
)
share
->
scheme
,
MYF
(
MY_ALLOW_ZERO_PTR
));
share
->
scheme
=
0
;
if
(
share
->
socket
)
{
my_free
((
gptr
)
share
->
socket
,
MYF
(
MY_ALLOW_ZERO_PTR
));
share
->
socket
=
0
;
}
thr_lock_delete
(
&
share
->
lock
);
VOID
(
pthread_mutex_destroy
(
&
share
->
mutex
));
my_free
((
gptr
)
share
,
MYF
(
0
));
...
...
@@ -1695,10 +1701,34 @@ int ha_federated::write_row(byte *buf)
{
DBUG_RETURN
(
stash_remote_error
());
}
/*
If the table we've just written a record to contains an auto_increment field,
then store the last_insert_id() value from the foreign server
*/
if
(
table
->
next_number_field
)
update_auto_increment
();
DBUG_RETURN
(
0
);
}
/*
ha_federated::update_auto_increment
This method ensures that last_insert_id() works properly. What it simply does
is calls last_insert_id() on the foreign database immediately after insert
(if the table has an auto_increment field) and sets the insert id via
thd->insert_id(ID) (as well as storing thd->prev_insert_id)
*/
void
ha_federated
::
update_auto_increment
(
void
)
{
THD
*
thd
=
current_thd
;
DBUG_ENTER
(
"ha_federated::update_auto_increment"
);
thd
->
insert_id
(
mysql
->
last_used_con
->
insert_id
);
DBUG_PRINT
(
"info"
,(
"last_insert_id %d"
,
auto_increment_value
));
DBUG_VOID_RETURN
;
}
int
ha_federated
::
optimize
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
{
...
...
sql/ha_federated.h
View file @
b5e313f3
...
...
@@ -285,6 +285,7 @@ public:
void
position
(
const
byte
*
record
);
//required
void
info
(
uint
);
//required
void
update_auto_increment
(
void
);
int
repair
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
int
optimize
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
...
...
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