Skip to content

Commit 3b202e6

Browse files
committed
Doc fixes
1 parent bc04239 commit 3b202e6

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ parameters), explicitly preparing it can improve performance:
117117
```rust
118118
let stmt = try!(conn.prepare("UPDATE foo SET bar = $1 WHERE baz = $2"));
119119
for (bar, baz) in updates {
120-
try!(stmt.update(&[bar, baz]));
120+
try!(stmt.execute(&[bar, baz]));
121121
}
122122
```
123123

src/lib.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
//! Rust-Postgres is a pure-Rust frontend for the popular PostgreSQL database. It
2-
//! exposes a high level interface in the vein of JDBC or Go's `database/sql`
3-
//! package.
1+
//! A pure-Rust frontend for the popular PostgreSQL database.
42
//!
53
//! ```rust,no_run
64
//! extern crate postgres;
@@ -1036,10 +1034,11 @@ impl Connection {
10361034
/// # use postgres::{Connection, SslMode};
10371035
/// # let x = 10i32;
10381036
/// # let conn = Connection::connect("", SslMode::None).unwrap();
1039-
/// let stmt = conn.prepare("SELECT foo FROM bar WHERE baz = $1").unwrap();
1040-
/// for row in &stmt.query(&[&x]).unwrap() {
1041-
/// let foo: String = row.get(0);
1042-
/// println!("foo: {}", foo);
1037+
/// # let (a, b) = (0i32, 1i32);
1038+
/// # let updates = vec![(&a, &b)];
1039+
/// let stmt = conn.prepare("UPDATE foo SET bar = $1 WHERE baz = $2").unwrap();
1040+
/// for (bar, baz) in updates {
1041+
/// stmt.execute(&[bar, baz]).unwrap();
10431042
/// }
10441043
/// ```
10451044
pub fn prepare<'a>(&'a self, query: &str) -> Result<Statement<'a>> {
@@ -1059,10 +1058,11 @@ impl Connection {
10591058
/// # use postgres::{Connection, SslMode};
10601059
/// # let x = 10i32;
10611060
/// # let conn = Connection::connect("", SslMode::None).unwrap();
1062-
/// let stmt = conn.prepare_cached("SELECT foo FROM bar WHERE baz = $1").unwrap();
1063-
/// for row in &stmt.query(&[&x]).unwrap() {
1064-
/// let foo: String = row.get(0);
1065-
/// println!("foo: {}", foo);
1061+
/// # let (a, b) = (0i32, 1i32);
1062+
/// # let updates = vec![(&a, &b)];
1063+
/// let stmt = conn.prepare_cached("UPDATE foo SET bar = $1 WHERE baz = $2").unwrap();
1064+
/// for (bar, baz) in updates {
1065+
/// stmt.execute(&[bar, baz]).unwrap();
10661066
/// }
10671067
/// ```
10681068
pub fn prepare_cached<'a>(&'a self, query: &str) -> Result<Statement<'a>> {

0 commit comments

Comments
 (0)