Update webstats_common.lua

pull/339/head
midoks 2 years ago
parent 0a5a86625f
commit ed82dd3c12
  1. 6
      plugins/webstats/lua/webstats_common.lua

@ -624,7 +624,8 @@ end
function _M._update_stat_pre(self, db, stat_table, key)
local update_stat_stmt = db:prepare(string.format("INSERT INTO %s(time) SELECT :time WHERE NOT EXISTS(SELECT time FROM %s WHERE time=:time);", stat_table, stat_table))
local local_sql = string.format("INSERT INTO %s(time) SELECT :time WHERE NOT EXISTS(SELECT time FROM %s WHERE time=:time);", stat_table, stat_table)
local update_stat_stmt = db:prepare(local_sql)
update_stat_stmt:bind_names{time=key}
update_stat_stmt:step()
update_stat_stmt:finalize()
@ -640,7 +641,8 @@ end
function _M.update_stat(self, db, stat_table, key, columns)
-- 根据指定表名,更新统计数据
if not columns then return end
local stmt = db:prepare(string.format("INSERT INTO %s(time) SELECT :time WHERE NOT EXISTS(SELECT time FROM %s WHERE time=:time);", stat_table, stat_table))
local local_sql = string.format("INSERT INTO %s(time) SELECT :time WHERE NOT EXISTS(SELECT time FROM %s WHERE time=:time);", stat_table, stat_table)
local stmt = db:prepare(local_sql)
stmt:bind_names{time=key}
local res, err = stmt:step()
stmt:finalize()

Loading…
Cancel
Save