public override string Invoke(string args, int maxResultSize)
{
//if we haven't setup the database connection and such yet, this will do it
Startup.StartupConnection();
IList<object> arguments;
if (Format.TrySqfAsCollection(args, out arguments) && arguments.Count == 2 && arguments[0] != null && arguments[1] != null)
{
string database = arguments[0] as string;
string mysql_command = arguments[1] as string;
Logger.addMessage(Logger.LogType.Info, "Received - Database: " + database + " SQL Query: " + mysql_command.ToString());
if (SQL.dbs.SQLProviderExists(database))
{
IEnumerable<string[][]> returned = SQL.dbs.getSQLProvider(database).RunCommand(mysql_command, maxResultSize);
return Format.ObjectAsSqf(returned);
}
else
{
Logger.addMessage(Logger.LogType.Warning, "The database: " + database + " is not loaded in through the Databases.txt file.");
}
//Logger.addMessage(Logger.LogType.Info, "Returning false object");
return Format.ObjectAsSqf(false);
}
else
{
Logger.addMessage(Logger.LogType.Error, "The number and/or format of the arguments passed in doesn't match.");
throw new ArgumentException();
}
}