Repository: AlexPikalov/cdrs (language: rust)

Issue:
prepared statment doesn't pass query parameter
I have been trying to get the prepared statement to work but it is not .

CQL  query 
------------
``` Insert into user_keyspace.users            (user_name ,password,gender,session_token, state,birth_year)    values  (?         ,  ?     ,     ?,            ?,     ?,  ?)```

Error
-------
```CDRSError { error_code: 8704, message: CString { string: "there were 6 markers(?) in CQL but 0 bound variables" }```

I have pushed the code to my branch 
https://github.com/harrydevnull/cdrs/tree/feature/more-integ-test

could you please take a look?



Discussion / hints:
@harrydevnull I'll take a look.
Thank you.
@harrydevnull I found a root cause. It's a serialization defect. I'll try to push the fix today.
cool thank you 

Fix patch:
diff --git a/src/frame/frame_auth_response.rs b/src/frame/frame_auth_response.rs
index 5b2dd1f..ce6a65d 100644
--- a/src/frame/frame_auth_response.rs
+++ b/src/frame/frame_auth_response.rs
@@ -50,6 +50,7 @@ mod tests {
     use super::*;
     use types::CBytes;
     use IntoBytes;
+    use super::super::*;
 
 
     #[test]
diff --git a/src/frame/frame_query.rs b/src/frame/frame_query.rs
index 3c895a2..a1168c1 100644
--- a/src/frame/frame_query.rs
+++ b/src/frame/frame_query.rs
@@ -138,7 +138,9 @@ impl IntoBytes for ParamsReqQuery {
         v.push(self.flags_as_byte());
         if QueryFlags::has_value(self.flags_as_byte()) {
             // XXX clone
-            for val in self.values.clone().unwrap().iter() {
+            let values = self.values.clone().unwrap();
+            v.extend_from_slice(to_short(values.len() as u64).as_slice());
+            for val in values.iter() {
                 v.extend_from_slice(val.into_cbytes().as_slice());
             }
         }
diff --git a/src/query.rs b/src/query.rs
index 448f3f3..b52d341 100644
--- a/src/query.rs
+++ b/src/query.rs
@@ -180,7 +180,7 @@ impl QueryParamsBuilder {
         return self;
     }
 
-    pub fn finalize(self) -> QueryParams {
+    pub fn finalize(&self) -> QueryParams {
         // query flags
         let mut flags: Vec<QueryFlags> = vec![];
 
@@ -205,13 +205,13 @@ impl QueryParamsBuilder {
         }
 
         return QueryParams {
-            consistency: self.consistency,
-            flags: flags,
-            values: self.values,
-            page_size: self.page_size,
-            paging_state: self.paging_state,
-            serial_consistency: self.serial_consistency,
-            timestamp: self.timestamp,
+            consistency: self.consistency.clone(),
+            flags: flags.clone(),
+            values: self.values.clone(),
+            page_size: self.page_size.clone(),
+            paging_state: self.paging_state.clone(),
+            serial_consistency: self.serial_consistency.clone(),
+            timestamp: self.timestamp.clone(),
         };
     }
 }


Test patch: