From 4863433ca798694c73d41b6fabda28fabb0db2f6 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Mon, 29 Sep 2014 23:49:58 -0700 Subject: [PATCH] Add prepare_copy_in to transaction --- src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 0ed4c695..377f3e52 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1016,6 +1016,16 @@ impl<'conn> PostgresTransaction<'conn> { conn.prepare(query, self.conn) } + /// Like `PostgresConnection::prepare_copy_in`. + pub fn prepare_copy_in<'a>(&'a self, table: &str, cols: &[&str]) + -> PostgresResult> { + let mut conn = self.conn.conn.borrow_mut(); + if conn.trans_depth != self.depth { + return Err(PgWrongTransaction); + } + conn.prepare_copy_in(table, cols, self.conn) + } + /// Like `PostgresConnection::execute`. pub fn execute(&self, query: &str, params: &[&ToSql]) -> PostgresResult { self.prepare(query).and_then(|s| s.execute(params))