Fix transaction config query generation

Closes #187
This commit is contained in:
Steven Fackler 2016-06-15 18:29:36 -07:00
parent 7435547132
commit 46113ac323
2 changed files with 9 additions and 2 deletions

View File

@ -88,7 +88,7 @@ impl ConfigInternals for Config {
}
if let Some(read_only) = self.read_only {
if first {
if !first {
s.push(',');
}
if read_only {
@ -100,7 +100,7 @@ impl ConfigInternals for Config {
}
if let Some(deferrable) = self.deferrable {
if first {
if !first {
s.push(',');
}
if deferrable {

View File

@ -1039,6 +1039,13 @@ fn transaction_config() {
conn.set_transaction_config(&config).unwrap();
}
#[test]
fn transaction_config_one_setting() {
let conn = Connection::connect("postgres://postgres@localhost", SslMode::None).unwrap();
conn.set_transaction_config(&transaction::Config::new().read_only(true)).unwrap();
conn.set_transaction_config(&transaction::Config::new().deferrable(true)).unwrap();
}
#[test]
fn transaction_with() {
let conn = Connection::connect("postgres://postgres@localhost", SslMode::None).unwrap();