summaryrefslogtreecommitdiff
path: root/server/src/luaquerymapper.cc
diff options
context:
space:
mode:
authordeva <deva>2008-09-05 12:24:42 +0000
committerdeva <deva>2008-09-05 12:24:42 +0000
commit2ee36211ba872bc6a944a85a3104a751d4fda254 (patch)
treed6e3cc3da6136b686eeee45b2186f3fd8037ef53 /server/src/luaquerymapper.cc
parent26dc58fb696ac1f96e018fbae7083d1ba2a1a55a (diff)
Made multiple pentominos request work properly (still no reusage of the connection). Also increaed the default ttl to 7 days instead of 1.
Diffstat (limited to 'server/src/luaquerymapper.cc')
-rw-r--r--server/src/luaquerymapper.cc19
1 files changed, 12 insertions, 7 deletions
diff --git a/server/src/luaquerymapper.cc b/server/src/luaquerymapper.cc
index acd6b26..9f8293d 100644
--- a/server/src/luaquerymapper.cc
+++ b/server/src/luaquerymapper.cc
@@ -53,7 +53,7 @@ static std::string loadresultstring(QueryResult &res, std::string group = "")
return s;
}
-LUAQueryMapper::LUAQueryMapper(QueryResult &res)
+LUAQueryMapper::LUAQueryMapper()
{
L = luaL_newstate();
if(L == NULL) {
@@ -63,7 +63,17 @@ LUAQueryMapper::LUAQueryMapper(QueryResult &res)
luaL_openlibs(L);
- std::string preload = loadresultstring(res);
+ clean_top = lua_gettop(L);
+}
+
+LUAQueryMapper::~LUAQueryMapper()
+{
+ lua_close(L);
+}
+
+void LUAQueryMapper::addQueryResult(QueryResult &result)
+{
+ std::string preload = loadresultstring(result);
if(luaL_loadbuffer(L, preload.c_str(), preload.size(), "preload")) {
error(lua_tostring(L, lua_gettop(L)));
@@ -79,11 +89,6 @@ LUAQueryMapper::LUAQueryMapper(QueryResult &res)
clean_top = lua_gettop(L);
}
-LUAQueryMapper::~LUAQueryMapper()
-{
- lua_close(L);
-}
-
Value LUAQueryMapper::map(const std::string &mapper)
{
Value v;