use super::*; #[derive(Debug)] pub struct MySQL; impl MySQL { pub fn new() -> Self { MySQL {} } } impl DatabaseDriver for MySQL { /// Get which characters are used to delimit identifiers /// such as tables, and columns fn _quotes(&self) -> (char, char) { ('`', '`') } } #[cfg(test)] mod tests { use super::*; #[test] fn test_quote_identifier_backtick_quote() { let driver = MySQL::new(); assert_eq!( driver.quote_identifier("foo, bar, baz"), "`foo`,`bar`,`baz`" ); assert_eq!( driver.quote_identifier("foo.bar, baz, fizz"), "`foo`.`bar`,`baz`,`fizz`" ); } #[test] fn test_quote_identifiers_backtick_quote() { let driver = MySQL::new(); assert_eq!( driver.quote_identifiers(vec!["\tfoo. bar", "baz", "fizz.\n\tbuzz.baz",]), vec![ "`foo`.`bar`".to_string(), "`baz`".to_string(), "`fizz`.`buzz`.`baz`".to_string(), ] ); } }