Skip to content

Commit 4863433

Browse files
committed
Add prepare_copy_in to transaction
1 parent 011d531 commit 4863433

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,16 @@ impl<'conn> PostgresTransaction<'conn> {
10161016
conn.prepare(query, self.conn)
10171017
}
10181018

1019+
/// Like `PostgresConnection::prepare_copy_in`.
1020+
pub fn prepare_copy_in<'a>(&'a self, table: &str, cols: &[&str])
1021+
-> PostgresResult<PostgresCopyInStatement<'a>> {
1022+
let mut conn = self.conn.conn.borrow_mut();
1023+
if conn.trans_depth != self.depth {
1024+
return Err(PgWrongTransaction);
1025+
}
1026+
conn.prepare_copy_in(table, cols, self.conn)
1027+
}
1028+
10191029
/// Like `PostgresConnection::execute`.
10201030
pub fn execute(&self, query: &str, params: &[&ToSql]) -> PostgresResult<uint> {
10211031
self.prepare(query).and_then(|s| s.execute(params))

0 commit comments

Comments
 (0)