Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion canyon_connection/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"
tokio = { version = "1.9.0", features = ["full"] }
tokio-postgres = { version = "0.7.2", features = ["with-chrono-0_4"] }

tiberius = { git = "https://github.com/Pyzyryab/tiberius", branch = "main", features = ["tds73", "chrono"] }
tiberius = { version = "0.11.3", features = ["tds73", "chrono"] }
async-std = { version = "1.12.0" }

lazy_static = "1.4.0"
Expand Down
4 changes: 2 additions & 2 deletions canyon_connection/src/canyon_database_connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl DatabaseConnection {
user = datasource.username,
pswd = datasource.password,
host = datasource.host,
port = datasource.port,
port = datasource.port.unwrap_or_default(),
db = datasource.db_name
)[..],
NoTls
Expand All @@ -73,7 +73,7 @@ impl DatabaseConnection {
let mut config = Config::new();

config.host(datasource.host);
config.port(datasource.port);
config.port(datasource.port.unwrap_or_default());
config.database(datasource.db_name);

// Using SQL Server authentication.
Expand Down
8 changes: 5 additions & 3 deletions canyon_connection/src/datasources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fn load_ds_config_from_array() {
[canyon_sql]
datasources = [
{name = 'PostgresDS', properties.db_type = 'postgresql', properties.username = 'username', properties.password = 'random_pass', properties.host = 'localhost', properties.db_name = 'triforce'},
{name = 'SqlServerDS', properties.db_type = 'sqlserver', properties.username = 'username2', properties.password = 'random_pass2', properties.host = '192.168.0.250.1:3340', properties.db_name = 'triforce2'}
{name = 'SqlServerDS', properties.db_type = 'sqlserver', properties.username = 'username2', properties.password = 'random_pass2', properties.host = '192.168.0.250.1', properties.port = 3340, properties.db_name = 'triforce2'}
]
"#;

Expand All @@ -23,13 +23,15 @@ fn load_ds_config_from_array() {
assert_eq!(ds_0.properties.username, "username");
assert_eq!(ds_0.properties.password, "random_pass");
assert_eq!(ds_0.properties.host, "localhost");
assert_eq!(ds_0.properties.port, None);
assert_eq!(ds_0.properties.db_name, "triforce");

assert_eq!(ds_1.name, "SqlServerDS");
assert_eq!(ds_1.properties.db_type, "sqlserver");
assert_eq!(ds_1.properties.username, "username2");
assert_eq!(ds_1.properties.password, "random_pass2");
assert_eq!(ds_1.properties.host, "192.168.0.250.1:3340");
assert_eq!(ds_1.properties.host, "192.168.0.250.1");
assert_eq!(ds_1.properties.port, Some(3340));
assert_eq!(ds_1.properties.db_name, "triforce2");
}

Expand Down Expand Up @@ -58,6 +60,6 @@ pub struct DatasourceProperties<'a> {
pub username: &'a str,
pub password: &'a str,
pub host: &'a str,
pub port: u16,
pub port: Option<u16>,
pub db_name: &'a str,
}
1 change: 1 addition & 0 deletions canyon_connection/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub extern crate tokio;
pub extern crate tokio_postgres;
pub extern crate tiberius;
pub extern crate async_std;
Expand Down
3 changes: 0 additions & 3 deletions canyon_crud/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ name = "canyon_crud"
version = "1.0.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
chrono = { version = "0.4", features = ["serde"] }
tokio = { version = "1.9.0", features = ["full"] }
async-trait = { version = "0.1.50" }

canyon_connection = { path = "../canyon_connection" }
2 changes: 1 addition & 1 deletion canyon_crud/src/crud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ mod postgres_query_launcher {
let (client, connection) =
(postgres_connection.client, postgres_connection.connection);

tokio::spawn(async move {
canyon_connection::tokio::spawn(async move {
if let Err(e) = connection.await {
eprintln!("An error occured while trying to connect to the database: {}", e);
}
Expand Down