1
0
Mirror von https://github.com/Chaoscaot/schemsearch synchronisiert 2024-11-19 10:20:08 +01:00
Dieser Commit ist enthalten in:
Chaoscaot 2023-03-08 22:01:06 +01:00
Ursprung 98d797532e
Commit 9e7d5ea424
2 geänderte Dateien mit 11 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -169,7 +169,7 @@ fn main() {
Some(x) => x
};
file = match std::fs::File::create(output_file_path) {
file = match File::create(output_file_path) {
Ok(x) => Some(x),
Err(e) => {
cmd.error(ErrorKind::Io, format!("Error while creating output file: {}", e.to_string())).exit();

Datei anzeigen

@ -1,6 +1,6 @@
use std::sync::Mutex;
use sqlx::{Executor, MySql, Pool, Row};
use sqlx::mysql::MySqlPoolOptions;
use sqlx::{Executor, MySql, MySqlPool, Pool, Row};
use sqlx::mysql::MySqlConnectOptions;
mod properties;
@ -15,9 +15,14 @@ pub async unsafe fn get_connection() {
let mut conn = CONN.lock().unwrap();
if conn.is_none() {
let properties = properties::load_mysql_properties();
let _ = conn.insert(MySqlPoolOptions::new()
.max_connections(5)
.connect(&format!("mysql://{}:{}@{}/{}", properties.user, properties.password, properties.host, properties.database))
let _ = conn.insert(MySqlPool::connect_with(
MySqlConnectOptions::new()
.host(properties.host.as_str())
.port(3306)
.username(properties.user.as_str())
.password(properties.password.as_str())
.database(properties.database.as_str())
)
.await.expect("Failed to connect to database"));
}
}