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::{OutputStringBuffer, SqlChar, SqlText, SzBuffer, slice_to_cow_utf8, slice_to_utf8},
33 sql_result::SqlResult,
34 statement::{AsStatementRef, ParameterDescription, Statement, StatementImpl, StatementRef},
35};
36
37pub (crate) use data_type::ASSUMED_MAX_LENGTH_OF_W_VARCHAR;
38
39use log::debug;
40use odbc_sys::{Handle, HandleType, SQLFreeHandle, SqlReturn};
41use std::thread::panicking;
42
43pub unsafe fn drop_handle(handle: Handle, handle_type: HandleType) {
50 match unsafe { SQLFreeHandle(handle_type, handle) } {
51 SqlReturn::SUCCESS => {
52 debug!("SQLFreeHandle dropped {handle:?} of type {handle_type:?}.");
53 }
54 other => {
55 if !panicking() {
58 panic!("SQLFreeHandle failed with error code: {:?}", other.0)
59 }
60 }
61 }
62}