Skip to content
Snippets Groups Projects
Commit bfcb47a7 authored by Fons Rademakers's avatar Fons Rademakers
Browse files

Fix for TSQLiteServer::Close() issue, fixes ROOT-5642.

Fix by Oliver Freyermuth.
parent af366690
No related branches found
No related tags found
No related merge requests found
......@@ -87,7 +87,12 @@ void TSQLiteServer::Close(Option_t *)
return;
}
sqlite3_close(fSQLite);
if (IsConnected()) {
sqlite3_close(fSQLite);
// Mark as disconnected:
fPort = -1;
fSQLite = NULL;
}
}
//______________________________________________________________________________
......@@ -134,6 +139,11 @@ Bool_t TSQLiteServer::Exec(const char *sql)
// Execute SQL command which does not produce any result sets.
// Returns kTRUE if successful.
if (!IsConnected()) {
Error("Exec", "not connected");
return kFALSE;
}
char *sqlite_err_msg;
int ret = sqlite3_exec(fSQLite, sql, NULL, NULL, &sqlite_err_msg);
if (ret != SQLITE_OK) {
......@@ -333,6 +343,11 @@ TSQLStatement* TSQLiteServer::Statement(const char *sql, Int_t)
return 0;
}
if (!IsConnected()) {
Error("Statement", "not connected");
return 0;
}
sqlite3_stmt *preparedStmt = NULL;
// -1 as we read until we encounter a \0.
......@@ -366,4 +381,3 @@ const char *TSQLiteServer::ServerInfo()
return fSrvInfo.Data();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment