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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
afef612b
Commit
afef612b
authored
Jun 28, 2006
by
jimw@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal:/home/bk/mysql-5.0-engines
into mysql.com:/home/jimw/my/mysql-5.0-16494
parents
48e17abe
46dcf661
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
27 deletions
+51
-27
mysql-test/r/federated.result
mysql-test/r/federated.result
+16
-0
mysql-test/t/federated.test
mysql-test/t/federated.test
+18
-0
sql/ha_federated.cc
sql/ha_federated.cc
+17
-27
No files found.
mysql-test/r/federated.result
View file @
afef612b
...
@@ -1689,6 +1689,22 @@ id c1 c2
...
@@ -1689,6 +1689,22 @@ id c1 c2
9 abc ppc
9 abc ppc
drop table federated.t1, federated.t2;
drop table federated.t1, federated.t2;
drop table federated.t1, federated.t2;
drop table federated.t1, federated.t2;
create table t1 (id int not null auto_increment primary key, val int);
create table t1
(id int not null auto_increment primary key, val int) engine=federated
connection='mysql://root@127.0.0.1:9308/test/t1';
insert into t1 values (1,0),(2,0);
update t1 set val = NULL where id = 1;
select * from t1;
id val
1 NULL
2 0
select * from t1;
id val
1 NULL
2 0
drop table t1;
drop table t1;
DROP TABLE IF EXISTS federated.t1;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
DROP DATABASE IF EXISTS federated;
DROP TABLE IF EXISTS federated.t1;
DROP TABLE IF EXISTS federated.t1;
...
...
mysql-test/t/federated.test
View file @
afef612b
...
@@ -1361,4 +1361,22 @@ drop table federated.t1, federated.t2;
...
@@ -1361,4 +1361,22 @@ drop table federated.t1, federated.t2;
connection
slave
;
connection
slave
;
drop
table
federated
.
t1
,
federated
.
t2
;
drop
table
federated
.
t1
,
federated
.
t2
;
#
# Bug #16494: Updates that set a column to NULL fail sometimes
#
connection
slave
;
create
table
t1
(
id
int
not
null
auto_increment
primary
key
,
val
int
);
connection
master
;
eval
create
table
t1
(
id
int
not
null
auto_increment
primary
key
,
val
int
)
engine
=
federated
connection
=
'mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1'
;
insert
into
t1
values
(
1
,
0
),(
2
,
0
);
update
t1
set
val
=
NULL
where
id
=
1
;
select
*
from
t1
;
connection
slave
;
select
*
from
t1
;
drop
table
t1
;
connection
master
;
drop
table
t1
;
source
include
/
federated_cleanup
.
inc
;
source
include
/
federated_cleanup
.
inc
;
sql/ha_federated.cc
View file @
afef612b
...
@@ -1810,18 +1810,12 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
...
@@ -1810,18 +1810,12 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
/*
/*
buffers for following strings
buffers for following strings
*/
*/
char
old_field_value_buffer
[
STRING_BUFFER_USUAL_SIZE
];
char
field_value_buffer
[
STRING_BUFFER_USUAL_SIZE
];
char
new_field_value_buffer
[
STRING_BUFFER_USUAL_SIZE
];
char
update_buffer
[
FEDERATED_QUERY_BUFFER_SIZE
];
char
update_buffer
[
FEDERATED_QUERY_BUFFER_SIZE
];
char
where_buffer
[
FEDERATED_QUERY_BUFFER_SIZE
];
char
where_buffer
[
FEDERATED_QUERY_BUFFER_SIZE
];
/* stores the value to be replaced of the field were are updating */
/* Work area for field values */
String
old_field_value
(
old_field_value_buffer
,
String
field_value
(
field_value_buffer
,
sizeof
(
field_value_buffer
),
sizeof
(
old_field_value_buffer
),
&
my_charset_bin
);
/* stores the new value of the field */
String
new_field_value
(
new_field_value_buffer
,
sizeof
(
new_field_value_buffer
),
&
my_charset_bin
);
&
my_charset_bin
);
/* stores the update query */
/* stores the update query */
String
update_string
(
update_buffer
,
String
update_string
(
update_buffer
,
...
@@ -1835,8 +1829,7 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
...
@@ -1835,8 +1829,7 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
/*
/*
set string lengths to 0 to avoid misc chars in string
set string lengths to 0 to avoid misc chars in string
*/
*/
old_field_value
.
length
(
0
);
field_value
.
length
(
0
);
new_field_value
.
length
(
0
);
update_string
.
length
(
0
);
update_string
.
length
(
0
);
where_string
.
length
(
0
);
where_string
.
length
(
0
);
...
@@ -1850,8 +1843,8 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
...
@@ -1850,8 +1843,8 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
In this loop, we want to match column names to values being inserted
In this loop, we want to match column names to values being inserted
(while building INSERT statement).
(while building INSERT statement).
Iterate through table->field (new data) and share->old_fi
le
d (old_data)
Iterate through table->field (new data) and share->old_fi
el
d (old_data)
using the same index to create
d an SQL UPDATE statement, n
ew data is
using the same index to create
an SQL UPDATE statement. N
ew data is
used to create SET field=value and old data is used to create WHERE
used to create SET field=value and old data is used to create WHERE
field=oldvalue
field=oldvalue
*/
*/
...
@@ -1863,30 +1856,28 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
...
@@ -1863,30 +1856,28 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
update_string
.
append
(
FEDERATED_EQ
);
update_string
.
append
(
FEDERATED_EQ
);
if
((
*
field
)
->
is_null
())
if
((
*
field
)
->
is_null
())
new_field_value
.
append
(
FEDERATED_NULL
);
update_string
.
append
(
FEDERATED_NULL
);
else
else
{
{
/* otherwise = */
/* otherwise = */
(
*
field
)
->
val_str
(
&
new_field_value
);
(
*
field
)
->
val_str
(
&
field_value
);
(
*
field
)
->
quote_data
(
&
new_field_value
);
(
*
field
)
->
quote_data
(
&
field_value
);
update_string
.
append
(
field_value
);
if
(
!
field_in_record_is_null
(
table
,
*
field
,
(
char
*
)
old_data
))
field_value
.
length
(
0
);
where_string
.
append
(
FEDERATED_EQ
);
}
}
if
(
field_in_record_is_null
(
table
,
*
field
,
(
char
*
)
old_data
))
if
(
field_in_record_is_null
(
table
,
*
field
,
(
char
*
)
old_data
))
where_string
.
append
(
FEDERATED_ISNULL
);
where_string
.
append
(
FEDERATED_ISNULL
);
else
else
{
{
(
*
field
)
->
val_str
(
&
old_field_value
,
where_string
.
append
(
FEDERATED_EQ
);
(
*
field
)
->
val_str
(
&
field_value
,
(
char
*
)
(
old_data
+
(
*
field
)
->
offset
()));
(
char
*
)
(
old_data
+
(
*
field
)
->
offset
()));
(
*
field
)
->
quote_data
(
&
old_field_value
);
(
*
field
)
->
quote_data
(
&
field_value
);
where_string
.
append
(
old_field_value
);
where_string
.
append
(
field_value
);
field_value
.
length
(
0
);
}
}
update_string
.
append
(
new_field_value
);
new_field_value
.
length
(
0
);
/*
/*
Only append conjunctions if we have another field in which
Only append conjunctions if we have another field in which
to iterate
to iterate
...
@@ -1896,7 +1887,6 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
...
@@ -1896,7 +1887,6 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
update_string
.
append
(
FEDERATED_COMMA
);
update_string
.
append
(
FEDERATED_COMMA
);
where_string
.
append
(
FEDERATED_AND
);
where_string
.
append
(
FEDERATED_AND
);
}
}
old_field_value
.
length
(
0
);
}
}
update_string
.
append
(
FEDERATED_WHERE
);
update_string
.
append
(
FEDERATED_WHERE
);
update_string
.
append
(
where_string
);
update_string
.
append
(
where_string
);
...
...
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