Closing the connection will force the server to close any open transactions, as well as release recordsets in local memory that reference the connection.
 
However curs is not a recordset.  An SQL update is going to return an integer (rows affected) or boolean depending on the which server you use since no recordset is actually requested.

--- On Tue, 2/10/09, Nik Middleton <nik.middleton@noblesolutions.co.uk> wrote:
From: Nik Middleton <nik.middleton@noblesolutions.co.uk>
Subject: [Freeswitch-users] Strange error message
To: freeswitch-users@lists.freeswitch.org
Date: Tuesday, February 10, 2009, 2:04 PM

Hi Guys,

 

I’m baffled by this error.  I’m updating the db on call hang-up If I comment out curs:close() no error, but I’m concerned about memory leaks.  Can anyone tell me what FS is complaining about?

 

The db gets updated in both cases

 

Regards

 

 

 

require "luasql.mysql"

 

function myHangupHook(s, status, arg)

            freeswitch.consoleLog("info", " : They hung up on US!!!\n");

            env = assert (luasql.mysql())

            con = assert (env:connect("xxxxl","xxxxxxxxx","pass","192.168.3.205"))

            curs = assert (con:execute"UPDATE callers SET lastcall = 'BOB' WHERE id = 33292")

            curs:close()

            con:close()

            env:close()

            freeswitch.consoleLog("NOTICE", "myHangupHook: " .. status .. "\n");

    --error()

end

 

 

 

 

2009-02-10 20:53:20 [INFO] switch_cpp.cpp:1086 console_log()  : They hung up on US!!!

2009-02-10 20:53:20 [ERR] mod_lua.cpp:176 lua_parse_and_execute() /usr/local/freeswitch/scripts/helloworld.lua:50: attempt to index global 'curs' (a number value)

stack traceback:

        /usr/local/freeswitch/scripts/helloworld.lua:50: in function </usr/local/freeswitch/scripts/helloworld.lua:45>

        [C]: in function 'hangup'

        /usr/local/freeswitch/scripts/helloworld.lua:70: in main chunk

2009-02-10 20:53:20 [NOTICE] switch_core_session.c:957 switch_core_session_thread() Session 63 (sofia/internal/1001@192.168.3.206) Ended

_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org