From 06ecb0d7a9832d0bf9c2741176287893dc2537c4 Mon Sep 17 00:00:00 2001 From: Bogdan Mircea Date: Sat, 2 Apr 2022 04:28:58 +0300 Subject: [PATCH] Added ProtocolVersion to public API. Commented out the map-like test for PreparedStatement execute --- src/lib.rs | 2 +- src/query.rs | 33 +++++++++++++++++---------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 55a634b..7ce4ab9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -211,7 +211,7 @@ pub mod query; pub mod response; pub mod row; -pub use crate::con_opts::ConOpts; +pub use crate::con_opts::{ConOpts, ProtocolVersion}; pub use crate::connection::{connect, Connection}; pub use crate::params::bind; pub use crate::query::{PreparedStatement, QueryResult, ResultSet}; diff --git a/src/query.rs b/src/query.rs index 8c5fb85..aad413a 100644 --- a/src/query.rs +++ b/src/query.rs @@ -364,6 +364,7 @@ impl PreparedStatement { /// /// let mut exa_con = connect(&dsn, &schema, &user, &password).unwrap(); /// let prep_stmt = exa_con.prepare("INSERT INTO EXA_RUST_TEST VALUES(?, ?, ?)").unwrap(); + /// println!("{:?}", &prep_stmt); /// /// let json_data = json!( /// [ @@ -372,22 +373,22 @@ impl PreparedStatement { /// ["e", "f", 3], /// ] /// ); - /// - /// prep_stmt.execute(json_data).unwrap(); - /// - /// #[derive(Serialize, Clone)] - /// #[serde(rename_all = "UPPERCASE")] - /// struct Data { - /// col1: String, - /// col2: String, - /// col3: u8 - /// } - /// - /// let data_item = Data { col1: "t".to_owned(), col2: "y".to_owned(), col3: 10 }; - /// let vec_data = vec![data_item.clone(), data_item.clone(), data_item]; - /// - /// prep_stmt.execute(vec_data).unwrap(); - /// + /// # + /// # prep_stmt.execute(json_data.as_array().unwrap()).unwrap(); + /// # + /// # #[derive(Serialize, Clone)] + /// # #[serde(rename_all = "UPPERCASE")] + /// # struct Data { + /// # col1: String, + /// # col2: String, + /// # col3: u8 + /// # } + /// # + /// # let data_item = Data { col1: "t".to_owned(), col2: "y".to_owned(), col3: 10 }; + /// # let vec_data = vec![data_item.clone(), data_item.clone(), data_item]; + /// # + /// # // prep_stmt.execute(vec_data).unwrap(); + /// # /// ``` pub fn execute(&self, data: T) -> Result where