Mirror von
https://github.com/Chaoscaot/schemsearch
synchronisiert 2024-11-05 20:10:07 +01:00
Fixes
Dieser Commit ist enthalten in:
Ursprung
98d797532e
Commit
9e7d5ea424
@ -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();
|
||||
|
@ -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"));
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren