summaryrefslogtreecommitdiff
path: root/src/database/database-sqlite3.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/database/database-sqlite3.cpp')
-rw-r--r--src/database/database-sqlite3.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/database/database-sqlite3.cpp b/src/database/database-sqlite3.cpp
index 4560743b9..116096f68 100644
--- a/src/database/database-sqlite3.cpp
+++ b/src/database/database-sqlite3.cpp
@@ -121,7 +121,7 @@ Database_SQLite3::Database_SQLite3(const std::string &savedir, const std::string
void Database_SQLite3::beginSave()
{
- verifyDatabase();
+ pingDatabase();
SQLRES(sqlite3_step(m_stmt_begin), SQLITE_DONE,
"Failed to start SQLite3 transaction");
sqlite3_reset(m_stmt_begin);
@@ -129,7 +129,7 @@ void Database_SQLite3::beginSave()
void Database_SQLite3::endSave()
{
- verifyDatabase();
+ pingDatabase();
SQLRES(sqlite3_step(m_stmt_end), SQLITE_DONE,
"Failed to commit SQLite3 transaction");
sqlite3_reset(m_stmt_end);
@@ -171,7 +171,7 @@ void Database_SQLite3::openDatabase()
"Failed to enable sqlite3 foreign key support");
}
-void Database_SQLite3::verifyDatabase()
+void Database_SQLite3::pingDatabase()
{
if (m_initialized) return;
@@ -247,7 +247,7 @@ inline void MapDatabaseSQLite3::bindPos(sqlite3_stmt *stmt, const v3s16 &pos, in
bool MapDatabaseSQLite3::deleteBlock(const v3s16 &pos)
{
- verifyDatabase();
+ pingDatabase();
bindPos(m_stmt_delete, pos);
@@ -263,7 +263,7 @@ bool MapDatabaseSQLite3::deleteBlock(const v3s16 &pos)
bool MapDatabaseSQLite3::saveBlock(const v3s16 &pos, const std::string &data)
{
- verifyDatabase();
+ pingDatabase();
#ifdef __ANDROID__
/**
@@ -290,7 +290,7 @@ bool MapDatabaseSQLite3::saveBlock(const v3s16 &pos, const std::string &data)
void MapDatabaseSQLite3::loadBlock(const v3s16 &pos, std::string *block)
{
- verifyDatabase();
+ pingDatabase();
bindPos(m_stmt_read, pos);
@@ -311,7 +311,7 @@ void MapDatabaseSQLite3::loadBlock(const v3s16 &pos, std::string *block)
void MapDatabaseSQLite3::listAllLoadableBlocks(std::vector<v3s16> &dst)
{
- verifyDatabase();
+ pingDatabase();
while (sqlite3_step(m_stmt_list) == SQLITE_ROW)
dst.push_back(getIntegerAsBlock(sqlite3_column_int64(m_stmt_list, 0)));
@@ -439,7 +439,7 @@ void PlayerDatabaseSQLite3::initStatements()
bool PlayerDatabaseSQLite3::playerDataExists(const std::string &name)
{
- verifyDatabase();
+ pingDatabase();
str_to_sqlite(m_stmt_player_load, 1, name);
bool res = (sqlite3_step(m_stmt_player_load) == SQLITE_ROW);
sqlite3_reset(m_stmt_player_load);
@@ -536,7 +536,7 @@ void PlayerDatabaseSQLite3::savePlayer(RemotePlayer *player)
bool PlayerDatabaseSQLite3::loadPlayer(RemotePlayer *player, PlayerSAO *sao)
{
- verifyDatabase();
+ pingDatabase();
str_to_sqlite(m_stmt_player_load, 1, player->getName());
if (sqlite3_step(m_stmt_player_load) != SQLITE_ROW) {
@@ -600,7 +600,7 @@ bool PlayerDatabaseSQLite3::removePlayer(const std::string &name)
void PlayerDatabaseSQLite3::listPlayers(std::vector<std::string> &res)
{
- verifyDatabase();
+ pingDatabase();
while (sqlite3_step(m_stmt_player_list) == SQLITE_ROW)
res.push_back(sqlite_to_string(m_stmt_player_list, 0));
@@ -673,7 +673,7 @@ void AuthDatabaseSQLite3::initStatements()
bool AuthDatabaseSQLite3::getAuth(const std::string &name, AuthEntry &res)
{
- verifyDatabase();
+ pingDatabase();
str_to_sqlite(m_stmt_read, 1, name);
if (sqlite3_step(m_stmt_read) != SQLITE_ROW) {
sqlite3_reset(m_stmt_read);
@@ -735,7 +735,7 @@ bool AuthDatabaseSQLite3::createAuth(AuthEntry &authEntry)
bool AuthDatabaseSQLite3::deleteAuth(const std::string &name)
{
- verifyDatabase();
+ pingDatabase();
str_to_sqlite(m_stmt_delete, 1, name);
sqlite3_vrfy(sqlite3_step(m_stmt_delete), SQLITE_DONE);
@@ -749,7 +749,7 @@ bool AuthDatabaseSQLite3::deleteAuth(const std::string &name)
void AuthDatabaseSQLite3::listNames(std::vector<std::string> &res)
{
- verifyDatabase();
+ pingDatabase();
while (sqlite3_step(m_stmt_list_names) == SQLITE_ROW) {
res.push_back(sqlite_to_string(m_stmt_list_names, 0));