From 994bed45a8c8f6833acbdb9250eb4ad531717111 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Fri, 24 Aug 2018 19:49:58 +0200 Subject: 2018-08-24 19:26:00 --- tex/context/base/mkiv/util-sql-imp-ffi.lua | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'tex/context/base/mkiv/util-sql-imp-ffi.lua') diff --git a/tex/context/base/mkiv/util-sql-imp-ffi.lua b/tex/context/base/mkiv/util-sql-imp-ffi.lua index e18736171..c4086d561 100644 --- a/tex/context/base/mkiv/util-sql-imp-ffi.lua +++ b/tex/context/base/mkiv/util-sql-imp-ffi.lua @@ -278,6 +278,7 @@ local function execute(t,query) if query and query ~= "" then local connection = t._connection_ local result = mysql_execute_query(connection,query,#query) +print(connection,result,query) if result == 0 then local result = mysql_store_result(connection) if result ~= NULL then @@ -331,6 +332,7 @@ local function open(t,database,username,password,host,port) local t = { _connection_ = connection, } +-- ffi_gc(connection, mysql_close) return setmetatable(t,mt) end end @@ -348,13 +350,14 @@ local mt = { connect = open, close = close, message = message, - } + }, } local function initialize() local session = { _session_ = mysql_initialize(instance) -- maybe share, single thread anyway } + -- ffi_gc(session, mysql_close) return setmetatable(session,mt) end @@ -457,10 +460,11 @@ local function datafetched(specification,query,converter) if type(r) == "table" then result = r okay = true - elseif not m then + elseif not m then okay = true end end + local data, keys if result then if converter then @@ -477,25 +481,13 @@ local function datafetched(specification,query,converter) report_state("message %s",message) end - if not result then -- can go - if session then - session:close() - end - if connection then - connection:close() - end - if id then - cache[id] = nil - end - return "execution error" - end - if not keys then keys = { } end if not data then data = { } end + if not id then if connection then connection:close() -- cgit v1.2.3