Fix array formatting for SQL
This commit is contained in:
		| @@ -79,21 +79,24 @@ where | |||||||
| } | } | ||||||
|  |  | ||||||
| #[inline] | #[inline] | ||||||
| fn format_array_for_sql<T>(values: &[T]) -> String | fn format_array_for_sql<I, T>(values: I) -> String | ||||||
| where | where | ||||||
|     T: Display |     I: IntoIterator<Item=T>, | ||||||
|  |     T: Display, | ||||||
| { | { | ||||||
|     match values.len() { |     let mut iter = values.into_iter(); | ||||||
|         1.. => { |  | ||||||
|             let mut output = values[0].to_string(); |     let mut output = match iter.next() { | ||||||
|             for v in &values[1..] { |         Some(first) => first.to_string(), | ||||||
|  |         None => return String::new(), | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |     for v in iter { | ||||||
|         output += ","; |         output += ","; | ||||||
|         output += &v.to_string(); |         output += &v.to_string(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     output |     output | ||||||
|         }, |  | ||||||
|         _ => values.first().map(|v| v.to_string()).unwrap_or(String::new()), |  | ||||||
|     } |  | ||||||
| } | } | ||||||
|  |  | ||||||
| #[inline] | #[inline] | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user