Skip to content

Commit

Permalink
Replaced Lazy_static with once_cell, Also Updated ODBC-api and Releas…
Browse files Browse the repository at this point in the history
…e 0.5
  • Loading branch information
genusistimelord committed Mar 31, 2023
1 parent 6623507 commit 45e4a29
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 18 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## 0.5.0 (31. March, 2023)
### Changed
- Updated ODBC-Api to 0.55.0
- Replaced Lazy_static with Once_Cell

## 0.4.0 (26. November, 2022)
### Changed
- Updated ODBC-Api to 0.52.2
Expand Down
22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ repository = "https://github.com/AscendingCreations/AxumOdbc"
iodbc = ["odbc-api/iodbc"]

[dependencies]
axum-core = "0.3.0"
serde = "1.0.145"
serde_json = "1.0.86"
tokio = { version = "1.21.2", features = ["full"] }
async-trait = "0.1.57"
axum-core = "0.3.3"
serde = "1.0.159"
serde_json = "1.0.95"
tokio = { version = "1.27.0", features = ["full"] }
async-trait = "0.1.68"
tracing = "0.1.37"
thiserror = "1.0.37"
thiserror = "1.0.40"
http = "0.2.8"
odbc-api = "0.52.2"
lazy_static = "1.4"
crossbeam-queue = "0.3.6"
odbc-api = "0.55.0"
once_cell = "1.17.1"
crossbeam-queue = "0.3.8"

[dev-dependencies]
anyhow = "1.0.57"
axum = "0.6.0"
anyhow = "1.0.70"
axum = "0.6.12"

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This project is licensed under either [Apache License, Version 2.0](LICENSE-APAC

## Help

If you need help with this library or have suggestions please go to our [Discord Group](https://discord.gg/xKkm7UhM36)
If you need help with this library or have suggestions please go to our [Discord Group](https://discord.gg/gVXNDwpS3Z)

## Install

Expand All @@ -28,7 +28,7 @@ Axum ODBC uses [`tokio`] runtime.
```toml
# Cargo.toml
[dependencies]
axum_odbc = "0.4.0"
axum_odbc = "0.5.0"
```

#### Cargo Feature Flags
Expand Down
6 changes: 2 additions & 4 deletions src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@ use crate::{
use async_trait::async_trait;
use axum_core::extract::{FromRef, FromRequestParts};
use http::request::Parts;
use lazy_static::lazy_static;
use odbc_api::Environment;
use once_cell::sync::Lazy;
use std::{convert::Infallible, fmt, sync::Arc};

#[derive(Clone)]
pub struct ODBCConnectionManager {
pub(crate) shared: Arc<SharedPool>,
}

lazy_static! {
pub(crate) static ref ENV: Environment = Environment::new().unwrap();
}
pub(crate) static ENV: Lazy<Environment> = Lazy::new(|| Environment::new().unwrap());

impl ODBCConnectionManager {
/// Constructs a ODBCConnectionManager.
Expand Down
3 changes: 2 additions & 1 deletion src/pool/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ impl SharedPool {
.map_err(|p| OdbcError::LockError { msg: p.to_string() })?;

let env = &ENV;
let conn = env.connect_with_connection_string(conn_str.as_str())?;
let conn = env
.connect_with_connection_string(conn_str.as_str(), ConnectionOptions::default())?;
// Promoting a connection to send is unsafe, since not every ODBC driver is thread safe.
// Actual thread safety for unixODBC may also depend on the threading level defined for the
// ODBC driver. Here we assume that the user conciously checked the safety of the
Expand Down

0 comments on commit 45e4a29

Please sign in to comment.