1mod any_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;
21mod statement_connection;
22
23pub use self::{
24 any_handle::AnyHandle,
25 bind::{CData, CDataMut, DelayedInput, HasDataType},
26 column_description::{ColumnDescription, Nullability},
27 connection::Connection,
28 data_type::DataType,
29 descriptor::Descriptor,
30 diagnostics::{DiagnosticStream, Diagnostics, Record, State},
31 environment::Environment,
32 logging::log_diagnostics,
33 sql_char::{OutputStringBuffer, SqlChar, SqlText, SzBuffer, slice_to_cow_utf8, slice_to_utf8},
34 sql_result::SqlResult,
35 statement::{AsStatementRef, ParameterDescription, Statement, StatementImpl, StatementRef},
36 statement_connection::{StatementConnection, StatementParent},
37};
38
39pub(crate) use self::data_type::ASSUMED_MAX_LENGTH_OF_W_VARCHAR;
40
41use log::debug;
42use odbc_sys::{Handle, HandleType, SQLFreeHandle, SqlReturn};
43use std::thread::panicking;
44
45pub unsafe fn drop_handle(handle: Handle, handle_type: HandleType) {
52 match unsafe { SQLFreeHandle(handle_type, handle) } {
53 SqlReturn::SUCCESS => {
54 debug!("SQLFreeHandle dropped {handle:?} of type {handle_type:?}.");
55 }
56 other => {
57 if !panicking() {
60 panic!("SQLFreeHandle failed with error code: {:?}", other.0)
61 }
62 }
63 }
64}