toasty_sql/stmt/
pragma.rs1use super::Statement;
2
3#[derive(Debug, Clone)]
5pub struct Pragma {
6 pub name: String,
8
9 pub value: Option<String>,
11}
12
13impl Statement {
14 pub fn pragma_enable_foreign_keys() -> Self {
16 Pragma {
17 name: "foreign_keys".to_string(),
18 value: Some("ON".to_string()),
19 }
20 .into()
21 }
22
23 pub fn pragma_disable_foreign_keys() -> Self {
25 Pragma {
26 name: "foreign_keys".to_string(),
27 value: Some("OFF".to_string()),
28 }
29 .into()
30 }
31
32 pub fn pragma(name: impl Into<String>, value: impl Into<String>) -> Self {
34 Pragma {
35 name: name.into(),
36 value: Some(value.into()),
37 }
38 .into()
39 }
40}
41
42impl From<Pragma> for Statement {
43 fn from(value: Pragma) -> Self {
44 Self::Pragma(value)
45 }
46}