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");
|
||||
|
||||
do conn.in_transaction |trans| {
|
||||
conn.prepare("CREATE TABLE foo (
|
||||
trans.prepare("CREATE TABLE foo (
|
||||
id BIGINT PRIMARY KEY,
|
||||
val VARCHAR
|
||||
)").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,
|
||||
&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([]);
|
||||
|
||||
assert_eq!(~[Some(~"foobar"), None],
|
||||
|
Loading…
Reference in New Issue
Block a user