//! Drivers //! //! Drivers represent a connection to a specific type of database engine use std::fmt; #[cfg(feature = "postgres")] mod postgres; #[cfg(feature = "sqlite")] mod sqlite; #[cfg(feature = "mysql")] mod mysql; #[derive(Debug)] struct Connection; /// Result for a db query #[derive(Debug)] struct QueryResult; struct DriverBase { escape_char_open: char, escape_char_close: char, has_truncate: bool, } /// Database Driver Trait /// /// Interface between the database connection library and the query builder pub trait DatabaseDriver: fmt::Debug { /// Vector version of `quote_identifier` fn quote_identifiers(&self, identifiers: Vec) -> Vec { let mut output: Vec = vec![]; for identifier in identifiers { output.push(self.quote_identifier(&identifier)); } output } /// Quote the identifiers passed, so the database does not /// normalize the identifiers (eg, table, column, etc.) fn quote_identifier(&self, identifier: &str) -> String; /// Runs a basic sql query on the database fn query(&self, query: &str) -> Result<(), ()>; }