mirror of
https://github.com/moparisthebest/minetest
synced 2024-12-23 16:08:51 -05:00
Fix statement not set NULL on deletion
Make local only variables static
This commit is contained in:
parent
09ba047c01
commit
24face5249
@ -36,17 +36,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
|
|
||||||
#define POINTS_PER_NODE (16.0)
|
#define POINTS_PER_NODE (16.0)
|
||||||
|
|
||||||
std::string dbp;
|
static std::string dbp;
|
||||||
sqlite3* dbh;
|
static sqlite3* dbh = NULL;
|
||||||
sqlite3_stmt* dbs_insert;
|
static sqlite3_stmt* dbs_insert = NULL;
|
||||||
sqlite3_stmt* dbs_replace;
|
static sqlite3_stmt* dbs_replace = NULL;
|
||||||
sqlite3_stmt* dbs_select;
|
static sqlite3_stmt* dbs_select = NULL;
|
||||||
sqlite3_stmt* dbs_select_range;
|
static sqlite3_stmt* dbs_select_range = NULL;
|
||||||
sqlite3_stmt* dbs_select_withActor;
|
static sqlite3_stmt* dbs_select_withActor = NULL;
|
||||||
sqlite3_stmt* dbs_knownActor_select;
|
static sqlite3_stmt* dbs_knownActor_select = NULL;
|
||||||
sqlite3_stmt* dbs_knownActor_insert;
|
static sqlite3_stmt* dbs_knownActor_insert = NULL;
|
||||||
sqlite3_stmt* dbs_knownNode_select;
|
static sqlite3_stmt* dbs_knownNode_select = NULL;
|
||||||
sqlite3_stmt* dbs_knownNode_insert;
|
static sqlite3_stmt* dbs_knownNode_insert = NULL;
|
||||||
|
|
||||||
struct Stack {
|
struct Stack {
|
||||||
int node;
|
int node;
|
||||||
@ -1094,6 +1094,7 @@ public:
|
|||||||
#define FINALIZE_STATEMENT(statement) \
|
#define FINALIZE_STATEMENT(statement) \
|
||||||
if ( statement ) \
|
if ( statement ) \
|
||||||
rc = sqlite3_finalize(statement); \
|
rc = sqlite3_finalize(statement); \
|
||||||
|
statement = NULL; \
|
||||||
if ( rc != SQLITE_OK ) \
|
if ( rc != SQLITE_OK ) \
|
||||||
errorstream << "RollbackManager::~RollbackManager():" \
|
errorstream << "RollbackManager::~RollbackManager():" \
|
||||||
<< "Failed to finalize: " << #statement << ": rc=" << rc << std::endl;
|
<< "Failed to finalize: " << #statement << ": rc=" << rc << std::endl;
|
||||||
@ -1117,6 +1118,8 @@ public:
|
|||||||
if(dbh)
|
if(dbh)
|
||||||
rc = sqlite3_close(dbh);
|
rc = sqlite3_close(dbh);
|
||||||
|
|
||||||
|
dbh = NULL;
|
||||||
|
|
||||||
if (rc != SQLITE_OK) {
|
if (rc != SQLITE_OK) {
|
||||||
errorstream << "RollbackManager::~RollbackManager(): "
|
errorstream << "RollbackManager::~RollbackManager(): "
|
||||||
<< "Failed to close database: rc=" << rc << std::endl;
|
<< "Failed to close database: rc=" << rc << std::endl;
|
||||||
|
Loading…
Reference in New Issue
Block a user