Connection.prepare(sql);
create_statement.execute_query(&arg_array);
Err(General("Couldn\'t convert the value `Date(\"\\\'2019-12-12\\\'\")` to a desired type"))
mysql data row
date `2019-12-12 00:00:00`
so i check the code. maybe you need add a mothed support the date. and i use this code ,query date success.
//just like
/// Result set from executing a query against a statement
pub trait ResultSet {
/// get meta data about this result set
fn meta_data(&self) -> Result<Box>;
/// Move the cursor to the next available row if one exists and return true if it does
fn next(&mut self) -> bool;
fn get_i8(&self, i: u64) -> Result<Option<i8>>;
fn get_i16(&self, i: u64) -> Result<Option<i16>>;
fn get_i32(&self, i: u64) -> Result<Option<i32>>;
fn get_i64(&self, i: u64) -> Result<Option<i64>>;
fn get_f32(&self, i: u64) -> Result<Option<f32>>;
fn get_f64(&self, i: u64) -> Result<Option<f64>>;
fn get_string(&self, i: u64) -> Result<Option<String>>;
fn get_bytes(&self, i: u64) -> Result<Option<Vec<u8>>>;
fn get_date(&self, i: u64) -> Result<Option<String>>; // this code impl to support date
}
``` rust
impl <'a>MySQLResultSet<'a>{
fn get_my_date(&self, i: u64) -> Result<Option<my::Value>, Error> {
match &self.row {
Some(Ok(row)) => row
.get_opt(i as usize)
.expect("we will never `take` the value so the outer `Option` is always `Some`")
.map(|v| Some(v))
.map_err(value_to_rdbc_err),
_ => Ok(None),
}
}
}
//get_date impl
impl<'a> rdbc::ResultSet for MySQLResultSet<'a> {
fn get_date(&self, i: u64) -> Result<Option<String>, Error> {
let date=self.get_my_date(i)?;
if date.is_some(){
let v=date.unwrap();
return Ok(Option::from(v.as_sql(true)));
}else{
return Ok(None);
}
}
}
so i check the code. maybe you need add a mothed support the date. and i use this code ,query date success.
/// Result set from executing a query against a statement pub trait ResultSet { /// get meta data about this result set fn meta_data(&self) -> Result<Box>;
}