Skip to content

Commit

Permalink
introduce OdbcConnection::new
Browse files Browse the repository at this point in the history
  • Loading branch information
pacman82 committed Jul 14, 2024
1 parent e0349cd commit 93378d6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ use crate::{try_, ArrowOdbcError, ENV};
pub struct OdbcConnection(Connection<'static>);

impl OdbcConnection {
pub fn new(connection: Connection<'static>) -> Self {
OdbcConnection(connection)
}

/// Take the inner connection out of its wrapper
pub fn take(self) -> Connection<'static> {
self.0
Expand Down Expand Up @@ -74,7 +78,7 @@ pub unsafe extern "C" fn arrow_odbc_connect_with_connection_string(
let dbms_name = try_!(connection.database_management_system_name());
debug!("Database managment system name as reported by ODBC: {dbms_name}");

*connection_out = Box::into_raw(Box::new(OdbcConnection(connection)));
*connection_out = Box::into_raw(Box::new(OdbcConnection::new(connection)));
null_mut()
}

Expand Down

0 comments on commit 93378d6

Please sign in to comment.