Fix redis
This commit is contained in:
parent
5b6b6c97fc
commit
1bd7977348
@ -89,12 +89,17 @@ if(USE_POSTGRESQL)
|
|||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(redis_lib "")
|
||||||
|
if(USE_REDIS)
|
||||||
|
set(redis_lib ${REDIS_LIBRARY})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
#link_directories (../wingetopt)
|
#link_directories (../wingetopt)
|
||||||
# Fügen Sie der ausführbaren Datei für dieses Projekt eine Quelle hinzu.
|
# Fügen Sie der ausführbaren Datei für dieses Projekt eine Quelle hinzu.
|
||||||
add_executable (Minetestmapper ${sources})
|
add_executable (Minetestmapper ${sources})
|
||||||
set_target_properties(Minetestmapper PROPERTIES COMPILE_FLAGS -DBUILDER_STATIC_DEFINE)
|
set_target_properties(Minetestmapper PROPERTIES COMPILE_FLAGS -DBUILDER_STATIC_DEFINE)
|
||||||
target_link_libraries(Minetestmapper ${wingetopt_lib} ${LIBGD_LIBRARY} ${ZLIB_LIBRARY} ${SQLITE3_LIBRARY} ${leveldb_lib} ${postgresql_lib})
|
target_link_libraries(Minetestmapper ${wingetopt_lib} ${LIBGD_LIBRARY} ${ZLIB_LIBRARY} ${SQLITE3_LIBRARY} ${leveldb_lib} ${postgresql_lib} ${redis_lib})
|
||||||
# TODO: Fügen Sie bei Bedarf Tests und Installationsziele hinzu.
|
# TODO: Fügen Sie bei Bedarf Tests und Installationsziele hinzu.
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include "db-redis.h"
|
#include "db-redis.h"
|
||||||
#include "types.h"
|
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
|
|
||||||
static inline int64_t stoi64(const std::string &s)
|
static inline int64_t stoi64(const std::string &s)
|
||||||
@ -84,11 +83,11 @@ const DB::BlockPosList &DBRedis::getBlockPosList()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DB::Block DBRedis::getBlockOnPos(const BlockPos &pos)
|
const DB::Block DBRedis::getBlockOnPos(const BlockPos &pos)
|
||||||
{
|
{
|
||||||
redisReply *reply;
|
redisReply *reply;
|
||||||
std::string tmp;
|
std::string tmp;
|
||||||
Block block(pos,reinterpret_cast<const unsigned char *>(""));
|
Block block(pos, {});
|
||||||
|
|
||||||
m_blocksQueriedCount++;
|
m_blocksQueriedCount++;
|
||||||
|
|
||||||
@ -97,7 +96,7 @@ DB::Block DBRedis::getBlockOnPos(const BlockPos &pos)
|
|||||||
throw std::runtime_error(std::string("redis command 'HGET %s %s' failed: ") + ctx->errstr);
|
throw std::runtime_error(std::string("redis command 'HGET %s %s' failed: ") + ctx->errstr);
|
||||||
if (reply->type == REDIS_REPLY_STRING && reply->len != 0) {
|
if (reply->type == REDIS_REPLY_STRING && reply->len != 0) {
|
||||||
m_blocksReadCount++;
|
m_blocksReadCount++;
|
||||||
block = Block(pos, ustring(reinterpret_cast<const unsigned char *>(reply->str), reply->len));
|
block = Block(pos, reinterpret_cast<const unsigned char *>(reply->str), reply->len);
|
||||||
} else
|
} else
|
||||||
throw std::runtime_error("Got wrong response to 'HGET %s %s' command");
|
throw std::runtime_error("Got wrong response to 'HGET %s %s' command");
|
||||||
freeReplyObject(reply);
|
freeReplyObject(reply);
|
||||||
|
@ -14,7 +14,7 @@ public:
|
|||||||
virtual int getBlocksQueriedCount(void);
|
virtual int getBlocksQueriedCount(void);
|
||||||
virtual int getBlocksReadCount(void);
|
virtual int getBlocksReadCount(void);
|
||||||
virtual const BlockPosList &getBlockPosList();
|
virtual const BlockPosList &getBlockPosList();
|
||||||
virtual Block getBlockOnPos(const BlockPos &pos);
|
virtual const Block getBlockOnPos(const BlockPos &pos);
|
||||||
~DBRedis();
|
~DBRedis();
|
||||||
private:
|
private:
|
||||||
int m_blocksReadCount;
|
int m_blocksReadCount;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user