INM Lua IDE have been updated with support for SQL queries. Currently supported by the TLuaDB API is the ODBC client type. In future releases this will be expanded to cover native support for MySQL, SQL Server, Oracle, Postgress, IBM DB and Interbase. INM 3.3 will have this API included, this IDE release is intended for developers that will get a head start developing new Lua scripts. The update IDE can be downloaded here: Download page Documentation Please post any feedback in this blog post. Here follows an example how to use the new API, TLuaDB. CODE ----------------------------------------------------------------------------------------------------------
-- INM Lua API example (C) 2007 Intellipool AB -- Demonstrates the Lua database interface ---------------------------------------------------------------------------------------------------------- -- Create new DB object DB = TLuaDB(); -- Connect to a DSN if (DB:Connect("DSN=testdsn;",TLuaDB.CLIENT_ODBC) == true) then -- Insert a few rows bok = DB:Execute("insert into test (iID,sTest) values(10,'test');"); -- Select all rows in table bok = DB:Execute("select * from test;"); if ( bok == true) then -- Check if we got rows back if(DB:ResultAvilable() == true) then -- Print how many columns this table contains iColCount = DB:ColCount(); print("Columns in this table: "..iColCount); -- Get first row while (DB:NextRow() == true) do for iCurrentCol = 1, iColCount do -- GetColType and GetCol take a 1 based index iColType = DB:GetColType(iCurrentCol); sData = DB:GetCol(iCurrentCol); -- Print column #, column type and data print("Col #"..iCurrentCol.." Type: "..iColType.." Data: "..sData); end end end else -- Print error and exit SetExitStatus("Failed" .. DB:GetErrorDescription(),false); end else -- Print error and exit SetExitStatus("Failed to connect"..DB:GetErrorDescription(),false); end
|
About Intellipool
Intellipool is a privately held software developer based in Sundsvall, Sweden. This blog is here to post news and tips regarding our product Intellipool Network Monitor.
Intellipool Network Monitor is a system for agentless server monitoring, alerting and reporting of a large selection of operating systems and SNMP capable devices. Last entries
My Blog Links
Links
Intellipool Network Monitor links
Intellipool Customer Portal INM Documentation INM Lua API Documentation INM Download page Friends and allies The Tech Teapot Sentinel Last Comments
brettzle on Friday post
Henk Dirksen on Automatic rotation of dashboards brettzle on Friday post kprestage on More widgets - INM 4.0 David on More widgets - INM 4.0 brettzle on More widgets - INM 4.0 David on Status widgets - INM 4.0 brettzle on Status widgets - INM 4.0 David on The search bar - INM 4.0 brettzle on The search bar - INM 4.0
|