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
38d63c30
Commit
38d63c30
authored
Jul 05, 2006
by
pekka@clam.ndb.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ndb - ndb api : try to catch autoincr 'error 0'
parent
7b876a71
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
15 deletions
+27
-15
storage/ndb/src/ndbapi/Ndb.cpp
storage/ndb/src/ndbapi/Ndb.cpp
+27
-15
No files found.
storage/ndb/src/ndbapi/Ndb.cpp
View file @
38d63c30
...
@@ -1025,14 +1025,19 @@ int Ndb::initAutoIncrement()
...
@@ -1025,14 +1025,19 @@ int Ndb::initAutoIncrement()
setDatabaseName
(
"sys"
);
setDatabaseName
(
"sys"
);
setDatabaseSchemaName
(
"def"
);
setDatabaseSchemaName
(
"def"
);
m_sys_tab_0
=
getDictionary
()
->
getTableGlobal
(
"SYSTAB_0"
);
m_sys_tab_0
=
theDictionary
->
getTableGlobal
(
"SYSTAB_0"
);
// Restore current name space
// Restore current name space
setDatabaseName
(
currentDb
.
c_str
());
setDatabaseName
(
currentDb
.
c_str
());
setDatabaseSchemaName
(
currentSchema
.
c_str
());
setDatabaseSchemaName
(
currentSchema
.
c_str
());
if
(
m_sys_tab_0
==
NULL
)
{
assert
(
theDictionary
->
m_error
.
code
!=
0
);
theError
.
code
=
theDictionary
->
m_error
.
code
;
return
-
1
;
}
return
(
m_sys_tab_0
==
NULL
)
;
return
0
;
}
}
int
int
...
@@ -1043,19 +1048,19 @@ Ndb::opTupleIdOnNdb(const NdbTableImpl* table,
...
@@ -1043,19 +1048,19 @@ Ndb::opTupleIdOnNdb(const NdbTableImpl* table,
Uint32
aTableId
=
table
->
m_id
;
Uint32
aTableId
=
table
->
m_id
;
DBUG_PRINT
(
"enter"
,
(
"table=%u value=%llu op=%u"
,
aTableId
,
opValue
,
op
));
DBUG_PRINT
(
"enter"
,
(
"table=%u value=%llu op=%u"
,
aTableId
,
opValue
,
op
));
NdbTransaction
*
tConnection
;
NdbTransaction
*
tConnection
=
NULL
;
NdbOperation
*
tOperation
=
0
;
// Compiler warning if not initialized
NdbOperation
*
tOperation
=
NULL
;
Uint64
tValue
;
Uint64
tValue
;
NdbRecAttr
*
tRecAttrResult
;
NdbRecAttr
*
tRecAttrResult
;
CHECK_STATUS_MACRO
_ZERO
;
CHECK_STATUS_MACRO
;
if
(
initAutoIncrement
())
if
(
initAutoIncrement
()
==
-
1
)
goto
error_
return
;
goto
error_
handler
;
tConnection
=
this
->
startTransaction
();
tConnection
=
this
->
startTransaction
();
if
(
tConnection
==
NULL
)
if
(
tConnection
==
NULL
)
goto
error_
return
;
goto
error_
handler
;
tOperation
=
tConnection
->
getNdbOperation
(
m_sys_tab_0
);
tOperation
=
tConnection
->
getNdbOperation
(
m_sys_tab_0
);
if
(
tOperation
==
NULL
)
if
(
tOperation
==
NULL
)
...
@@ -1065,7 +1070,7 @@ Ndb::opTupleIdOnNdb(const NdbTableImpl* table,
...
@@ -1065,7 +1070,7 @@ Ndb::opTupleIdOnNdb(const NdbTableImpl* table,
{
{
case
0
:
case
0
:
tOperation
->
interpretedUpdateTuple
();
tOperation
->
interpretedUpdateTuple
();
tOperation
->
equal
(
"SYSKEY_0"
,
aTableId
);
tOperation
->
equal
(
"SYSKEY_0"
,
aTableId
);
tOperation
->
incValue
(
"NEXTID"
,
opValue
);
tOperation
->
incValue
(
"NEXTID"
,
opValue
);
tRecAttrResult
=
tOperation
->
getValue
(
"NEXTID"
);
tRecAttrResult
=
tOperation
->
getValue
(
"NEXTID"
);
...
@@ -1130,14 +1135,21 @@ Ndb::opTupleIdOnNdb(const NdbTableImpl* table,
...
@@ -1130,14 +1135,21 @@ Ndb::opTupleIdOnNdb(const NdbTableImpl* table,
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
error_handler:
error_handler:
theError
.
code
=
tConnection
->
theError
.
code
;
this
->
closeTransaction
(
tConnection
);
error_return:
DBUG_PRINT
(
"error"
,
(
"ndb=%d con=%d op=%d"
,
DBUG_PRINT
(
"error"
,
(
"ndb=%d con=%d op=%d"
,
theError
.
code
,
theError
.
code
,
tConnection
?
tConnection
->
theError
.
code
:
-
1
,
tConnection
!=
NULL
?
tConnection
->
theError
.
code
:
-
1
,
tOperation
?
tOperation
->
theError
.
code
:
-
1
));
tOperation
!=
NULL
?
tOperation
->
theError
.
code
:
-
1
));
if
(
theError
.
code
==
0
&&
tConnection
!=
NULL
)
theError
.
code
=
tConnection
->
theError
.
code
;
if
(
theError
.
code
==
0
&&
tOperation
!=
NULL
)
theError
.
code
=
tOperation
->
theError
.
code
;
DBUG_ASSERT
(
theError
.
code
!=
0
);
if
(
tConnection
!=
NULL
)
this
->
closeTransaction
(
tConnection
);
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
-
1
);
}
}
...
...
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