Add Debug bound on ToSql and log params during stmt execution
This commit is contained in:
parent
8c6f72d732
commit
01862817c9
@ -65,7 +65,7 @@ use std::borrow::{ToOwned, Cow};
|
|||||||
use std::cell::{Cell, RefCell};
|
use std::cell::{Cell, RefCell};
|
||||||
use std::collections::{VecDeque, HashMap};
|
use std::collections::{VecDeque, HashMap};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::iter::{IntoIterator, RandomAccessIterator};
|
use std::iter::IntoIterator;
|
||||||
use std::io::{self, BufStream};
|
use std::io::{self, BufStream};
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
@ -1353,7 +1353,7 @@ impl<'conn> Statement<'conn> {
|
|||||||
"expected {} parameters but got {}",
|
"expected {} parameters but got {}",
|
||||||
self.param_types.len(),
|
self.param_types.len(),
|
||||||
params.len());
|
params.len());
|
||||||
debug!("executing statement {}", self.name);
|
debug!("executing statement {} with parameters: {:?}", self.name, params);
|
||||||
let mut values = vec![];
|
let mut values = vec![];
|
||||||
for (param, ty) in params.iter().zip(self.param_types.iter()) {
|
for (param, ty) in params.iter().zip(self.param_types.iter()) {
|
||||||
let mut buf = vec![];
|
let mut buf = vec![];
|
||||||
@ -2032,7 +2032,7 @@ impl<'a> CopyInStatement<'a> {
|
|||||||
where I: Iterator<Item=J>, J: StreamIterator {
|
where I: Iterator<Item=J>, J: StreamIterator {
|
||||||
let mut conn = self.conn.conn.borrow_mut();
|
let mut conn = self.conn.conn.borrow_mut();
|
||||||
|
|
||||||
debug!("executing statement {}", self.name);
|
debug!("executing COPY IN statement {}", self.name);
|
||||||
try!(conn.write_messages(&[
|
try!(conn.write_messages(&[
|
||||||
Bind {
|
Bind {
|
||||||
portal: "",
|
portal: "",
|
||||||
|
@ -605,7 +605,7 @@ pub enum IsNull {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A trait for types that can be converted into Postgres values.
|
/// A trait for types that can be converted into Postgres values.
|
||||||
pub trait ToSql {
|
pub trait ToSql: fmt::Debug {
|
||||||
/// Converts the value of `self` into the binary format of the specified
|
/// Converts the value of `self` into the binary format of the specified
|
||||||
/// Postgres `Type`, writing it to `out`.
|
/// Postgres `Type`, writing it to `out`.
|
||||||
///
|
///
|
||||||
|
@ -24,6 +24,7 @@ use types::IsNull;
|
|||||||
/// }
|
/// }
|
||||||
/// # Ok(()) }
|
/// # Ok(()) }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct Slice<'a, T: 'a + ToSql>(pub &'a [T]);
|
pub struct Slice<'a, T: 'a + ToSql>(pub &'a [T]);
|
||||||
|
|
||||||
impl<'a, T: 'a + ToSql> ToSql for Slice<'a, T> {
|
impl<'a, T: 'a + ToSql> ToSql for Slice<'a, T> {
|
||||||
|
Loading…
Reference in New Issue
Block a user