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
b42d9eb9
Commit
b42d9eb9
authored
Nov 20, 2005
by
konstantin@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-5.1-new
into mysql.com:/opt/local/work/mysql-5.1-new
parents
1fa45d61
ce21b102
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
132 additions
and
94 deletions
+132
-94
mysql-test/r/ndb_charset.result
mysql-test/r/ndb_charset.result
+15
-5
mysql-test/t/ndb_charset.test
mysql-test/t/ndb_charset.test
+10
-5
storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp
storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp
+26
-11
storage/ndb/src/kernel/vm/SimulatedBlock.cpp
storage/ndb/src/kernel/vm/SimulatedBlock.cpp
+81
-73
No files found.
mysql-test/r/ndb_charset.result
View file @
b42d9eb9
...
@@ -306,11 +306,21 @@ count(*)
...
@@ -306,11 +306,21 @@ count(*)
drop table t1;
drop table t1;
create table t1 (
create table t1 (
a char(10) primary key
a char(10) primary key
) engine=ndb;
) engine=ndbcluster default charset=latin1;
insert into t1 values ('jonas % ');
insert into t1 values ('aaabb');
replace into t1 values ('jonas % ');
select * from t1;
replace into t1 values ('jonas % ');
a
aaabb
replace into t1 set a = 'AAABB';
select * from t1;
a
AAABB
replace into t1 set a = 'aAaBb';
select * from t1;
a
aAaBb
replace into t1 set a = 'aaabb';
select * from t1;
select * from t1;
a
a
jonas %
aaabb
drop table t1;
drop table t1;
mysql-test/t/ndb_charset.test
View file @
b42d9eb9
...
@@ -237,13 +237,18 @@ drop table t1;
...
@@ -237,13 +237,18 @@ drop table t1;
#select a,b,length(a),length(b) from t1 where a='c' and b='c';
#select a,b,length(a),length(b) from t1 where a='c' and b='c';
#drop table t1;
#drop table t1;
# bug
# bug
#14007
create
table
t1
(
create
table
t1
(
a
char
(
10
)
primary
key
a
char
(
10
)
primary
key
)
engine
=
ndb
;
)
engine
=
ndbcluster
default
charset
=
latin1
;
insert
into
t1
values
(
'jonas % '
);
replace
into
t1
values
(
'jonas % '
);
insert
into
t1
values
(
'aaabb'
);
replace
into
t1
values
(
'jonas % '
);
select
*
from
t1
;
replace
into
t1
set
a
=
'AAABB'
;
select
*
from
t1
;
replace
into
t1
set
a
=
'aAaBb'
;
select
*
from
t1
;
replace
into
t1
set
a
=
'aaabb'
;
select
*
from
t1
;
select
*
from
t1
;
drop
table
t1
;
drop
table
t1
;
...
...
storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp
View file @
b42d9eb9
...
@@ -800,22 +800,37 @@ Dbtup::checkUpdateOfPrimaryKey(KeyReqStruct* req_struct,
...
@@ -800,22 +800,37 @@ Dbtup::checkUpdateOfPrimaryKey(KeyReqStruct* req_struct,
{
{
Uint32
keyReadBuffer
[
MAX_KEY_SIZE_IN_WORDS
];
Uint32
keyReadBuffer
[
MAX_KEY_SIZE_IN_WORDS
];
Uint32
attributeHeader
;
Uint32
attributeHeader
;
TableDescriptor
*
attr_descr
=
req_struct
->
attr_descr
;
TableDescriptor
*
attr_descr
=
req_struct
->
attr_descr
;
AttributeHeader
*
ahOut
=
(
AttributeHeader
*
)
&
attributeHeader
;
AttributeHeader
*
ahOut
=
(
AttributeHeader
*
)
&
attributeHeader
;
AttributeHeader
ahIn
(
*
updateBuffer
);
AttributeHeader
ahIn
(
*
updateBuffer
);
Uint32
attributeId
=
ahIn
.
getAttributeId
();
Uint32
attributeId
=
ahIn
.
getAttributeId
();
Uint32
attrDescriptorIndex
=
attributeId
<<
ZAD_LOG_SIZE
;
Uint32
attrDescriptorIndex
=
attributeId
<<
ZAD_LOG_SIZE
;
Uint32
attrDescriptor
=
attr_descr
[
attrDescriptorIndex
].
tabDescr
;
Uint32
attrDescriptor
=
attr_descr
[
attrDescriptorIndex
].
tabDescr
;
Uint32
attributeOffset
=
attr_descr
[
attrDescriptorIndex
+
1
].
tabDescr
;
Uint32
attributeOffset
=
attr_descr
[
attrDescriptorIndex
+
1
].
tabDescr
;
ReadFunction
f
=
regTabPtr
->
readFunctionArray
[
attributeId
];
Uint32
xfrmBuffer
[
1
+
MAX_KEY_SIZE_IN_WORDS
*
MAX_XFRM_MULTIPLY
];
Uint32
charsetFlag
=
AttributeOffset
::
getCharsetFlag
(
attributeOffset
);
if
(
charsetFlag
)
{
Uint32
csIndex
=
AttributeOffset
::
getCharsetPos
(
attributeOffset
);
CHARSET_INFO
*
cs
=
regTabPtr
->
charsetArray
[
csIndex
];
Uint32
srcPos
=
0
;
Uint32
dstPos
=
0
;
xfrm_attr
(
attrDescriptor
,
cs
,
&
updateBuffer
[
1
],
srcPos
,
&
xfrmBuffer
[
1
],
dstPos
,
MAX_KEY_SIZE_IN_WORDS
*
MAX_XFRM_MULTIPLY
);
ahIn
.
setDataSize
(
dstPos
);
xfrmBuffer
[
0
]
=
ahIn
.
m_value
;
updateBuffer
=
xfrmBuffer
;
}
ReadFunction
f
=
regTabPtr
->
readFunctionArray
[
attributeId
];
AttributeHeader
::
init
(
&
attributeHeader
,
attributeId
,
0
);
AttributeHeader
::
init
(
&
attributeHeader
,
attributeId
,
0
);
req_struct
->
out_buf_index
=
0
;
req_struct
->
out_buf_index
=
0
;
req_struct
->
max_read
=
MAX_KEY_SIZE_IN_WORDS
;
req_struct
->
max_read
=
MAX_KEY_SIZE_IN_WORDS
;
req_struct
->
attr_descriptor
=
attrDescriptor
;
req_struct
->
attr_descriptor
=
attrDescriptor
;
bool
tmp
=
req_struct
->
xfrm_flag
;
bool
tmp
=
req_struct
->
xfrm_flag
;
req_struct
->
xfrm_flag
=
fals
e
;
req_struct
->
xfrm_flag
=
tru
e
;
ndbrequire
((
this
->*
f
)(
&
keyReadBuffer
[
0
],
ndbrequire
((
this
->*
f
)(
&
keyReadBuffer
[
0
],
req_struct
,
req_struct
,
ahOut
,
ahOut
,
...
...
storage/ndb/src/kernel/vm/SimulatedBlock.cpp
View file @
b42d9eb9
...
@@ -1882,17 +1882,37 @@ SimulatedBlock::xfrm_key(Uint32 tab, const Uint32* src,
...
@@ -1882,17 +1882,37 @@ SimulatedBlock::xfrm_key(Uint32 tab, const Uint32* src,
while
(
i
<
noOfKeyAttr
)
while
(
i
<
noOfKeyAttr
)
{
{
const
KeyDescriptor
::
KeyAttr
&
keyAttr
=
desc
->
keyAttr
[
i
];
const
KeyDescriptor
::
KeyAttr
&
keyAttr
=
desc
->
keyAttr
[
i
];
Uint32
dstWords
=
xfrm_attr
(
keyAttr
.
attributeDescriptor
,
keyAttr
.
charsetInfo
,
src
,
srcPos
,
dst
,
dstPos
,
dstSize
);
keyPartLen
[
i
++
]
=
dstWords
;
}
if
(
0
)
{
for
(
Uint32
i
=
0
;
i
<
dstPos
;
i
++
)
{
printf
(
"%.8x "
,
dst
[
i
]);
}
printf
(
"
\n
"
);
}
return
dstPos
;
}
Uint32
SimulatedBlock
::
xfrm_attr
(
Uint32
attrDesc
,
CHARSET_INFO
*
cs
,
const
Uint32
*
src
,
Uint32
&
srcPos
,
Uint32
*
dst
,
Uint32
&
dstPos
,
Uint32
dstSize
)
const
{
Uint32
array
=
Uint32
array
=
AttributeDescriptor
::
getArrayType
(
keyAttr
.
attributeDescriptor
);
AttributeDescriptor
::
getArrayType
(
attrDesc
);
Uint32
srcBytes
=
Uint32
srcBytes
=
AttributeDescriptor
::
getSizeInBytes
(
keyAttr
.
attributeDescriptor
);
AttributeDescriptor
::
getSizeInBytes
(
attrDesc
);
Uint32
srcWords
=
~
0
;
Uint32
srcWords
=
~
0
;
Uint32
dstWords
=
~
0
;
Uint32
dstWords
=
~
0
;
uchar
*
dstPtr
=
(
uchar
*
)
&
dst
[
dstPos
];
uchar
*
dstPtr
=
(
uchar
*
)
&
dst
[
dstPos
];
const
uchar
*
srcPtr
=
(
const
uchar
*
)
&
src
[
srcPos
];
const
uchar
*
srcPtr
=
(
const
uchar
*
)
&
src
[
srcPos
];
CHARSET_INFO
*
cs
=
keyAttr
.
charsetInfo
;
if
(
cs
==
NULL
)
if
(
cs
==
NULL
)
{
{
...
@@ -1929,7 +1949,7 @@ SimulatedBlock::xfrm_key(Uint32 tab, const Uint32* src,
...
@@ -1929,7 +1949,7 @@ SimulatedBlock::xfrm_key(Uint32 tab, const Uint32* src,
{
{
jam
();
jam
();
Uint32
typeId
=
Uint32
typeId
=
AttributeDescriptor
::
getType
(
keyAttr
.
attributeDescriptor
);
AttributeDescriptor
::
getType
(
attrDesc
);
Uint32
lb
,
len
;
Uint32
lb
,
len
;
bool
ok
=
NdbSqlUtil
::
get_var_length
(
typeId
,
srcPtr
,
srcBytes
,
lb
,
len
);
bool
ok
=
NdbSqlUtil
::
get_var_length
(
typeId
,
srcPtr
,
srcBytes
,
lb
,
len
);
ndbrequire
(
ok
);
ndbrequire
(
ok
);
...
@@ -1937,9 +1957,8 @@ SimulatedBlock::xfrm_key(Uint32 tab, const Uint32* src,
...
@@ -1937,9 +1957,8 @@ SimulatedBlock::xfrm_key(Uint32 tab, const Uint32* src,
if
(
xmul
==
0
)
if
(
xmul
==
0
)
xmul
=
1
;
xmul
=
1
;
/*
/*
* Varchar is really Char. End spaces do not matter. To get
* Varchar end-spaces are ignored in comparisons. To get same hash
* same hash we blank-pad to maximum length via strnxfrm.
* we blank-pad to maximum length via strnxfrm.
* TODO use MySQL charset-aware hash function instead
*/
*/
Uint32
dstLen
=
xmul
*
(
srcBytes
-
lb
);
Uint32
dstLen
=
xmul
*
(
srcBytes
-
lb
);
ndbrequire
(
dstLen
<=
((
dstSize
-
dstPos
)
<<
2
));
ndbrequire
(
dstLen
<=
((
dstSize
-
dstPos
)
<<
2
));
...
@@ -1955,18 +1974,7 @@ SimulatedBlock::xfrm_key(Uint32 tab, const Uint32* src,
...
@@ -1955,18 +1974,7 @@ SimulatedBlock::xfrm_key(Uint32 tab, const Uint32* src,
dstPos
+=
dstWords
;
dstPos
+=
dstWords
;
srcPos
+=
srcWords
;
srcPos
+=
srcWords
;
keyPartLen
[
i
++
]
=
dstWords
;
return
dstWords
;
}
if
(
0
)
{
for
(
Uint32
i
=
0
;
i
<
dstPos
;
i
++
)
{
printf
(
"%.8x "
,
dst
[
i
]);
}
printf
(
"
\n
"
);
}
return
dstPos
;
}
}
Uint32
Uint32
...
...
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