diff --git a/packages/host/mk-sql/src/ms_sql/instance.rs b/packages/host/mk-sql/src/ms_sql/instance.rs index 1c780fa3bcc..adc9a77946e 100644 --- a/packages/host/mk-sql/src/ms_sql/instance.rs +++ b/packages/host/mk-sql/src/ms_sql/instance.rs @@ -766,7 +766,7 @@ impl SqlInstance { self.generate_datafiles_section(endpoint, chunk, query, sep), ), names::CLUSTERS => rt.block_on( - self.generate_transaction_logs_section(endpoint, chunk, query, sep), + self.generate_clusters_section(endpoint, chunk, query, sep), ), _ => format!("{} not implemented\n", section.name()).to_string(), } @@ -1001,7 +1001,7 @@ impl SqlInstance { } let (nodes, active_node) = self.get_cluster_nodes(client, query).await?; Ok(Some(format!( - "{}{sep}{}{sep}{}{sep}{}", + "{}{sep}{}{sep}{}{sep}{}\n", self.name, database.replace(' ', "_"), active_node, @@ -1022,7 +1022,7 @@ impl SqlInstance { query: &str, ) -> Result<(String, String)> { let answers = &run_custom_query(client, query).await?; - if answers.len() > 2 && !answers[0].is_empty() && !answers[1].is_empty() { + if answers.len() >= 2 && !answers[1].is_empty() { return Ok((answers[0].get_node_names(), answers[1].get_active_node())); } Ok((String::default(), String::default())) diff --git a/packages/host/mk-sql/src/ms_sql/sqls.rs b/packages/host/mk-sql/src/ms_sql/sqls.rs index c14dd663288..ecb17705180 100644 --- a/packages/host/mk-sql/src/ms_sql/sqls.rs +++ b/packages/host/mk-sql/src/ms_sql/sqls.rs @@ -281,11 +281,12 @@ cast(DATABASEPROPERTYEX(name, 'Status') as nvarchar(max)) AS Status, \ FROM master.dbo.sysdatabases"; pub const IS_CLUSTERED: &str = - "SELECT cast( SERVERPROPERTY('IsClustered') as nvarchar) AS is_clustered"; + "SELECT cast( SERVERPROPERTY('IsClustered') as nvarchar(max)) AS is_clustered"; pub const CLUSTER_NODES: &str = - "SELECT cast(nodename as NVARCHAR) as nodename FROM sys.dm_os_cluster_nodes"; + "SELECT cast(nodename as NVARCHAR(max)) as nodename FROM sys.dm_os_cluster_nodes"; + pub const CLUSTER_ACTIVE_NODES: &str = - "SELECT cast(SERVERPROPERTY('ComputerNamePhysicalNetBIOS') as nvarchar) AS active_node"; + "SELECT cast(SERVERPROPERTY('ComputerNamePhysicalNetBIOS') as nvarchar(max)) AS active_node"; pub const CONNECTIONS: &str = "SELECT name AS DbName, \ cast((SELECT COUNT(dbid) AS Num_Of_Connections FROM sys.sysprocesses WHERE dbid > 0 AND name = DB_NAME(dbid) GROUP BY dbid ) as bigint) AS NumberOfConnections \