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
ad258ad5
Commit
ad258ad5
authored
Dec 09, 2004
by
joreland@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ndb - Fix hugoCalcValue for bits
parent
d19a42d8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
23 deletions
+26
-23
ndb/test/include/HugoCalculator.hpp
ndb/test/include/HugoCalculator.hpp
+1
-1
ndb/test/src/HugoCalculator.cpp
ndb/test/src/HugoCalculator.cpp
+16
-18
ndb/test/src/HugoOperations.cpp
ndb/test/src/HugoOperations.cpp
+8
-3
ndb/test/tools/Makefile.am
ndb/test/tools/Makefile.am
+1
-1
No files found.
ndb/test/include/HugoCalculator.hpp
View file @
ad258ad5
...
@@ -38,7 +38,7 @@ public:
...
@@ -38,7 +38,7 @@ public:
float calcValue(int record, int attrib, int updates) const;
float calcValue(int record, int attrib, int updates) const;
double calcValue(int record, int attrib, int updates) const;
double calcValue(int record, int attrib, int updates) const;
#endif
#endif
const
char
*
calcValue
(
int
record
,
int
attrib
,
int
updates
,
char
*
buf
)
const
;
const
char
*
calcValue
(
int
record
,
int
attrib
,
int
updates
,
char
*
buf
,
int
len
)
const
;
int
verifyRowValues
(
NDBT_ResultRow
*
const
pRow
)
const
;
int
verifyRowValues
(
NDBT_ResultRow
*
const
pRow
)
const
;
int
getIdValue
(
NDBT_ResultRow
*
const
pRow
)
const
;
int
getIdValue
(
NDBT_ResultRow
*
const
pRow
)
const
;
...
...
ndb/test/src/HugoCalculator.cpp
View file @
ad258ad5
...
@@ -85,17 +85,16 @@ const char*
...
@@ -85,17 +85,16 @@ const char*
HugoCalculator
::
calcValue
(
int
record
,
HugoCalculator
::
calcValue
(
int
record
,
int
attrib
,
int
attrib
,
int
updates
,
int
updates
,
char
*
buf
)
const
{
char
*
buf
,
int
len
)
const
{
const
char
a
[
26
]
=
{
"UAWBORCTDPEFQGNYHISJMKXLZ"
};
const
char
a
[
26
]
=
{
"UAWBORCTDPEFQGNYHISJMKXLZ"
};
const
NdbDictionary
::
Column
*
attr
=
m_tab
.
getColumn
(
attrib
);
const
NdbDictionary
::
Column
*
attr
=
m_tab
.
getColumn
(
attrib
);
int
val
=
calcValue
(
record
,
attrib
,
updates
);
int
val
=
calcValue
(
record
,
attrib
,
updates
);
int
len
;
if
(
attr
->
getPrimaryKey
()){
if
(
attr
->
getPrimaryKey
()){
// Create a string where val is printed as chars in the beginning
// Create a string where val is printed as chars in the beginning
// of the string, then fill with other chars
// of the string, then fill with other chars
// The string length is set to the same size as the attribute
// The string length is set to the same size as the attribute
len
=
attr
->
getLength
();
BaseString
::
snprintf
(
buf
,
len
,
"%d"
,
val
);
BaseString
::
snprintf
(
buf
,
len
,
"%d"
,
val
);
for
(
int
i
=
strlen
(
buf
);
i
<
len
;
i
++
)
for
(
int
i
=
strlen
(
buf
);
i
<
len
;
i
++
)
buf
[
i
]
=
a
[((
val
^
i
)
%
25
)];
buf
[
i
]
=
a
[((
val
^
i
)
%
25
)];
...
@@ -104,13 +103,13 @@ HugoCalculator::calcValue(int record,
...
@@ -104,13 +103,13 @@ HugoCalculator::calcValue(int record,
// Fill buf with some pattern so that we can detect
// Fill buf with some pattern so that we can detect
// anomalies in the area that we don't fill with chars
// anomalies in the area that we don't fill with chars
int
i
;
int
i
;
for
(
i
=
0
;
i
<
attr
->
getLength
()
;
i
++
)
for
(
i
=
0
;
i
<
len
;
i
++
)
buf
[
i
]
=
((
i
+
2
)
%
255
);
buf
[
i
]
=
((
i
+
2
)
%
255
);
// Calculate length of the string to create. We want the string
// Calculate length of the string to create. We want the string
// length to be varied between max and min of this attribute.
// length to be varied between max and min of this attribute.
len
=
val
%
(
attr
->
getLength
()
+
1
);
len
=
val
%
(
len
+
1
);
// If len == 0 return NULL if this is a nullable attribute
// If len == 0 return NULL if this is a nullable attribute
if
(
len
==
0
){
if
(
len
==
0
){
if
(
attr
->
getNullable
()
==
true
)
if
(
attr
->
getNullable
()
==
true
)
...
@@ -131,6 +130,7 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
...
@@ -131,6 +130,7 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
id
=
pRow
->
attributeStore
(
m_idCol
)
->
u_32_value
();
id
=
pRow
->
attributeStore
(
m_idCol
)
->
u_32_value
();
updates
=
pRow
->
attributeStore
(
m_updatesCol
)
->
u_32_value
();
updates
=
pRow
->
attributeStore
(
m_updatesCol
)
->
u_32_value
();
int
result
=
0
;
// Check the values of each column
// Check the values of each column
for
(
int
i
=
0
;
i
<
m_tab
.
getNoOfColumns
();
i
++
){
for
(
int
i
=
0
;
i
<
m_tab
.
getNoOfColumns
();
i
++
){
...
@@ -145,9 +145,8 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
...
@@ -145,9 +145,8 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
case
NdbDictionary
:
:
Column
::
Varchar
:
case
NdbDictionary
:
:
Column
::
Varchar
:
case
NdbDictionary
:
:
Column
::
Binary
:
case
NdbDictionary
:
:
Column
::
Binary
:
case
NdbDictionary
:
:
Column
::
Varbinary
:
{
case
NdbDictionary
:
:
Column
::
Varbinary
:
{
int
result
=
0
;
char
*
buf
=
new
char
[
len
+
1
];
char
*
buf
=
new
char
[
len
+
1
];
const
char
*
res
=
calcValue
(
id
,
i
,
updates
,
buf
);
const
char
*
res
=
calcValue
(
id
,
i
,
updates
,
buf
,
len
);
if
(
res
==
NULL
){
if
(
res
==
NULL
){
if
(
!
pRow
->
attributeStore
(
i
)
->
isNULL
()){
if
(
!
pRow
->
attributeStore
(
i
)
->
isNULL
()){
g_err
<<
"|- NULL ERROR: expected a NULL but the column was not null"
<<
endl
;
g_err
<<
"|- NULL ERROR: expected a NULL but the column was not null"
<<
endl
;
...
@@ -183,7 +182,6 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
...
@@ -183,7 +182,6 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
}
}
}
}
delete
[]
buf
;
delete
[]
buf
;
return
result
;
}
}
break
;
break
;
case
NdbDictionary
:
:
Column
::
Int
:
case
NdbDictionary
:
:
Column
::
Int
:
...
@@ -194,9 +192,9 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
...
@@ -194,9 +192,9 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
g_err
<<
"|- Invalid data found:
\"
"
<<
val
<<
"
\"
!=
\"
"
g_err
<<
"|- Invalid data found:
\"
"
<<
val
<<
"
\"
!=
\"
"
<<
cval
<<
"
\"
"
<<
endl
;
<<
cval
<<
"
\"
"
<<
endl
;
g_err
<<
"|- The row:
\"
"
<<
(
*
pRow
)
<<
"
\"
"
<<
endl
;
g_err
<<
"|- The row:
\"
"
<<
(
*
pRow
)
<<
"
\"
"
<<
endl
;
re
turn
-
1
;
re
sult
=
-
1
;
}
}
return
0
;
break
;
}
}
case
NdbDictionary
:
:
Column
::
Bigint
:
case
NdbDictionary
:
:
Column
::
Bigint
:
case
NdbDictionary
:
:
Column
::
Bigunsigned
:
{
case
NdbDictionary
:
:
Column
::
Bigunsigned
:
{
...
@@ -207,9 +205,8 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
...
@@ -207,9 +205,8 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
<<
cval
<<
"
\"
"
<<
cval
<<
"
\"
"
<<
endl
;
<<
endl
;
g_err
<<
"|- The row:
\"
"
<<
(
*
pRow
)
<<
"
\"
"
<<
endl
;
g_err
<<
"|- The row:
\"
"
<<
(
*
pRow
)
<<
"
\"
"
<<
endl
;
re
turn
-
1
;
re
sult
=
-
1
;
}
}
return
0
;
}
}
break
;
break
;
case
NdbDictionary
:
:
Column
::
Float
:
{
case
NdbDictionary
:
:
Column
::
Float
:
{
...
@@ -219,18 +216,19 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
...
@@ -219,18 +216,19 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
g_err
<<
"|- Invalid data found:
\"
"
<<
val
<<
"
\"
!=
\"
"
g_err
<<
"|- Invalid data found:
\"
"
<<
val
<<
"
\"
!=
\"
"
<<
cval
<<
"
\"
"
<<
endl
;
<<
cval
<<
"
\"
"
<<
endl
;
g_err
<<
"|- The row:
\"
"
<<
(
*
pRow
)
<<
"
\"
"
<<
endl
;
g_err
<<
"|- The row:
\"
"
<<
(
*
pRow
)
<<
"
\"
"
<<
endl
;
re
turn
-
1
;
re
sult
=
-
1
;
}
}
return
0
;
}
}
break
;
break
;
case
NdbDictionary
:
:
Column
::
Undefined
:
case
NdbDictionary
:
:
Column
::
Undefined
:
default:
assert
(
0
);
result
=
-
1
;
break
;
break
;
}
}
}
}
}
}
assert
(
0
);
return
result
;
return
-
1
;
}
}
int
int
...
...
ndb/test/src/HugoOperations.cpp
View file @
ad258ad5
...
@@ -414,15 +414,18 @@ int HugoOperations::equalForAttr(NdbOperation* pOp,
...
@@ -414,15 +414,18 @@ int HugoOperations::equalForAttr(NdbOperation* pOp,
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
int
len
=
attr
->
getLength
();
switch
(
attr
->
getType
()){
switch
(
attr
->
getType
()){
case
NdbDictionary
:
:
Column
::
Bit
:
case
NdbDictionary
:
:
Column
::
Bit
:
len
=
4
*
((
len
+
31
)
>>
5
);
case
NdbDictionary
:
:
Column
::
Char
:
case
NdbDictionary
:
:
Column
::
Char
:
case
NdbDictionary
:
:
Column
::
Varchar
:
case
NdbDictionary
:
:
Column
::
Varchar
:
case
NdbDictionary
:
:
Column
::
Binary
:
case
NdbDictionary
:
:
Column
::
Binary
:
case
NdbDictionary
:
:
Column
::
Varbinary
:
{
case
NdbDictionary
:
:
Column
::
Varbinary
:
{
char
buf
[
8000
];
char
buf
[
8000
];
memset
(
buf
,
0
,
sizeof
(
buf
));
memset
(
buf
,
0
,
sizeof
(
buf
));
check
=
pOp
->
equal
(
attr
->
getName
(),
calc
.
calcValue
(
rowId
,
attrId
,
0
,
buf
));
check
=
pOp
->
equal
(
attr
->
getName
(),
calc
.
calcValue
(
rowId
,
attrId
,
0
,
buf
,
len
));
break
;
break
;
}
}
case
NdbDictionary
:
:
Column
::
Int
:
case
NdbDictionary
:
:
Column
::
Int
:
...
@@ -452,15 +455,17 @@ int HugoOperations::setValueForAttr(NdbOperation* pOp,
...
@@ -452,15 +455,17 @@ int HugoOperations::setValueForAttr(NdbOperation* pOp,
int
check
=
-
1
;
int
check
=
-
1
;
const
NdbDictionary
::
Column
*
attr
=
tab
.
getColumn
(
attrId
);
const
NdbDictionary
::
Column
*
attr
=
tab
.
getColumn
(
attrId
);
int
len
=
attr
->
getLength
();
switch
(
attr
->
getType
()){
switch
(
attr
->
getType
()){
case
NdbDictionary
:
:
Column
::
Bit
:
case
NdbDictionary
:
:
Column
::
Bit
:
len
=
4
*
((
len
+
31
)
>>
5
);
case
NdbDictionary
:
:
Column
::
Char
:
case
NdbDictionary
:
:
Column
::
Char
:
case
NdbDictionary
:
:
Column
::
Varchar
:
case
NdbDictionary
:
:
Column
::
Varchar
:
case
NdbDictionary
:
:
Column
::
Binary
:
case
NdbDictionary
:
:
Column
::
Binary
:
case
NdbDictionary
:
:
Column
::
Varbinary
:
{
case
NdbDictionary
:
:
Column
::
Varbinary
:
{
char
buf
[
8000
];
char
buf
[
8000
];
check
=
pOp
->
setValue
(
attr
->
getName
(),
check
=
pOp
->
setValue
(
attr
->
getName
(),
calc
.
calcValue
(
rowId
,
attrId
,
updateId
,
buf
));
calc
.
calcValue
(
rowId
,
attrId
,
updateId
,
buf
,
len
));
break
;
break
;
}
}
case
NdbDictionary
:
:
Column
::
Int
:
{
case
NdbDictionary
:
:
Column
::
Int
:
{
...
...
ndb/test/tools/Makefile.am
View file @
ad258ad5
ndbtest_PROGRAMS
=
hugo
Calculator hugo
Load hugoFill hugoLockRecords hugoPkDelete hugoPkRead hugoPkReadRecord hugoPkUpdate hugoScanRead hugoScanUpdate restart verify_index copy_tab create_index ndb_cpcc
ndbtest_PROGRAMS
=
hugoLoad hugoFill hugoLockRecords hugoPkDelete hugoPkRead hugoPkReadRecord hugoPkUpdate hugoScanRead hugoScanUpdate restart verify_index copy_tab create_index ndb_cpcc
# transproxy
# transproxy
...
...
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