Permalink
Browse files

Merge pull request #5281 from maksqwe/db_error_value_fix

Dbwrappers return error value fix
  • Loading branch information...
2 parents f60bdf7 + afac2ca commit 407eb40180221d27d16cc071fd63b86a1447d9aa @MartijnKaijser MartijnKaijser committed Aug 26, 2014
Showing with 5 additions and 5 deletions.
  1. +1 −1 xbmc/dbwrappers/mysqldataset.cpp
  2. +4 −4 xbmc/dbwrappers/sqlitedataset.cpp
@@ -431,7 +431,7 @@ long MysqlDatabase::nextid(const char* sname) {
CLog::Log(LOGINFO,"Next id is [%.*s] ", (int) lengths[0], row[0]);
sprintf(sqlcmd,"update %s set nextid=%d where seq_name = '%s'",seq_table,id,sname);
mysql_free_result(res);
- if ((last_err = query_with_reconnect(sqlcmd) != 0)) return DB_UNEXPECTED_RESULT;
+ if ((last_err = query_with_reconnect(sqlcmd)) != 0) return DB_UNEXPECTED_RESULT;
return id;
}
return DB_UNEXPECTED_RESULT;
@@ -328,7 +328,7 @@ int SqliteDatabase::drop_analytics(void) {
for (size_t i=0; i < res.records.size(); i++) {
sprintf(sqlcmd,"DROP INDEX '%s'", res.records[i]->at(0).get_asString().c_str());
- if ((last_err = sqlite3_exec(conn, sqlcmd, NULL, NULL, NULL) != SQLITE_OK)) return DB_UNEXPECTED_RESULT;
+ if ((last_err = sqlite3_exec(conn, sqlcmd, NULL, NULL, NULL)) != SQLITE_OK) return DB_UNEXPECTED_RESULT;
}
res.clear();
@@ -338,7 +338,7 @@ int SqliteDatabase::drop_analytics(void) {
for (size_t i=0; i < res.records.size(); i++) {
sprintf(sqlcmd,"DROP VIEW '%s'", res.records[i]->at(0).get_asString().c_str());
- if ((last_err = sqlite3_exec(conn, sqlcmd, NULL, NULL, NULL) != SQLITE_OK)) return DB_UNEXPECTED_RESULT;
+ if ((last_err = sqlite3_exec(conn, sqlcmd, NULL, NULL, NULL)) != SQLITE_OK) return DB_UNEXPECTED_RESULT;
}
res.clear();
@@ -348,7 +348,7 @@ int SqliteDatabase::drop_analytics(void) {
for (size_t i=0; i < res.records.size(); i++) {
sprintf(sqlcmd,"DROP TRIGGER '%s'", res.records[i]->at(0).get_asString().c_str());
- if ((last_err = sqlite3_exec(conn, sqlcmd, NULL, NULL, NULL) != SQLITE_OK)) return DB_UNEXPECTED_RESULT;
+ if ((last_err = sqlite3_exec(conn, sqlcmd, NULL, NULL, NULL)) != SQLITE_OK) return DB_UNEXPECTED_RESULT;
}
// res would be cleared on destruct
@@ -383,7 +383,7 @@ long SqliteDatabase::nextid(const char* sname) {
else {
id = res.records[0]->at(0).get_asInt()+1;
sprintf(sqlcmd,"update %s set nextid=%d where seq_name = '%s'",sequence_table.c_str(),id,sname);
- if ((last_err = sqlite3_exec(conn,sqlcmd,NULL,NULL,NULL) != SQLITE_OK)) return DB_UNEXPECTED_RESULT;
+ if ((last_err = sqlite3_exec(conn,sqlcmd,NULL,NULL,NULL)) != SQLITE_OK) return DB_UNEXPECTED_RESULT;
return id;
}
return DB_UNEXPECTED_RESULT;

0 comments on commit 407eb40

Please sign in to comment.