Fix redis
This commit is contained in:
parent
5b6b6c97fc
commit
1bd7977348
@ -89,12 +89,17 @@ if(USE_POSTGRESQL)
|
||||
endif(WIN32)
|
||||
endif()
|
||||
|
||||
set(redis_lib "")
|
||||
if(USE_REDIS)
|
||||
set(redis_lib ${REDIS_LIBRARY})
|
||||
endif()
|
||||
|
||||
|
||||
#link_directories (../wingetopt)
|
||||
# Fügen Sie der ausführbaren Datei für dieses Projekt eine Quelle hinzu.
|
||||
add_executable (Minetestmapper ${sources})
|
||||
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.
|
||||
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include "db-redis.h"
|
||||
#include "types.h"
|
||||
#include "Settings.h"
|
||||
|
||||
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;
|
||||
std::string tmp;
|
||||
Block block(pos,reinterpret_cast<const unsigned char *>(""));
|
||||
Block block(pos, {});
|
||||
|
||||
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);
|
||||
if (reply->type == REDIS_REPLY_STRING && reply->len != 0) {
|
||||
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
|
||||
throw std::runtime_error("Got wrong response to 'HGET %s %s' command");
|
||||
freeReplyObject(reply);
|
||||
|
@ -14,7 +14,7 @@ public:
|
||||
virtual int getBlocksQueriedCount(void);
|
||||
virtual int getBlocksReadCount(void);
|
||||
virtual const BlockPosList &getBlockPosList();
|
||||
virtual Block getBlockOnPos(const BlockPos &pos);
|
||||
virtual const Block getBlockOnPos(const BlockPos &pos);
|
||||
~DBRedis();
|
||||
private:
|
||||
int m_blocksReadCount;
|
||||
|
Loading…
x
Reference in New Issue
Block a user