1mod as_handle;
9mod bind;
10mod buffer;
11mod column_description;
12mod connection;
13mod data_type;
14mod descriptor;
15mod diagnostics;
16mod environment;
17mod logging;
18mod sql_char;
19mod sql_result;
20mod statement;
21
22pub use {
23 as_handle::AsHandle,
24 bind::{CData, CDataMut, DelayedInput, HasDataType},
25 column_description::{ColumnDescription, Nullability},
26 connection::Connection,
27 data_type::DataType,
28 descriptor::Descriptor,
29 diagnostics::{Diagnostics, Record, State},
30 environment::Environment,
31 logging::log_diagnostics,
32 sql_char::{slice_to_cow_utf8, slice_to_utf8, OutputStringBuffer, SqlChar, SqlText, SzBuffer},
33 sql_result::SqlResult,
34 statement::{AsStatementRef, ParameterDescription, Statement, StatementImpl, StatementRef},
35};
36
37use log::debug;
38use odbc_sys::{Handle, HandleType, SQLFreeHandle, SqlReturn};
39use std::thread::panicking;
40
41pub unsafe fn drop_handle(handle: Handle, handle_type: HandleType) {
48 match SQLFreeHandle(handle_type, handle) {
49 SqlReturn::SUCCESS => {
50 debug!("SQLFreeHandle dropped {handle:?} of type {handle_type:?}.");
51 }
52 other => {
53 if !panicking() {
56 panic!("SQLFreeHandle failed with error code: {:?}", other.0)
57 }
58 }
59 }
60}