2007-05-28 21:55:50 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
namespace OpenGrid.Framework.Data.MySQL
|
|
|
|
{
|
|
|
|
class MySQLLogData : ILogData
|
|
|
|
{
|
|
|
|
public MySQLManager database;
|
|
|
|
|
|
|
|
public void Initialise()
|
|
|
|
{
|
|
|
|
IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
|
|
|
|
string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
|
|
|
|
string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
|
|
|
|
string settingUsername = GridDataMySqlFile.ParseFileReadValue("username");
|
|
|
|
string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
|
|
|
|
string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
|
|
|
|
string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
|
|
|
|
|
|
|
|
database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage)
|
|
|
|
{
|
2007-05-30 02:39:10 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
database.insertLogRow(serverDaemon, target, methodCall, arguments, priority, logMessage);
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
database.Reconnect();
|
|
|
|
}
|
2007-05-28 21:55:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public string getName()
|
|
|
|
{
|
|
|
|
return "MySQL Logdata Interface";
|
|
|
|
}
|
|
|
|
|
2007-05-28 22:20:25 +00:00
|
|
|
public void Close()
|
|
|
|
{
|
|
|
|
// Do nothing.
|
|
|
|
}
|
|
|
|
|
2007-05-28 21:55:50 +00:00
|
|
|
public string getVersion()
|
|
|
|
{
|
|
|
|
return "0.1";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|