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
//! Types, traits and constants to abstract over the different
//! implementations of the firebird client

pub mod charset;
mod connection;
pub mod date_time;
pub(crate) mod error;
pub mod ibase;
mod params;
mod row;
mod transaction;

pub use charset::Charset;
pub use connection::*;
pub use error::FbError;
pub use params::*;
pub use row::*;
pub use transaction::*;

#[derive(Debug, Clone)]
/// Sql parameter / column data
pub enum SqlType {
    Text(String),

    Integer(i64),

    Floating(f64),

    Timestamp(chrono::NaiveDateTime),

    Binary(Vec<u8>),

    /// Only works in fb >= 3.0
    Boolean(bool),

    Null,
}

impl SqlType {
    /// Returns `true` if the type is `NULL`
    pub fn is_null(&self) -> bool {
        matches!(self, Null)
    }
}