immutable tri-state
This commit is contained in:
@ -150,4 +150,26 @@ impl DatabaseExecutor for SpiExecutor {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
fn punc_external(&self) -> Result<bool, String> {
|
||||
self.transact(|| {
|
||||
Spi::connect(|client| {
|
||||
let mut tup_table = client
|
||||
.select(
|
||||
"SELECT COALESCE(current_setting('punc.external', true), 'false')::boolean",
|
||||
None,
|
||||
&[],
|
||||
)
|
||||
.map_err(|e| format!("SPI Select Error: {}", e))?;
|
||||
|
||||
let row = tup_table
|
||||
.next()
|
||||
.ok_or("No setting returned from context".to_string())?;
|
||||
let is_external: Option<bool> = row.get(1).map_err(|e| e.to_string())?;
|
||||
|
||||
Ok(is_external.unwrap_or(false))
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user