Lua 5.1 ODBC Actions plugin updated to version 2.9.0.0
The current release of the ODBC actions plugin adds a new function: ODBC.GetLastException(), which allows to retrieve the error message from a SQL server when an exception happens. Exceptions are triggered when there is a syntax problem with the SQL statement, for example, so the error message can provide hints regarding wrong data submitted. Exceptions can also happen when there is a processing/memory problem on the server side.
Sample use demonstrating the new action:
result = ODBC.ExecuteSQL(sCommand);
if (result ~= 0) then
-- ExecuteSQL signalized an error
error = Application.GetLastError();
-- what error?
if (error == 12002) then -- SQL exception Dialog.Message("ODBC Plugin", "SQL Exception: ".. ODBC.GetLastException(), MB_OK, MB_ICONSTOP); elseif (error == 12006) then -- memory exception Dialog.Message("ODBC Plugin", "Memory Exception: ".. ODBC.GetLastException(), MB_OK, MB_ICONSTOP); else -- some other kind of error Dialog.Message("ODBC Plugin", "ExecuteSQL failed (" .. error .. ")", MB_OK, MB_ICONSTOP); end end