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
0dea4c66
Commit
0dea4c66
authored
Jun 14, 2004
by
pekka@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testBlobs.cpp, NdbBlob.cpp:
small blob fix
parent
9a862183
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
7 deletions
+24
-7
ndb/src/ndbapi/NdbBlob.cpp
ndb/src/ndbapi/NdbBlob.cpp
+21
-6
ndb/test/ndbapi/testBlobs.cpp
ndb/test/ndbapi/testBlobs.cpp
+3
-1
No files found.
ndb/src/ndbapi/NdbBlob.cpp
View file @
0dea4c66
...
@@ -35,6 +35,17 @@
...
@@ -35,6 +35,17 @@
#define DBG(x)
#define DBG(x)
#endif
#endif
static
char
*
ndb_blob_debug
(
const
Uint32
*
data
,
unsigned
size
)
{
static
char
buf
[
128
+
1
];
// MT irrelevant
buf
[
0
]
=
0
;
for
(
unsigned
i
=
0
;
i
<
size
&&
i
<
128
/
4
;
i
++
)
{
sprintf
(
buf
+
strlen
(
buf
),
"%*s%08x"
,
i
!=
0
,
""
,
data
[
i
]);
}
return
buf
;
}
/*
/*
* Reading index table directly (as a table) is faster but there are
* Reading index table directly (as a table) is faster but there are
* bugs or limitations. Keep the code but make possible to choose.
* bugs or limitations. Keep the code but make possible to choose.
...
@@ -296,7 +307,7 @@ NdbBlob::getTableKeyValue(NdbOperation* anOp)
...
@@ -296,7 +307,7 @@ NdbBlob::getTableKeyValue(NdbOperation* anOp)
}
}
// odd bytes receive no data and must be zeroed
// odd bytes receive no data and must be zeroed
while
(
len
%
4
!=
0
)
{
while
(
len
%
4
!=
0
)
{
char
*
p
=
(
char
*
)
data
+
len
++
;
char
*
p
=
(
char
*
)
&
data
[
pos
]
+
len
++
;
*
p
=
0
;
*
p
=
0
;
}
}
pos
+=
len
/
4
;
pos
+=
len
/
4
;
...
@@ -311,8 +322,9 @@ NdbBlob::setTableKeyValue(NdbOperation* anOp)
...
@@ -311,8 +322,9 @@ NdbBlob::setTableKeyValue(NdbOperation* anOp)
{
{
const
Uint32
*
data
=
(
const
Uint32
*
)
theKeyBuf
.
data
;
const
Uint32
*
data
=
(
const
Uint32
*
)
theKeyBuf
.
data
;
unsigned
pos
=
0
;
unsigned
pos
=
0
;
DBG
(
"setTableKeyValue key0="
<<
data
[
0
]);
const
unsigned
size
=
theTable
->
m_columns
.
size
();
for
(
unsigned
i
=
0
;
i
<
theTable
->
m_columns
.
size
();
i
++
)
{
DBG
(
"setTableKeyValue key="
<<
ndb_blob_debug
(
data
,
size
));
for
(
unsigned
i
=
0
;
i
<
size
;
i
++
)
{
NdbColumnImpl
*
c
=
theTable
->
m_columns
[
i
];
NdbColumnImpl
*
c
=
theTable
->
m_columns
[
i
];
assert
(
c
!=
NULL
);
assert
(
c
!=
NULL
);
if
(
c
->
m_pk
)
{
if
(
c
->
m_pk
)
{
...
@@ -333,8 +345,9 @@ NdbBlob::setAccessKeyValue(NdbOperation* anOp)
...
@@ -333,8 +345,9 @@ NdbBlob::setAccessKeyValue(NdbOperation* anOp)
{
{
const
Uint32
*
data
=
(
const
Uint32
*
)
theAccessKeyBuf
.
data
;
const
Uint32
*
data
=
(
const
Uint32
*
)
theAccessKeyBuf
.
data
;
unsigned
pos
=
0
;
unsigned
pos
=
0
;
DBG
(
"setAccessKeyValue key0="
<<
data
[
0
]);
const
unsigned
size
=
theAccessTable
->
m_columns
.
size
();
for
(
unsigned
i
=
0
;
i
<
theAccessTable
->
m_columns
.
size
();
i
++
)
{
DBG
(
"setAccessKeyValue key="
<<
ndb_blob_debug
(
data
,
size
));
for
(
unsigned
i
=
0
;
i
<
size
;
i
++
)
{
NdbColumnImpl
*
c
=
theAccessTable
->
m_columns
[
i
];
NdbColumnImpl
*
c
=
theAccessTable
->
m_columns
[
i
];
assert
(
c
!=
NULL
);
assert
(
c
!=
NULL
);
if
(
c
->
m_pk
)
{
if
(
c
->
m_pk
)
{
...
@@ -353,7 +366,9 @@ NdbBlob::setAccessKeyValue(NdbOperation* anOp)
...
@@ -353,7 +366,9 @@ NdbBlob::setAccessKeyValue(NdbOperation* anOp)
int
int
NdbBlob
::
setPartKeyValue
(
NdbOperation
*
anOp
,
Uint32
part
)
NdbBlob
::
setPartKeyValue
(
NdbOperation
*
anOp
,
Uint32
part
)
{
{
DBG
(
"setPartKeyValue dist="
<<
getDistKey
(
part
)
<<
" part="
<<
part
<<
" key0="
<<
*
(
Uint32
*
)
theKeyBuf
.
data
);
Uint32
*
data
=
(
Uint32
*
)
theKeyBuf
.
data
;
unsigned
size
=
theTable
->
m_sizeOfKeysInWords
;
DBG
(
"setPartKeyValue dist="
<<
getDistKey
(
part
)
<<
" part="
<<
part
<<
" key="
<<
ndb_blob_debug
(
data
,
size
));
if
(
anOp
->
equal
((
Uint32
)
0
,
getDistKey
(
part
))
==
-
1
||
if
(
anOp
->
equal
((
Uint32
)
0
,
getDistKey
(
part
))
==
-
1
||
anOp
->
equal
((
Uint32
)
1
,
part
)
==
-
1
||
anOp
->
equal
((
Uint32
)
1
,
part
)
==
-
1
||
anOp
->
equal
((
Uint32
)
2
,
theKeyBuf
.
data
)
==
-
1
)
{
anOp
->
equal
((
Uint32
)
2
,
theKeyBuf
.
data
)
==
-
1
)
{
...
...
ndb/test/ndbapi/testBlobs.cpp
View file @
0dea4c66
...
@@ -72,7 +72,7 @@ struct Opt {
...
@@ -72,7 +72,7 @@ struct Opt {
m_tname
(
"TBLOB1"
),
m_tname
(
"TBLOB1"
),
m_x1name
(
"TBLOB1X1"
),
m_x1name
(
"TBLOB1X1"
),
m_x2name
(
"TBLOB1X2"
),
m_x2name
(
"TBLOB1X2"
),
m_pk1off
(
99900
0000
),
m_pk1off
(
0x1234
0000
),
m_pk2len
(
55
),
m_pk2len
(
55
),
m_oneblob
(
false
),
m_oneblob
(
false
),
m_blob1
(
false
,
7
,
1137
,
10
),
m_blob1
(
false
,
7
,
1137
,
10
),
...
@@ -988,6 +988,8 @@ testmain()
...
@@ -988,6 +988,8 @@ testmain()
bool
ulim
=
skip
(
'w'
)
?
false
:
true
;
bool
ulim
=
skip
(
'w'
)
?
false
:
true
;
// pk
// pk
for
(
int
rw
=
llim
;
rw
<=
ulim
;
rw
++
)
{
for
(
int
rw
=
llim
;
rw
<=
ulim
;
rw
++
)
{
if
(
skip
(
'k'
))
continue
;
DBG
(
"--- pk ops "
<<
(
!
rw
?
"get/set"
:
"read/write"
)
<<
" ---"
);
DBG
(
"--- pk ops "
<<
(
!
rw
?
"get/set"
:
"read/write"
)
<<
" ---"
);
calcTups
(
false
);
calcTups
(
false
);
CHK
(
insertPk
(
rw
)
==
0
);
CHK
(
insertPk
(
rw
)
==
0
);
...
...
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