1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
//! # ODBC //! Open Database Connectivity or short ODBC is a low level high performance interface //! introduced by Microsoft to access relational data stores. This crate wraps the raw C interface //! and is intended to be usable in safe and idiomatic Rust. //! //! [What is ODBC?](https://docs.microsoft.com/en-us/sql/odbc/reference/what-is-odbc) //! //! [ODBC Programmer's Reference] //! (https://docs.microsoft.com/en-us/sql/odbc/reference/odbc-programmer-s-reference) //! //! # Internal Desgin //! //! While designed as a relatively low level wrapper around ODBC this crate tries to prevent many //! at compile time. The borrow checker and the RAII (Resource Acquisition Is Initialization) idiom //! should prevent any occurence of `SQL_INVALID_HANDLE` in safe code. //! //! Using the type system and the borrow checker this crate ensures that each method call happens //! in a valid state. This should eliminate function sequence errors in safe code. It is impossible //! to e.g. allocate a Statement handle before connecting to a data source. See: //! //! [Basic ODBC Application Steps] //! (https://docs.microsoft.com/en-us/sql/odbc/reference/develop-app/basic-odbc-application-steps) //! //! [ODBC State Transitions] //! (https://docs.microsoft.com/en-us/sql/odbc/reference/appendixes/appendix-b-odbc-state-transition-tables) #[macro_use] extern crate log; pub mod ffi; mod odbc_object; mod raii; mod diagnostics; mod result; mod environment; mod data_source; mod statement; use odbc_object::OdbcObject; use raii::Raii; use result::Return; pub use diagnostics::{DiagnosticRecord, GetDiagRec}; pub use result::{Result, EnvAllocError}; pub use environment::*; pub use data_source::{DataSource, Connected, Disconnected}; pub use statement::*; /// Reflects the ability of a type to expose a valid handle pub trait Handle { type To; /// Returns a valid handle to the odbc type. unsafe fn handle(&self) -> *mut Self::To; }