Call methods on transaction object, not conn
This commit is contained in:
parent
afd7d8800d
commit
44ea118d02
@ -41,14 +41,14 @@ fn test_nulls() {
|
|||||||
let conn = PostgresConnection::connect("postgres://postgres@127.0.0.1:5432");
|
let conn = PostgresConnection::connect("postgres://postgres@127.0.0.1:5432");
|
||||||
|
|
||||||
do conn.in_transaction |trans| {
|
do conn.in_transaction |trans| {
|
||||||
conn.prepare("CREATE TABLE foo (
|
trans.prepare("CREATE TABLE foo (
|
||||||
id BIGINT PRIMARY KEY,
|
id BIGINT PRIMARY KEY,
|
||||||
val VARCHAR
|
val VARCHAR
|
||||||
)").update([]);
|
)").update([]);
|
||||||
conn.prepare("INSERT INTO foo (id, val) VALUES ($1, $2), ($3, $4)")
|
trans.prepare("INSERT INTO foo (id, val) VALUES ($1, $2), ($3, $4)")
|
||||||
.update([&1 as &ToSql, & &"foobar" as &ToSql,
|
.update([&1 as &ToSql, & &"foobar" as &ToSql,
|
||||||
&2 as &ToSql, &None::<~str> as &ToSql]);
|
&2 as &ToSql, &None::<~str> as &ToSql]);
|
||||||
let stmt = conn.prepare("SELECT id, val FROM foo ORDER BY id");
|
let stmt = trans.prepare("SELECT id, val FROM foo ORDER BY id");
|
||||||
let result = stmt.query([]);
|
let result = stmt.query([]);
|
||||||
|
|
||||||
assert_eq!(~[Some(~"foobar"), None],
|
assert_eq!(~[Some(~"foobar"), None],
|
||||||
|
Loading…
Reference in New Issue
Block a user