summaryrefslogtreecommitdiff
path: root/libmysqlpp
diff options
context:
space:
mode:
Diffstat (limited to 'libmysqlpp')
-rw-r--r--libmysqlpp/connection.cpp24
-rw-r--r--libmysqlpp/connection.h1
2 files changed, 12 insertions, 13 deletions
diff --git a/libmysqlpp/connection.cpp b/libmysqlpp/connection.cpp
index f2b747a..65e7303 100644
--- a/libmysqlpp/connection.cpp
+++ b/libmysqlpp/connection.cpp
@@ -60,7 +60,9 @@ int
MySQL::Connection::beginTx() const
{
if (txDepth == 0) {
- checkResult(mysql_autocommit(&conn, 0), true);
+ if (mysql_autocommit(&conn, 0)) {
+ throw Error(mysql_error(&conn));
+ }
rolledback = false;
}
return ++txDepth;
@@ -73,7 +75,9 @@ MySQL::Connection::commitTx() const
return rollbackTx();
}
if (--txDepth == 0) {
- checkResult(mysql_commit(&conn), true);
+ if (mysql_commit(&conn)) {
+ throw Error(mysql_error(&conn));
+ }
}
return txDepth;
}
@@ -82,7 +86,9 @@ int
MySQL::Connection::rollbackTx() const
{
if (--txDepth == 0) {
- checkResult(mysql_rollback(&conn), true);
+ if (mysql_rollback(&conn)) {
+ throw Error(mysql_error(&conn));
+ }
}
else {
rolledback = true;
@@ -111,7 +117,9 @@ MySQL::Connection::bulkUpdateStyle() const
void
MySQL::Connection::ping() const
{
- checkResult(mysql_ping(&conn), true);
+ if (mysql_ping(&conn)) {
+ throw Error(mysql_error(&conn));
+ }
}
@@ -128,14 +136,6 @@ MySQL::Connection::newModifyCommand(const std::string & sql) const
}
void
-MySQL::Connection::checkResult(my_bool actual, my_bool expected) const
-{
- if (actual != expected) {
- throw Error(mysql_error(&conn));
- }
-}
-
-void
MySQL::Connection::beginBulkUpload(const char * table, const char * extra) const
{
(void)table;
diff --git a/libmysqlpp/connection.h b/libmysqlpp/connection.h
index a88d758..0524009 100644
--- a/libmysqlpp/connection.h
+++ b/libmysqlpp/connection.h
@@ -32,7 +32,6 @@ namespace MySQL {
private:
my_bool my_true;
- void checkResult(my_bool actual, my_bool expected) const;
mutable unsigned int txDepth;
mutable bool rolledback;
};