aboutsummaryrefslogtreecommitdiff
path: root/src/shared/Database/SQLStorageImpl.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/Database/SQLStorageImpl.h')
-rw-r--r--src/shared/Database/SQLStorageImpl.h7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/shared/Database/SQLStorageImpl.h b/src/shared/Database/SQLStorageImpl.h
index 5ad8a66679a..c74be48c34c 100644
--- a/src/shared/Database/SQLStorageImpl.h
+++ b/src/shared/Database/SQLStorageImpl.h
@@ -122,7 +122,7 @@ void SQLStorageLoaderBase<T>::Load(SQLStorage &store)
{
uint32 maxi;
Field *fields;
- QueryResult *result = WorldDatabase.PQuery("SELECT MAX(%s) FROM %s", store.entry_field, store.table);
+ QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT MAX(%s) FROM %s", store.entry_field, store.table);
if(!result)
{
sLog.outError("Error loading %s table (not exist?)\n", store.table);
@@ -130,14 +130,12 @@ void SQLStorageLoaderBase<T>::Load(SQLStorage &store)
}
maxi = (*result)[0].GetUInt32()+1;
- delete result;
result = WorldDatabase.PQuery("SELECT COUNT(*) FROM %s", store.table);
if(result)
{
fields = result->Fetch();
store.RecordCount = fields[0].GetUInt32();
- delete result;
}
else
store.RecordCount = 0;
@@ -158,7 +156,6 @@ void SQLStorageLoaderBase<T>::Load(SQLStorage &store)
{
store.RecordCount = 0;
sLog.outError("Error in %s table, probably sql file format was updated (there should be %d fields in sql).\n", store.table, store.iNumFields);
- delete result;
exit(1); // Stop server at loading broken or non-compatible table.
}
@@ -206,8 +203,6 @@ void SQLStorageLoaderBase<T>::Load(SQLStorage &store)
++count;
}while( result->NextRow() );
- delete result;
-
store.pIndex = newIndex;
store.MaxEntry = maxi;
store.data = _data;