diff --git a/src-tauri/src/clickhouse.rs b/src-tauri/src/clickhouse.rs
index 562e268..7805287 100644
--- a/src-tauri/src/clickhouse.rs
+++ b/src-tauri/src/clickhouse.rs
@@ -9,4 +9,19 @@ pub fn setup_clickhouse(path: &PathBuf) {
} else {
fs::create_dir_all(&path).expect("Failed to create directory");
}
+
+ let path_str = path.to_str().unwrap();
+
+ let xml_content = format!(
+ r#"
+ {path_str}/user_defined/*.xml
+ {path_str}/bin
+ {path_str}/user_defined
+"#
+ );
+
+ let config_path = path.join("config.xml");
+ if !config_path.exists() {
+ fs::write(config_path, xml_content).expect("Failed to write config file");
+ }
}
diff --git a/src-tauri/src/commands/mod.rs b/src-tauri/src/commands/mod.rs
index c9c59d2..79bee2c 100644
--- a/src-tauri/src/commands/mod.rs
+++ b/src-tauri/src/commands/mod.rs
@@ -1,21 +1,25 @@
use crate::chdb::{arg::Arg, format, lib};
+use std::borrow::Cow;
use std::sync::Mutex;
use tauri::State;
-use crate::AppState;
+use crate::{chdb, AppState};
use String;
#[tauri::command]
pub async fn query(query: String, state: State<'_, Mutex>) -> Result {
let state = state.lock().unwrap();
+ let config_path = state.clickhouse_dir.join("config.xml".to_string());
let args = vec![
+ // Arg::LogLevel(chdb::log_level::LogLevel::Trace),
Arg::OutputFormat(format::OutputFormat::JSON),
Arg::Custom(
"path".into(),
Some(state.clickhouse_dir.display().to_string().into()),
),
+ Arg::ConfigFilePath(Cow::Borrowed(config_path.to_str().unwrap())),
];
return match lib::execute(&query, Some(&args)) {