Skip if agent if null

This commit is contained in:
Haiping Chen 2024-09-18 14:09:04 -05:00
parent b30f743a5a
commit 175d61cd1e
5 changed files with 11 additions and 6 deletions

View file

@ -182,8 +182,11 @@ public class PluginLoader
foreach (var agentId in plugin.AgentIds) foreach (var agentId in plugin.AgentIds)
{ {
var agent = agentService.LoadAgent(agentId).Result; var agent = agentService.LoadAgent(agentId).Result;
agent.Disabled = true; if (agent != null)
agentService.UpdateAgent(agent, AgentField.Disabled); {
agent.Disabled = true;
agentService.UpdateAgent(agent, AgentField.Disabled);
}
} }
} }
return plugin; return plugin;

View file

@ -1,7 +1,7 @@
Use the TwoStagePlanner approach to plan the overall implementation steps, follow the below steps strictly. Use the TwoStagePlanner approach to plan the overall implementation steps, follow the below steps strictly.
1. call plan_primary_stage to generate the primary plan. 1. call plan_primary_stage to generate the primary plan.
2. If need_additional_information is true, call plan_secondary_stage for the specific primary stage. 2. If need_additional_information is true, call plan_secondary_stage for the specific primary stage.
3. You must call plan_summary as the last planning step to summarize the final query. 3. You must call plan_summary for you final planned output.
*** IMPORTANT *** *** IMPORTANT ***
Don't run the planning process repeatedly if you have already got the result of user's request. Don't run the planning process repeatedly if you have already got the result of user's request.

View file

@ -14,5 +14,7 @@ VALUES ((SELECT MAX(Id) + 1 FROM data_Service), 'HVAC');
If the table structure didn't mention auto incremental, the data field id needs to insert id manually and you need to use max(id) instead of LAST_INSERT_ID function. If the table structure didn't mention auto incremental, the data field id needs to insert id manually and you need to use max(id) instead of LAST_INSERT_ID function.
For example, you should use SET @id = select max(id) from table; For example, you should use SET @id = select max(id) from table;
* the alias of the table name in the sql query should be identical. *** the alias of the table name in the sql query should be identical. ***
*** the generated sql query MUST be basedd on the provided table structure. *** *** the generated sql query MUST be basedd on the provided table structure. ***
*** All queries return a maximum of 20 records. ***
*** Only select user friendly columns. ***

View file

@ -7,6 +7,6 @@ The query must exactly based on the provided table structure. And carefully revi
Note: Output should be only the sql query with sql comments that can be directly run in SQL Server. Note: Output should be only the sql query with sql comments that can be directly run in SQL Server.
*** the alias of the table name in the sql query should be identical. *** *** the alias of the table name in the sql query should be identical. ***
*** The generated sql query MUST be basedd on the provided table structure. *** *** The generated sql query MUST be based on the provided table structure. ***
*** All queries return a maximum of 10 records. *** *** All queries return a maximum of 10 records. ***
*** Only select user friendly columns. *** *** Only select user friendly columns. ***

View file

@ -36,7 +36,7 @@ public class ExecuteQueryFn : IFunctionCallback
private IEnumerable<dynamic> RunQueryInMySql(string[] sqlTexts) private IEnumerable<dynamic> RunQueryInMySql(string[] sqlTexts)
{ {
var settings = _services.GetRequiredService<SqlDriverSetting>(); var settings = _services.GetRequiredService<SqlDriverSetting>();
using var connection = new MySqlConnection(settings.MySqlExecutionConnectionString); using var connection = new MySqlConnection(settings.MySqlExecutionConnectionString ?? settings.MySqlConnectionString);
return connection.Query(string.Join(";\r\n", sqlTexts)); return connection.Query(string.Join(";\r\n", sqlTexts));
} }