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
4d899772
Commit
4d899772
authored
Nov 16, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge pnousiainen@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/export/space/pekka/ndb/version/my50
parents
48e91809
a2f4bd83
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
95 additions
and
55 deletions
+95
-55
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
ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp
ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp
+16
-1
ndb/src/kernel/vm/SimulatedBlock.cpp
ndb/src/kernel/vm/SimulatedBlock.cpp
+49
-43
ndb/src/kernel/vm/SimulatedBlock.hpp
ndb/src/kernel/vm/SimulatedBlock.hpp
+5
-1
No files found.
mysql-test/r/ndb_charset.result
View file @
4d899772
...
@@ -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 @
4d899772
...
@@ -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
;
...
...
ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp
View file @
4d899772
...
@@ -684,6 +684,21 @@ Dbtup::checkUpdateOfPrimaryKey(Uint32* updateBuffer, Tablerec* const regTabPtr)
...
@@ -684,6 +684,21 @@ Dbtup::checkUpdateOfPrimaryKey(Uint32* updateBuffer, Tablerec* const regTabPtr)
Uint32
attrDescriptorIndex
=
regTabPtr
->
tabDescriptor
+
(
attributeId
<<
ZAD_LOG_SIZE
);
Uint32
attrDescriptorIndex
=
regTabPtr
->
tabDescriptor
+
(
attributeId
<<
ZAD_LOG_SIZE
);
Uint32
attrDescriptor
=
tableDescriptor
[
attrDescriptorIndex
].
tabDescr
;
Uint32
attrDescriptor
=
tableDescriptor
[
attrDescriptorIndex
].
tabDescr
;
Uint32
attributeOffset
=
tableDescriptor
[
attrDescriptorIndex
+
1
].
tabDescr
;
Uint32
attributeOffset
=
tableDescriptor
[
attrDescriptorIndex
+
1
].
tabDescr
;
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
];
ReadFunction
f
=
regTabPtr
->
readFunctionArray
[
attributeId
];
AttributeHeader
::
init
(
&
attributeHeader
,
attributeId
,
0
);
AttributeHeader
::
init
(
&
attributeHeader
,
attributeId
,
0
);
...
@@ -691,7 +706,7 @@ Dbtup::checkUpdateOfPrimaryKey(Uint32* updateBuffer, Tablerec* const regTabPtr)
...
@@ -691,7 +706,7 @@ Dbtup::checkUpdateOfPrimaryKey(Uint32* updateBuffer, Tablerec* const regTabPtr)
tMaxRead
=
MAX_KEY_SIZE_IN_WORDS
;
tMaxRead
=
MAX_KEY_SIZE_IN_WORDS
;
bool
tmp
=
tXfrmFlag
;
bool
tmp
=
tXfrmFlag
;
tXfrmFlag
=
fals
e
;
tXfrmFlag
=
tru
e
;
ndbrequire
((
this
->*
f
)(
&
keyReadBuffer
[
0
],
ahOut
,
attrDescriptor
,
attributeOffset
));
ndbrequire
((
this
->*
f
)(
&
keyReadBuffer
[
0
],
ahOut
,
attrDescriptor
,
attributeOffset
));
tXfrmFlag
=
tmp
;
tXfrmFlag
=
tmp
;
ndbrequire
(
tOutBufIndex
==
ahOut
->
getDataSize
());
ndbrequire
(
tOutBufIndex
==
ahOut
->
getDataSize
());
...
...
ndb/src/kernel/vm/SimulatedBlock.cpp
View file @
4d899772
...
@@ -1868,55 +1868,61 @@ SimulatedBlock::xfrm_key(Uint32 tab, const Uint32* src,
...
@@ -1868,55 +1868,61 @@ 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
=
Uint32
srcBytes
=
xfrm_attr
(
keyAttr
.
attributeDescriptor
,
keyAttr
.
charsetInfo
,
AttributeDescriptor
::
getSizeInBytes
(
keyAttr
.
attributeDescriptor
);
src
,
srcPos
,
dst
,
dstPos
,
dstSize
);
Uint32
srcWords
=
(
srcBytes
+
3
)
/
4
;
Uint32
dstWords
=
~
0
;
uchar
*
dstPtr
=
(
uchar
*
)
&
dst
[
dstPos
];
const
uchar
*
srcPtr
=
(
const
uchar
*
)
&
src
[
srcPos
];
CHARSET_INFO
*
cs
=
keyAttr
.
charsetInfo
;
if
(
cs
==
NULL
)
{
jam
();
memcpy
(
dstPtr
,
srcPtr
,
srcWords
<<
2
);
dstWords
=
srcWords
;
}
else
{
jam
();
Uint32
typeId
=
AttributeDescriptor
::
getType
(
keyAttr
.
attributeDescriptor
);
Uint32
lb
,
len
;
bool
ok
=
NdbSqlUtil
::
get_var_length
(
typeId
,
srcPtr
,
srcBytes
,
lb
,
len
);
ndbrequire
(
ok
);
Uint32
xmul
=
cs
->
strxfrm_multiply
;
if
(
xmul
==
0
)
xmul
=
1
;
/*
* Varchar is really Char. End spaces do not matter. To get
* same hash we blank-pad to maximum length via strnxfrm.
* TODO use MySQL charset-aware hash function instead
*/
Uint32
dstLen
=
xmul
*
(
srcBytes
-
lb
);
ndbrequire
(
dstLen
<=
((
dstSize
-
dstPos
)
<<
2
));
int
n
=
NdbSqlUtil
::
strnxfrm_bug7284
(
cs
,
dstPtr
,
dstLen
,
srcPtr
+
lb
,
len
);
ndbrequire
(
n
!=
-
1
);
while
((
n
&
3
)
!=
0
)
{
dstPtr
[
n
++
]
=
0
;
}
dstWords
=
(
n
>>
2
);
}
dstPos
+=
dstWords
;
srcPos
+=
srcWords
;
keyPartLen
[
i
++
]
=
dstWords
;
keyPartLen
[
i
++
]
=
dstWords
;
}
}
return
dstPos
;
return
dstPos
;
}
}
Uint32
SimulatedBlock
::
xfrm_attr
(
Uint32
attrDesc
,
CHARSET_INFO
*
cs
,
const
Uint32
*
src
,
Uint32
&
srcPos
,
Uint32
*
dst
,
Uint32
&
dstPos
,
Uint32
dstSize
)
const
{
Uint32
srcBytes
=
AttributeDescriptor
::
getSizeInBytes
(
attrDesc
);
Uint32
srcWords
=
(
srcBytes
+
3
)
/
4
;
Uint32
dstWords
=
~
0
;
uchar
*
dstPtr
=
(
uchar
*
)
&
dst
[
dstPos
];
const
uchar
*
srcPtr
=
(
const
uchar
*
)
&
src
[
srcPos
];
if
(
cs
==
NULL
)
{
jam
();
memcpy
(
dstPtr
,
srcPtr
,
srcWords
<<
2
);
dstWords
=
srcWords
;
}
else
{
jam
();
Uint32
typeId
=
AttributeDescriptor
::
getType
(
attrDesc
);
Uint32
lb
,
len
;
bool
ok
=
NdbSqlUtil
::
get_var_length
(
typeId
,
srcPtr
,
srcBytes
,
lb
,
len
);
ndbrequire
(
ok
);
Uint32
xmul
=
cs
->
strxfrm_multiply
;
if
(
xmul
==
0
)
xmul
=
1
;
/*
* Varchar end-spaces are ignored in comparisons. To get same hash
* we blank-pad to maximum length via strnxfrm.
*/
Uint32
dstLen
=
xmul
*
(
srcBytes
-
lb
);
ndbrequire
(
dstLen
<=
((
dstSize
-
dstPos
)
<<
2
));
int
n
=
NdbSqlUtil
::
strnxfrm_bug7284
(
cs
,
dstPtr
,
dstLen
,
srcPtr
+
lb
,
len
);
ndbrequire
(
n
!=
-
1
);
while
((
n
&
3
)
!=
0
)
{
dstPtr
[
n
++
]
=
0
;
}
dstWords
=
(
n
>>
2
);
}
dstPos
+=
dstWords
;
srcPos
+=
srcWords
;
return
dstWords
;
}
Uint32
Uint32
SimulatedBlock
::
create_distr_key
(
Uint32
tableId
,
SimulatedBlock
::
create_distr_key
(
Uint32
tableId
,
Uint32
*
data
,
Uint32
*
data
,
...
...
ndb/src/kernel/vm/SimulatedBlock.hpp
View file @
4d899772
...
@@ -395,8 +395,12 @@ protected:
...
@@ -395,8 +395,12 @@ protected:
* @return length
* @return length
*/
*/
Uint32
xfrm_key
(
Uint32
tab
,
const
Uint32
*
src
,
Uint32
xfrm_key
(
Uint32
tab
,
const
Uint32
*
src
,
Uint32
*
dst
,
Uint32
dst
Len
,
Uint32
*
dst
,
Uint32
dst
Size
,
Uint32
keyPartLen
[
MAX_ATTRIBUTES_IN_INDEX
])
const
;
Uint32
keyPartLen
[
MAX_ATTRIBUTES_IN_INDEX
])
const
;
Uint32
xfrm_attr
(
Uint32
attrDesc
,
CHARSET_INFO
*
cs
,
const
Uint32
*
src
,
Uint32
&
srcPos
,
Uint32
*
dst
,
Uint32
&
dstPos
,
Uint32
dstSize
)
const
;
/**
/**
*
*
...
...
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