This is a little plugin that is meant to clip-in to the ODBC action plugin.
It provides the following functions.
It's meant for ease of use with MySQL databases.Code:Handle = MySQL.OpenConnection(Server, Username, Password, Port); Boolean = MySQL.IsValidHandle(Handle); MySQL.Query(Handle, Query); Table = MySQL.QueryToTable(Handle, Query); MySQL.SelectDatabase(Handle, Database);
Example:
I've attached the XML and the luac file.Code:-- Open the connection to the database. hnd = MySQL.OpenConnection("localhost", "root", "06713502", 3306); -- Select the database we're going to use. MySQL.SelectDatabase(hnd, "test"); -- Query the database. result = MySQL.QueryToTable(hnd, "SELECT * FROM `Hello`"); -- Create a string containing the dumped table. str = "Dumping table `Hello`..\r\n\tColumns: "..result.Columns.."\r\n\tColumn Names: "..Table.Concat(result.ColumnNames, ", ", 1, result.Columns).."\r\n"; -- Enumerate through the table. for K, V in pairs(result.Data) do -- Append to the string. str = str.."\r\nRow #"..tostring(K); -- Go through the row now. for X, Y in pairs(V) do str = str.."\r\n\t"..tostring(X).." = "..tostring(Y); end end -- Show the user. Dialog.Message("MySQL Action Plugin", str);
You can use this add-in by putting the MySQL.luac file in AutoPlay/Scripts then putting the following code in On Preload/Globals/On Startup/...
Code:require "MySQL.luac";

Reply With Quote
Wowww.. Big thk for nice Plugin...
