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::{DiagnosticResult, 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, ColumnType, Statement, StatementImpl, StatementRef},
36 statement_connection::{StatementConnection, StatementParent},
37};
38
39#[allow(deprecated)]
40pub use self::statement::ParameterDescription;
41
42pub(crate) use self::data_type::{ASSUMED_MAX_LENGTH_OF_VARCHAR, ASSUMED_MAX_LENGTH_OF_W_VARCHAR};
43
44use log::debug;
45use odbc_sys::{Handle, HandleType, SQLFreeHandle, SqlReturn};
46use std::thread::panicking;
47
48pub unsafe fn drop_handle(handle: Handle, handle_type: HandleType) {
55 match unsafe { SQLFreeHandle(handle_type, handle) } {
56 SqlReturn::SUCCESS => {
57 debug!("SQLFreeHandle dropped {handle:?} of type {handle_type:?}.");
58 }
59 other => {
60 if !panicking() {
63 panic!("SQLFreeHandle failed with error code: {:?}", other.0)
64 }
65 }
66 }
67}