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
770c8ecf
Commit
770c8ecf
authored
Sep 15, 2004
by
joreland@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/jonas/src/mysql-4.1
into mysql.com:/home/jonas/src/mysql-4.1-ndb
parents
452b62b8
9201b78b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
19 deletions
+32
-19
ndb/test/ndbapi/bank/Bank.cpp
ndb/test/ndbapi/bank/Bank.cpp
+32
-19
No files found.
ndb/test/ndbapi/bank/Bank.cpp
View file @
770c8ecf
...
@@ -2097,47 +2097,50 @@ int Bank::increaseSystemValue(SystemValueId sysValId, Uint64 &value){
...
@@ -2097,47 +2097,50 @@ int Bank::increaseSystemValue(SystemValueId sysValId, Uint64 &value){
*
*
*/
*/
DBUG_ENTER
(
"Bank::increaseSystemValue"
);
int
check
;
int
check
;
NdbConnection
*
pTrans
=
m_ndb
.
startTransaction
();
NdbConnection
*
pTrans
=
m_ndb
.
startTransaction
();
if
(
pTrans
==
NULL
){
if
(
pTrans
==
NULL
){
ERR
(
m_ndb
.
getNdbError
());
ERR
(
m_ndb
.
getNdbError
());
return
NDBT_FAILED
;
DBUG_RETURN
(
NDBT_FAILED
)
;
}
}
NdbOperation
*
pOp
=
pTrans
->
getNdbOperation
(
"SYSTEM_VALUES"
);
NdbOperation
*
pOp
=
pTrans
->
getNdbOperation
(
"SYSTEM_VALUES"
);
if
(
pOp
==
NULL
)
{
if
(
pOp
==
NULL
)
{
ERR
(
pTrans
->
getNdbError
());
ERR
(
pTrans
->
getNdbError
());
m_ndb
.
closeTransaction
(
pTrans
);
m_ndb
.
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
DBUG_RETURN
(
NDBT_FAILED
)
;
}
}
check
=
pOp
->
readTupleExclusive
();
check
=
pOp
->
readTupleExclusive
();
// check = pOp->readTuple();
if
(
check
==
-
1
)
{
if
(
check
==
-
1
)
{
ERR
(
pTrans
->
getNdbError
());
ERR
(
pTrans
->
getNdbError
());
m_ndb
.
closeTransaction
(
pTrans
);
m_ndb
.
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
DBUG_RETURN
(
NDBT_FAILED
)
;
}
}
check
=
pOp
->
equal
(
"SYSTEM_VALUES_ID"
,
sysValId
);
check
=
pOp
->
equal
(
"SYSTEM_VALUES_ID"
,
sysValId
);
if
(
check
==
-
1
)
{
if
(
check
==
-
1
)
{
ERR
(
pTrans
->
getNdbError
());
ERR
(
pTrans
->
getNdbError
());
m_ndb
.
closeTransaction
(
pTrans
);
m_ndb
.
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
DBUG_RETURN
(
NDBT_FAILED
)
;
}
}
NdbRecAttr
*
valueRec
=
pOp
->
getValue
(
"VALUE"
);
NdbRecAttr
*
valueRec
=
pOp
->
getValue
(
"VALUE"
);
if
(
valueRec
==
NULL
)
{
if
(
valueRec
==
NULL
)
{
ERR
(
pTrans
->
getNdbError
());
ERR
(
pTrans
->
getNdbError
());
m_ndb
.
closeTransaction
(
pTrans
);
m_ndb
.
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
DBUG_RETURN
(
NDBT_FAILED
)
;
}
}
check
=
pTrans
->
execute
(
NoCommit
);
check
=
pTrans
->
execute
(
NoCommit
);
if
(
check
==
-
1
)
{
if
(
check
==
-
1
)
{
ERR
(
pTrans
->
getNdbError
());
ERR
(
pTrans
->
getNdbError
());
m_ndb
.
closeTransaction
(
pTrans
);
m_ndb
.
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
DBUG_RETURN
(
NDBT_FAILED
)
;
}
}
value
=
valueRec
->
u_64_value
();
value
=
valueRec
->
u_64_value
();
...
@@ -2147,49 +2150,56 @@ int Bank::increaseSystemValue(SystemValueId sysValId, Uint64 &value){
...
@@ -2147,49 +2150,56 @@ int Bank::increaseSystemValue(SystemValueId sysValId, Uint64 &value){
if
(
pOp2
==
NULL
)
{
if
(
pOp2
==
NULL
)
{
ERR
(
pTrans
->
getNdbError
());
ERR
(
pTrans
->
getNdbError
());
m_ndb
.
closeTransaction
(
pTrans
);
m_ndb
.
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
DBUG_RETURN
(
NDBT_FAILED
)
;
}
}
check
=
pOp2
->
updateTuple
();
check
=
pOp2
->
updateTuple
();
if
(
check
==
-
1
)
{
if
(
check
==
-
1
)
{
ERR
(
pTrans
->
getNdbError
());
ERR
(
pTrans
->
getNdbError
());
m_ndb
.
closeTransaction
(
pTrans
);
m_ndb
.
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
DBUG_RETURN
(
NDBT_FAILED
)
;
}
}
check
=
pOp2
->
equal
(
"SYSTEM_VALUES_ID"
,
sysValId
);
check
=
pOp2
->
equal
(
"SYSTEM_VALUES_ID"
,
sysValId
);
if
(
check
==
-
1
)
{
if
(
check
==
-
1
)
{
ERR
(
pTrans
->
getNdbError
());
ERR
(
pTrans
->
getNdbError
());
m_ndb
.
closeTransaction
(
pTrans
);
m_ndb
.
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
DBUG_RETURN
(
NDBT_FAILED
)
;
}
}
check
=
pOp2
->
setValue
(
"VALUE"
,
value
);
check
=
pOp2
->
setValue
(
"VALUE"
,
value
);
if
(
check
==
-
1
)
{
if
(
check
==
-
1
)
{
ERR
(
pTrans
->
getNdbError
());
ERR
(
pTrans
->
getNdbError
());
m_ndb
.
closeTransaction
(
pTrans
);
m_ndb
.
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
DBUG_RETURN
(
NDBT_FAILED
);
}
check
=
pTrans
->
execute
(
NoCommit
);
if
(
check
==
-
1
)
{
ERR
(
pTrans
->
getNdbError
());
m_ndb
.
closeTransaction
(
pTrans
);
DBUG_RETURN
(
NDBT_FAILED
);
}
}
NdbOperation
*
pOp3
=
pTrans
->
getNdbOperation
(
"SYSTEM_VALUES"
);
NdbOperation
*
pOp3
=
pTrans
->
getNdbOperation
(
"SYSTEM_VALUES"
);
if
(
pOp3
==
NULL
)
{
if
(
pOp3
==
NULL
)
{
ERR
(
pTrans
->
getNdbError
());
ERR
(
pTrans
->
getNdbError
());
m_ndb
.
closeTransaction
(
pTrans
);
m_ndb
.
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
DBUG_RETURN
(
NDBT_FAILED
)
;
}
}
check
=
pOp3
->
readTuple
();
check
=
pOp3
->
readTuple
();
if
(
check
==
-
1
)
{
if
(
check
==
-
1
)
{
ERR
(
pTrans
->
getNdbError
());
ERR
(
pTrans
->
getNdbError
());
m_ndb
.
closeTransaction
(
pTrans
);
m_ndb
.
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
DBUG_RETURN
(
NDBT_FAILED
)
;
}
}
check
=
pOp3
->
equal
(
"SYSTEM_VALUES_ID"
,
sysValId
);
check
=
pOp3
->
equal
(
"SYSTEM_VALUES_ID"
,
sysValId
);
if
(
check
==
-
1
)
{
if
(
check
==
-
1
)
{
ERR
(
pTrans
->
getNdbError
());
ERR
(
pTrans
->
getNdbError
());
m_ndb
.
closeTransaction
(
pTrans
);
m_ndb
.
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
DBUG_RETURN
(
NDBT_FAILED
)
;
}
}
// Read new value
// Read new value
...
@@ -2197,28 +2207,31 @@ int Bank::increaseSystemValue(SystemValueId sysValId, Uint64 &value){
...
@@ -2197,28 +2207,31 @@ int Bank::increaseSystemValue(SystemValueId sysValId, Uint64 &value){
if
(
valueNewRec
==
NULL
)
{
if
(
valueNewRec
==
NULL
)
{
ERR
(
pTrans
->
getNdbError
());
ERR
(
pTrans
->
getNdbError
());
m_ndb
.
closeTransaction
(
pTrans
);
m_ndb
.
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
DBUG_RETURN
(
NDBT_FAILED
)
;
}
}
check
=
pTrans
->
execute
(
Commit
);
check
=
pTrans
->
execute
(
Commit
);
if
(
check
==
-
1
)
{
if
(
check
==
-
1
)
{
ERR
(
pTrans
->
getNdbError
());
ERR
(
pTrans
->
getNdbError
());
m_ndb
.
closeTransaction
(
pTrans
);
m_ndb
.
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
DBUG_RETURN
(
NDBT_FAILED
)
;
}
}
// Check that value updated equals the value we read after the update
// Check that value updated equals the value we read after the update
if
(
valueNewRec
->
u_64_value
()
!=
value
){
if
(
valueNewRec
->
u_64_value
()
!=
value
){
printf
(
"value actual=%lld
\n
"
,
valueNewRec
->
u_64_value
());
printf
(
"value expected=%lld actual=%lld
\n
"
,
value
,
valueNewRec
->
u_64_value
());
DBUG_PRINT
(
"info"
,
(
"value expected=%ld actual=%ld"
,
value
,
valueNewRec
->
u_64_value
()));
g_err
<<
"getNextTransactionId: value was not updated"
<<
endl
;
g_err
<<
"getNextTransactionId: value was not updated"
<<
endl
;
m_ndb
.
closeTransaction
(
pTrans
);
m_ndb
.
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
DBUG_RETURN
(
NDBT_FAILED
)
;
}
}
m_ndb
.
closeTransaction
(
pTrans
);
m_ndb
.
closeTransaction
(
pTrans
);
DBUG_RETURN
(
0
);
return
0
;
}
}
int
Bank
::
increaseSystemValue2
(
SystemValueId
sysValId
,
Uint64
&
value
){
int
Bank
::
increaseSystemValue2
(
SystemValueId
sysValId
,
Uint64
&
value
){
...
...
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