Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
cta
Commits
5e39f376
Commit
5e39f376
authored
May 29, 2018
by
Steven Murray
Browse files
Renamed DatabaseConstraintViolation to DatabaseConstraintError
parent
fc963e95
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
catalogue/RdbmsCatalogue.cpp
View file @
5e39f376
This diff is collapsed.
Click to expand it.
catalogue/SqliteCatalogue.cpp
View file @
5e39f376
...
...
@@ -16,13 +16,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include
<common/exception/DatabaseConstraintViolation.hpp>
#include
"catalogue/ArchiveFileRow.hpp"
#include
"catalogue/ChecksumTypeMismatch.hpp"
#include
"catalogue/ChecksumValueMismatch.hpp"
#include
"catalogue/FileSizeMismatch.hpp"
#include
"catalogue/SqliteCatalogueSchema.hpp"
#include
"catalogue/SqliteCatalogue.hpp"
#include
"common/exception/DatabaseConstraintError.hpp"
#include
"common/exception/Exception.hpp"
#include
"common/exception/UserError.hpp"
#include
"common/make_unique.hpp"
...
...
@@ -447,7 +447,7 @@ void SqliteCatalogue::fileWrittenToTape(const rdbms::AutocommitMode autocommitMo
row
.
diskFileGroup
=
event
.
diskFileGroup
;
row
.
diskFileRecoveryBlob
=
event
.
diskFileRecoveryBlob
;
insertArchiveFile
(
conn
,
autocommitMode
,
row
);
}
catch
(
exception
::
DatabaseConstraint
Violation
&
)
{
}
catch
(
exception
::
DatabaseConstraint
Error
&
)
{
// Ignore this error
}
catch
(...)
{
throw
;
...
...
common/CMakeLists.txt
View file @
5e39f376
...
...
@@ -79,7 +79,7 @@ set (COMMON_LIB_SRC_FILES
exception/Backtrace.cpp
exception/BadAlloc.cpp
exception/CommandLineNotParsed.cpp
exception/DatabaseConstraint
Violation
.cpp
exception/DatabaseConstraint
Error
.cpp
exception/DismountFailed.cpp
exception/Errnum.cpp
exception/Exception.cpp
...
...
common/exception/DatabaseConstraint
Violation
.cpp
→
common/exception/DatabaseConstraint
Error
.cpp
View file @
5e39f376
...
...
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include
"common/exception/DatabaseConstraint
Violation
.hpp"
#include
"common/exception/DatabaseConstraint
Error
.hpp"
namespace
cta
{
namespace
exception
{
...
...
@@ -24,14 +24,14 @@ namespace exception {
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
DatabaseConstraint
Violation
::
DatabaseConstraint
Violation
(
const
std
::
string
&
context
,
const
bool
embedBacktrace
)
:
DatabaseConstraint
Error
::
DatabaseConstraint
Error
(
const
std
::
string
&
context
,
const
bool
embedBacktrace
)
:
Exception
(
context
,
embedBacktrace
)
{
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
DatabaseConstraint
Violation
::~
DatabaseConstraint
Violation
()
noexcept
{
DatabaseConstraint
Error
::~
DatabaseConstraint
Error
()
noexcept
{
}
}
// namespace exception
...
...
common/exception/DatabaseConstraint
Violation
.hpp
→
common/exception/DatabaseConstraint
Error
.hpp
View file @
5e39f376
...
...
@@ -27,9 +27,9 @@ namespace cta {
namespace
exception
{
/**
* A database constraint
has been violated
.
* A database constraint
error
.
*/
class
DatabaseConstraint
Violation
:
public
cta
::
exception
::
Exception
{
class
DatabaseConstraint
Error
:
public
cta
::
exception
::
Exception
{
public:
/**
...
...
@@ -40,15 +40,15 @@ public:
* @param embedBacktrace whether to embed a backtrace of where the
* exception was throw in the message
*/
DatabaseConstraint
Violation
(
const
std
::
string
&
context
=
""
,
const
bool
embedBacktrace
=
true
);
DatabaseConstraint
Error
(
const
std
::
string
&
context
=
""
,
const
bool
embedBacktrace
=
true
);
/**
* Empty Destructor, explicitely non-throwing (needed for std::exception
* inheritance)
*/
~
DatabaseConstraint
Violation
()
noexcept
override
;
~
DatabaseConstraint
Error
()
noexcept
override
;
};
// class DatabaseConstraint
Violation
};
// class DatabaseConstraint
Error
}
// namespace exception
}
// namespace cta
rdbms/wrapper/SqliteRset.cpp
View file @
5e39f376
...
...
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include
"common/exception/DatabaseConstraint
Violation
.hpp"
#include
"common/exception/DatabaseConstraint
Error
.hpp"
#include
"common/exception/Exception.hpp"
#include
"common/exception/Errnum.hpp"
#include
"rdbms/NullDbValue.hpp"
...
...
@@ -156,7 +156,7 @@ bool SqliteRset::next() {
Sqlite
::
rcToStr
(
stepRc
);
if
(
SQLITE_CONSTRAINT
==
stepRc
)
{
throw
exception
::
DatabaseConstraint
Violation
(
msg
.
str
());
throw
exception
::
DatabaseConstraint
Error
(
msg
.
str
());
}
else
{
throw
exception
::
Exception
(
msg
.
str
());
}
...
...
rdbms/wrapper/SqliteStmt.cpp
View file @
5e39f376
...
...
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include
"common/exception/DatabaseConstraint
Violation
.hpp"
#include
"common/exception/DatabaseConstraint
Error
.hpp"
#include
"common/exception/Exception.hpp"
#include
"common/make_unique.hpp"
#include
"common/threading/MutexLocker.hpp"
...
...
@@ -267,7 +267,7 @@ void SqliteStmt::executeNonQuery() {
msg
<<
__FUNCTION__
<<
" failed for SQL statement "
<<
getSqlForException
()
+
": "
<<
Sqlite
::
rcToStr
(
stepRc
);
if
(
SQLITE_CONSTRAINT
==
stepRc
)
{
throw
exception
::
DatabaseConstraint
Violation
(
msg
.
str
());
throw
exception
::
DatabaseConstraint
Error
(
msg
.
str
());
}
else
{
throw
exception
::
Exception
(
msg
.
str
());
}
...
...
rdbms/wrapper/SqliteStmtTest.cpp
View file @
5e39f376
...
...
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include
"common/exception/DatabaseConstraint
Violation
.hpp"
#include
"common/exception/DatabaseConstraint
Error
.hpp"
#include
"rdbms/wrapper/SqliteConn.hpp"
#include
"rdbms/wrapper/SqliteRset.hpp"
#include
"rdbms/wrapper/SqliteStmt.hpp"
...
...
@@ -401,7 +401,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, executeNonQuery_insert_violating_primar
":COL1);"
;
auto
stmt
=
conn
.
createStmt
(
sql
,
rdbms
::
AutocommitMode
::
ON
);
stmt
->
bindUint64
(
":COL1"
,
1
);
ASSERT_THROW
(
stmt
->
executeNonQuery
(),
exception
::
DatabaseConstraint
Violation
);
ASSERT_THROW
(
stmt
->
executeNonQuery
(),
exception
::
DatabaseConstraint
Error
);
}
}
...
...
@@ -448,7 +448,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, executeQuery_insert_violating_primary_k
auto
stmt
=
conn
.
createStmt
(
sql
,
rdbms
::
AutocommitMode
::
ON
);
stmt
->
bindUint64
(
":COL1"
,
1
);
auto
rset
=
stmt
->
executeQuery
();
ASSERT_THROW
(
rset
->
next
(),
exception
::
DatabaseConstraint
Violation
);
ASSERT_THROW
(
rset
->
next
(),
exception
::
DatabaseConstraint
Error
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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