Skip to content

Commit 30f11af

Browse files
committed
Merge branch 'release-v0.11.10' into release
2 parents 453cd07 + f4aabce commit 30f11af

File tree

17 files changed

+286
-97
lines changed

17 files changed

+286
-97
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
language: rust
2+
cache: cargo
23
sudo: required
34
rust:
45
- nightly
56
- beta
6-
- 1.7.0
7+
- 1.9.0
78
addons:
89
postgresql: 9.4
910
before_script:
1011
- "./.travis/setup.sh"
1112
script:
1213
- cargo test
13-
- cargo update -p bitflags --precise 0.5.0
1414
- cargo test --features "uuid rustc-serialize time unix_socket serde_json chrono openssl bit-vec eui48"
1515
- (test $TRAVIS_RUST_VERSION != "nightly" || cargo test --features nightly)

Cargo.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[package]
22
name = "postgres"
3-
version = "0.11.9"
3+
version = "0.11.10"
44
authors = ["Steven Fackler <sfackler@gmail.com>"]
55
license = "MIT"
66
description = "A native PostgreSQL driver"
77
repository = "https://github.com/sfackler/rust-postgres"
8-
documentation = "https://sfackler.github.io/rust-postgres/doc/v0.11.9/postgres"
8+
documentation = "https://sfackler.github.io/rust-postgres/doc/v0.11.10/postgres"
99
readme = "README.md"
1010
keywords = ["database", "postgres", "postgresql", "sql"]
1111
include = ["src/*", "Cargo.toml", "LICENSE", "README.md", "THIRD_PARTY"]
@@ -27,9 +27,8 @@ nightly = []
2727
bufstream = "0.1"
2828
byteorder = "0.5"
2929
log = "0.3"
30-
phf = "=0.7.14"
30+
phf = "=0.7.15"
3131
hex = "0.2"
32-
net2 = "0.2.16"
3332
rustc-serialize = { version = "0.3", optional = true }
3433
chrono = { version = "0.2.14", optional = true }
3534
openssl = { version = ">= 0.6.4, < 0.8", optional = true }
@@ -40,7 +39,6 @@ uuid = { version = ">= 0.1, < 0.3", optional = true }
4039
security-framework = { version = "0.1.2", optional = true }
4140
bit-vec = { version = "0.4", optional = true }
4241
eui48 = { version = "0.1", optional = true }
43-
clippy = { version = "0.0.61", optional = true }
4442

4543
[dev-dependencies]
4644
url = "1.0"

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2013-2015 Steven Fackler
3+
Copyright (c) 2013-2016 Steven Fackler
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of
66
this software and associated documentation files (the "Software"), to deal in

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Rust-Postgres
22
A native PostgreSQL driver for Rust.
33

4-
[Documentation](https://sfackler.github.io/rust-postgres/doc/v0.11.9/postgres)
4+
[Documentation](https://sfackler.github.io/rust-postgres/doc/v0.11.10/postgres)
55

66
[![Build Status](https://travis-ci.org/sfackler/rust-postgres.png?branch=master)](https://travis-ci.org/sfackler/rust-postgres) [![Latest Version](https://img.shields.io/crates/v/postgres.svg)](https://crates.io/crates/postgres)
77

@@ -51,7 +51,7 @@ fn main() {
5151
```
5252

5353
## Requirements
54-
* **Rust** - Rust-Postgres is developed against the 1.7 release of Rust
54+
* **Rust** - Rust-Postgres is developed against the 1.9 release of Rust
5555
available on http://www.rust-lang.org. It should also compile against more
5656
recent releases.
5757

codegen/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ version = "0.1.0"
44
authors = ["Steven Fackler <sfackler@gmail.com>"]
55

66
[dependencies]
7-
phf_codegen = "=0.7.14"
7+
phf_codegen = "=0.7.15"
88
regex = "0.1"
99
marksman_escape = "0.1"

codegen/src/sqlstate.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ pub enum SqlState {{
9898
" /// An unknown code
9999
Other(String),
100100
}}
101+
101102
"
102103
).unwrap();
103104
}

src/error/sqlstate.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ pub enum SqlState {
479479
/// An unknown code
480480
Other(String),
481481
}
482+
482483
#[cfg_attr(rustfmt, rustfmt_skip)]
483484
static SQLSTATE_MAP: phf::Map<&'static str, SqlState> = ::phf::Map {
484485
key: 1897749892740154578,

src/lib.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,10 @@
3838
//! }
3939
//! }
4040
//! ```
41-
#![doc(html_root_url="https://sfackler.github.io/rust-postgres/doc/v0.11.9")]
41+
#![doc(html_root_url="https://sfackler.github.io/rust-postgres/doc/v0.11.10")]
4242
#![warn(missing_docs)]
4343
#![allow(unknown_lints, needless_lifetimes)] // for clippy
4444
#![cfg_attr(all(unix, feature = "nightly"), feature(unix_socket))]
45-
#![cfg_attr(feature = "clippy", feature(plugin))]
46-
#![cfg_attr(feature = "clippy", plugin(clippy))]
4745

4846
extern crate bufstream;
4947
extern crate byteorder;
@@ -53,7 +51,6 @@ extern crate log;
5351
extern crate phf;
5452
#[cfg(feature = "unix_socket")]
5553
extern crate unix_socket;
56-
extern crate net2;
5754

5855
use bufstream::BufStream;
5956
use md5::Md5;
@@ -419,6 +416,19 @@ impl InnerConnection {
419416
ORDER BY enumsortorder") {
420417
Ok(..) => {}
421418
Err(Error::Io(e)) => return Err(ConnectError::Io(e)),
419+
// Postgres 9.0 doesn't have enumsortorder
420+
Err(Error::Db(ref e)) if e.code == SqlState::UndefinedColumn => {
421+
match self.raw_prepare(TYPEINFO_ENUM_QUERY,
422+
"SELECT enumlabel \
423+
FROM pg_catalog.pg_enum \
424+
WHERE enumtypid = $1 \
425+
ORDER BY oid") {
426+
Ok(..) => {}
427+
Err(Error::Io(e)) => return Err(ConnectError::Io(e)),
428+
Err(Error::Db(e)) => return Err(ConnectError::Db(e)),
429+
Err(Error::Conversion(_)) => unreachable!(),
430+
}
431+
}
422432
// Old versions of Postgres and things like Redshift don't support enums
423433
Err(Error::Db(ref e)) if e.code == SqlState::UndefinedTable => {}
424434
// Some Postgres-like databases are missing a pg_catalog (e.g. Cockroach)

src/priv_io.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
use byteorder::ReadBytesExt;
2-
// this import needs to stay to support pre 1.9 users
3-
#[allow(unused_imports)]
4-
use net2::TcpStreamExt;
52
use std::error::Error;
63
use std::io;
74
use std::io::prelude::*;

src/types/chrono.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
extern crate chrono;
22

3-
use std::error;
43
use std::io::prelude::*;
54
use byteorder::{ReadBytesExt, WriteBytesExt, BigEndian};
65
use self::chrono::{Duration, NaiveDate, NaiveTime, NaiveDateTime, DateTime, UTC, Local,
@@ -31,10 +30,7 @@ impl ToSql for NaiveDateTime {
3130
-> Result<IsNull> {
3231
let time = match (*self - base()).num_microseconds() {
3332
Some(time) => time,
34-
None => {
35-
let err: Box<error::Error + Sync + Send> = "value too large to transmit".into();
36-
return Err(Error::Conversion(err));
37-
}
33+
None => return Err(Error::Conversion("value too large to transmit".into())),
3834
};
3935
try!(w.write_i64::<BigEndian>(time));
4036
Ok(IsNull::No)
@@ -130,8 +126,7 @@ impl ToSql for NaiveDate {
130126
-> Result<IsNull> {
131127
let jd = (*self - base().date()).num_days();
132128
if jd > i32::max_value() as i64 || jd < i32::min_value() as i64 {
133-
let err: Box<error::Error + Sync + Send> = "value too large to transmit".into();
134-
return Err(Error::Conversion(err));
129+
return Err(Error::Conversion("value too large to transmit".into()));
135130
}
136131

137132
try!(w.write_i32::<BigEndian>(jd as i32));
@@ -160,10 +155,7 @@ impl ToSql for NaiveTime {
160155
let delta = *self - NaiveTime::from_hms(0, 0, 0);
161156
let time = match delta.num_microseconds() {
162157
Some(time) => time,
163-
None => {
164-
let err: Box<error::Error + Sync + Send> = "value too large to transmit".into();
165-
return Err(Error::Conversion(err));
166-
}
158+
None => return Err(Error::Conversion("value too large to transmit".into())),
167159
};
168160
try!(w.write_i64::<BigEndian>(time));
169161
Ok(IsNull::No)

0 commit comments

Comments
 (0)