Skip to content

Commit 113e717

Browse files
committed
Fix README examples
1 parent 660b96d commit 113e717

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ Both methods take an array of parameters to bind to the query represented as
111111
`&ToSql` trait objects. `execute` returns the number of rows affected by the
112112
query (or 0 if not applicable):
113113
```rust
114-
let stmt = conn.prepare("UPDATE foo SET bar = $1 WHERE baz = $2");
115-
let updates = stmt.execute([&1i32 as &ToSql, & &"biz" as &ToSql]);
114+
let stmt = try!(conn.prepare("UPDATE foo SET bar = $1 WHERE baz = $2"));
115+
let updates = try!(stmt.execute([&1i32 as &ToSql, & &"biz" as &ToSql]));
116116
println!("{} rows were updated", updates);
117117
```
118118
`query` returns an iterator over the rows returned from the database. The
@@ -123,15 +123,15 @@ columns are one-indexed.
123123
let stmt = try!(conn.prepare("SELECT bar, baz FROM foo"));
124124
for row in try!(stmt.query([])) {
125125
let bar: i32 = row[1];
126-
let baz: ~str = row["baz"];
126+
let baz: StrBuf = row["baz"];
127127
println!("bar: {}, baz: {}", bar, baz);
128128
}
129129
```
130130
In addition, `PostgresConnection` has a utility `execute` method which is useful
131131
if a statement is only going to be executed once:
132132
```rust
133133
let updates = try!(conn.execute("UPDATE foo SET bar = $1 WHERE baz = $2",
134-
[&1i32 as &ToSql, & &"biz" as &ToSql]));
134+
[&1i32 as &ToSql, &(&"biz") as &ToSql]));
135135
println!("{} rows were updated", updates);
136136
```
137137

0 commit comments

Comments
 (0)