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
d71147a2
Commit
d71147a2
authored
Apr 30, 2007
by
holyfoot/hf@hfmain.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk@192.168.21.1:mysql-5.1-opt
into mysql.com:/home/hf/work/27123/my51-27123
parents
c5625bc1
b4d186ef
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
16 deletions
+52
-16
mysql-test/r/partition.result
mysql-test/r/partition.result
+8
-0
mysql-test/t/partition.test
mysql-test/t/partition.test
+11
-0
sql/field.cc
sql/field.cc
+1
-1
sql/field.h
sql/field.h
+13
-3
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+2
-6
sql/key.cc
sql/key.cc
+17
-6
No files found.
mysql-test/r/partition.result
View file @
d71147a2
...
...
@@ -1225,4 +1225,12 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (i) (PARTITION p01 VALUES LESS THAN (1000) ENGINE = MyISAM) */
DROP TABLE t1, t2;
set @@sql_mode=@org_mode;
create table t1 (c1 varchar(255),c2 tinyint,primary key(c1))
partition by key (c1) partitions 10 ;
insert into t1 values ('aaa','1') on duplicate key update c2 = c2 + 1;
insert into t1 values ('aaa','1') on duplicate key update c2 = c2 + 1;
select * from t1;
c1 c2
aaa 2
drop table t1;
End of 5.1 tests
mysql-test/t/partition.test
View file @
d71147a2
...
...
@@ -1431,4 +1431,15 @@ show create table t2;
DROP
TABLE
t1
,
t2
;
set
@@
sql_mode
=@
org_mode
;
#
# Bug #27123 partition + on duplicate key update + varchar = Can't find record in <table>
#
create
table
t1
(
c1
varchar
(
255
),
c2
tinyint
,
primary
key
(
c1
))
partition
by
key
(
c1
)
partitions
10
;
insert
into
t1
values
(
'aaa'
,
'1'
)
on
duplicate
key
update
c2
=
c2
+
1
;
insert
into
t1
values
(
'aaa'
,
'1'
)
on
duplicate
key
update
c2
=
c2
+
1
;
select
*
from
t1
;
drop
table
t1
;
--
echo
End
of
5.1
tests
sql/field.cc
View file @
d71147a2
...
...
@@ -7006,7 +7006,7 @@ Field_blob::Field_blob(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
}
void
Field_blob
::
store_length
(
uint32
number
)
void
Field_blob
::
store_length
(
char
*
ptr
,
uint
packlength
,
uint32
number
)
{
switch
(
packlength
)
{
case
1
:
...
...
sql/field.h
View file @
d71147a2
...
...
@@ -1307,7 +1307,12 @@ public:
}
int
reset
(
void
)
{
bzero
(
ptr
,
packlength
+
sizeof
(
char
*
));
return
0
;
}
void
reset_fields
()
{
bzero
((
char
*
)
&
value
,
sizeof
(
value
));
}
void
store_length
(
uint32
number
);
static
void
store_length
(
char
*
ptr
,
uint
packlength
,
uint32
number
);
inline
void
store_length
(
uint32
number
)
{
store_length
(
ptr
,
packlength
,
number
);
}
inline
uint32
get_length
(
uint
row_offset
=
0
)
{
return
get_length
(
ptr
+
row_offset
);
}
uint32
get_length
(
const
char
*
ptr
);
...
...
@@ -1325,10 +1330,15 @@ public:
memcpy
(
ptr
,
length
,
packlength
);
memcpy_fixed
(
ptr
+
packlength
,
&
data
,
sizeof
(
char
*
));
}
void
set_ptr_offset
(
my_ptrdiff_t
ptr_diff
,
uint32
length
,
char
*
data
)
{
char
*
ptr_ofs
=
ADD_TO_PTR
(
ptr
,
ptr_diff
,
char
*
);
store_length
(
ptr_ofs
,
packlength
,
length
);
memcpy_fixed
(
ptr_ofs
+
packlength
,
&
data
,
sizeof
(
char
*
));
}
inline
void
set_ptr
(
uint32
length
,
char
*
data
)
{
store_length
(
length
);
memcpy_fixed
(
ptr
+
packlength
,
&
data
,
sizeof
(
char
*
));
set_ptr_offset
(
0
,
length
,
data
);
}
uint
get_key_image
(
char
*
buff
,
uint
length
,
imagetype
type
);
void
set_key_image
(
char
*
buff
,
uint
length
);
...
...
sql/ha_ndbcluster.cc
View file @
d71147a2
...
...
@@ -874,9 +874,7 @@ int get_ndb_blobs_value(TABLE* table, NdbValue* value_array,
i
,
offset
,
(
long
)
buf
,
len
,
(
int
)
ptrdiff
));
DBUG_ASSERT
(
len
==
len64
);
// Ugly hack assumes only ptr needs to be changed
field_blob
->
ptr
+=
ptrdiff
;
field_blob
->
set_ptr
(
len
,
buf
);
field_blob
->
ptr
-=
ptrdiff
;
field_blob
->
set_ptr_offset
(
ptrdiff
,
len
,
buf
);
}
offset
+=
size
;
}
...
...
@@ -885,9 +883,7 @@ int get_ndb_blobs_value(TABLE* table, NdbValue* value_array,
// have to set length even in this case
char
*
buf
=
buffer
+
offset
;
// or maybe NULL
uint32
len
=
0
;
field_blob
->
ptr
+=
ptrdiff
;
field_blob
->
set_ptr
(
len
,
buf
);
field_blob
->
ptr
-=
ptrdiff
;
field_blob
->
set_ptr_offset
(
ptrdiff
,
len
,
buf
);
DBUG_PRINT
(
"info"
,
(
"[%u] isNull=%d"
,
i
,
isNull
));
}
}
...
...
sql/key.cc
View file @
d71147a2
...
...
@@ -214,23 +214,34 @@ void key_restore(byte *to_record, byte *from_key, KEY *key_info,
}
if
(
key_part
->
key_part_flag
&
HA_BLOB_PART
)
{
/*
This in fact never happens, as we have only partial BLOB
keys yet anyway, so it's difficult to find any sence to
restore the part of a record.
Maybe this branch is to be removed, but now we
have to ignore GCov compaining.
*/
uint
blob_length
=
uint2korr
(
from_key
);
Field_blob
*
field
=
(
Field_blob
*
)
key_part
->
field
;
from_key
+=
HA_KEY_BLOB_LENGTH
;
key_length
-=
HA_KEY_BLOB_LENGTH
;
((
Field_blob
*
)
key_part
->
field
)
->
set_ptr
((
ulong
)
blob_length
,
(
char
*
)
from_key
);
field
->
set_ptr_offset
(
to_record
-
field
->
table
->
record
[
0
]
,
(
ulong
)
blob_length
,
(
char
*
)
from_key
);
length
=
key_part
->
length
;
}
else
if
(
key_part
->
key_part_flag
&
HA_VAR_LENGTH_PART
)
{
Field
*
field
=
key_part
->
field
;
my_bitmap_map
*
old_map
;
my_ptrdiff_t
ptrdiff
=
to_record
-
field
->
table
->
record
[
0
];
field
->
move_field_offset
(
ptrdiff
);
key_length
-=
HA_KEY_BLOB_LENGTH
;
length
=
min
(
key_length
,
key_part
->
length
);
old_map
=
dbug_tmp_use_all_columns
(
key_part
->
field
->
table
,
key_part
->
field
->
table
->
write_set
);
key_part
->
field
->
set_key_image
((
char
*
)
from_key
,
length
);
dbug_tmp_restore_column_map
(
key_part
->
field
->
table
->
write_set
,
old_map
);
old_map
=
dbug_tmp_use_all_columns
(
field
->
table
,
field
->
table
->
write_set
);
field
->
set_key_image
((
char
*
)
from_key
,
length
);
dbug_tmp_restore_column_map
(
field
->
table
->
write_set
,
old_map
);
from_key
+=
HA_KEY_BLOB_LENGTH
;
field
->
move_field_offset
(
-
ptrdiff
);
}
else
{
...
...
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