2024-02-19 22:55:41 +00:00
|
|
|
namespace BotSharp.Plugin.SqlDriver.Functions;
|
2024-01-13 21:17:40 +00:00
|
|
|
|
2024-02-19 22:55:41 +00:00
|
|
|
public class ExecuteQueryFn : IFunctionCallback
|
2024-01-13 21:17:40 +00:00
|
|
|
{
|
|
|
|
|
public string Name => "execute_sql";
|
|
|
|
|
|
2024-01-18 11:30:28 +00:00
|
|
|
private readonly SqlDriverSetting _setting;
|
2024-01-13 21:17:40 +00:00
|
|
|
|
2024-02-19 22:55:41 +00:00
|
|
|
public ExecuteQueryFn(SqlDriverSetting setting)
|
2024-01-13 21:17:40 +00:00
|
|
|
{
|
|
|
|
|
_setting = setting;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<bool> Execute(RoleDialogModel message)
|
|
|
|
|
{
|
2024-02-19 22:55:41 +00:00
|
|
|
message.Content = "Executed";
|
2024-01-13 21:17:40 +00:00
|
|
|
/*using var connection = new MySqlConnection(_setting.MySqlConnectionString);
|
|
|
|
|
message.Content = JsonSerializer.Serialize(connection.Query(args.SqlStatement), new JsonSerializerOptions
|
|
|
|
|
{
|
|
|
|
|
WriteIndented = true,
|
|
|
|
|
});*/
|
|
|
|
|
// message.StopCompletion = true;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|