oxide_sql_sqlite/
dialect.rs

1//! SQLite dialect implementation.
2
3use oxide_sql_core::dialect::Dialect;
4
5/// SQLite dialect.
6#[derive(Debug, Default, Clone, Copy)]
7pub struct SqliteDialect;
8
9impl SqliteDialect {
10    /// Creates a new SQLite dialect.
11    #[must_use]
12    pub const fn new() -> Self {
13        Self
14    }
15}
16
17impl Dialect for SqliteDialect {
18    fn name(&self) -> &'static str {
19        "sqlite"
20    }
21
22    fn identifier_quote(&self) -> char {
23        '"' // SQLite also accepts backticks, but double quotes are standard
24    }
25
26    fn supports_returning(&self) -> bool {
27        true // SQLite 3.35.0+
28    }
29
30    fn supports_upsert(&self) -> bool {
31        true // SQLite 3.24.0+
32    }
33}
34
35#[cfg(test)]
36mod tests {
37    use super::*;
38
39    #[test]
40    fn test_sqlite_dialect() {
41        let dialect = SqliteDialect::new();
42        assert_eq!(dialect.name(), "sqlite");
43        assert_eq!(dialect.identifier_quote(), '"');
44        assert!(dialect.supports_returning());
45        assert!(dialect.supports_upsert());
46    }
47}