prisma / quaint

SQL Query AST and Visitor for Rust
Apache License 2.0
583 stars 61 forks source link

MySQL Date value not supported in current configuration (with features = "chrono") #279

Open pixelspark opened 3 years ago

pixelspark commented 3 years ago

First of all, thanks for this great library! Really appreciate all the effort you are putting in it.

I am encountering a panic Value of type Date("\'2019-08-07 10:04:50\'") is not supported with the current configuration when reading from a table that has a date value. I have the 'chrono' feature enabled. Cargo.toml excerpt:

quaint = {version = "^0.1.0", features = ["sqlite", "mysql", "chrono"]}

Actual version in use is 0.1.13.

Looking at the code it appears that while the my::Value::Date(year, month, day, hour, min, sec, micro) case is covered, there apparently also is a `my::Value::Date(String)' that should probably be added.

Table looks like this in MySQL:

 CREATE TABLE `urls` (
  `url_id` int(11) NOT NULL AUTO_INCREMENT,
  `url_unit` varchar(64) DEFAULT NULL,
  `url_url` text,
  `url_value` text,
  `url_found` datetime DEFAULT NULL,
  PRIMARY KEY (`url_id`)
) ENGINE=InnoDB AUTO_INCREMENT=51204 DEFAULT CHARSET=utf8mb4
thread 'tokio-runtime-worker' panicked at 'Value of type Date("\'2019-08-07 10:04:50\'") is not supported with the current configuration', <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/quaint-0.1.13/src/connector/mysql/conversion.rs:59:24
stack backtrace:
   0: rust_begin_unwind
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panicking.rs:493:5
   1: std::panicking::begin_panic_fmt
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panicking.rs:435:5
   2: quaint::connector::mysql::conversion::<impl quaint::connector::queryable::TakeRow for mysql_common::row::Row>::take_result_row::convert
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/quaint-0.1.13/src/connector/mysql/conversion.rs:59:24
   3: quaint::connector::mysql::conversion::<impl quaint::connector::queryable::TakeRow for mysql_common::row::Row>::take_result_row
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/quaint-0.1.13/src/connector/mysql/conversion.rs:71:22
   4: <quaint::connector::mysql::Mysql as quaint::connector::queryable::Queryable>::query_raw::{{closure}}::{{closure}}::{{closure}}
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/quaint-0.1.13/src/connector/mysql.rs:293:77
   5: mysql_async::queryable::query_result::QueryResult<T,P>::map::{{closure}}
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/mysql_async-0.21.1/src/queryable/query_result/mod.rs:328:31
   6: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/core/src/future/mod.rs:80:19
   7: mysql_async::queryable::query_result::QueryResult<T,P>::map_and_drop::{{closure}}
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/mysql_async-0.21.1/src/queryable/query_result/mod.rs:342:28
   8: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/core/src/future/mod.rs:80:19
   9: quaint::connector::mysql::Mysql::timeout::{{closure}}
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/quaint-0.1.13/src/connector/mysql.rs:243:27
  10: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/core/src/future/mod.rs:80:19
  11: <quaint::connector::mysql::Mysql as quaint::connector::queryable::Queryable>::query_raw::{{closure}}::{{closure}}
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/quaint-0.1.13/src/connector/mysql.rs:293:33
  12: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/core/src/future/mod.rs:80:19
  13: quaint::connector::metrics::query::{{closure}}
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/quaint-0.1.13/src/connector/metrics.rs:19:19
  14: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/core/src/future/mod.rs:80:19
  15: <quaint::connector::dbio::DBIO<T> as core::future::future::Future>::poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/quaint-0.1.13/src/connector/dbio.rs:25:9
  16: <quaint::connector::mysql::Mysql as quaint::connector::queryable::Queryable>::query::{{closure}}
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/quaint-0.1.13/src/connector/mysql.rs:275:13
  17: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/core/src/future/mod.rs:80:19
  18: <quaint::connector::dbio::DBIO<T> as core::future::future::Future>::poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/quaint-0.1.13/src/connector/dbio.rs:25:9
  19: <quaint::single::Quaint as quaint::connector::queryable::Queryable>::query::{{closure}}
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/quaint-0.1.13/src/single.rs:146:32
  20: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/core/src/future/mod.rs:80:19
  21: <quaint::connector::dbio::DBIO<T> as core::future::future::Future>::poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/quaint-0.1.13/src/connector/dbio.rs:25:9
  22: esplanade::db::database::Database::query::{{closure}}
             at ./src/db/database.rs:142:13
  23: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/core/src/future/mod.rs:80:19
  24: esplanade::api::query_with_query::{{closure}}
             at ./src/api.rs:248:19
  25: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/core/src/future/mod.rs:80:19
  26: <F as futures_core::future::TryFuture>::try_poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.13/src/future.rs:84:9
  27: <warp::filter::and_then::AndThenFuture<T,F> as core::future::future::Future>::poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.5/src/filter/and_then.rs:82:44
  28: <F as futures_core::future::TryFuture>::try_poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.13/src/future.rs:84:9
  29: <warp::filter::recover::RecoverFuture<T,F> as core::future::future::Future>::poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.5/src/filter/recover.rs:91:65
  30: <F as futures_core::future::TryFuture>::try_poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.13/src/future.rs:84:9
  31: <warp::filter::or::EitherFuture<T,U> as core::future::future::Future>::poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.5/src/filter/or.rs:87:44
  32: <warp::filter::and::AndFuture<T,U> as core::future::future::Future>::poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.5/src/filter/and.rs:71:44
  33: <F as futures_core::future::TryFuture>::try_poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.13/src/future.rs:84:9
  34: <warp::filter::or::EitherFuture<T,U> as core::future::future::Future>::poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.5/src/filter/or.rs:77:65
  35: <F as futures_core::future::TryFuture>::try_poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.13/src/future.rs:84:9
  36: <warp::filter::recover::RecoverFuture<T,F> as core::future::future::Future>::poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.5/src/filter/recover.rs:91:65
  37: <F as futures_core::future::TryFuture>::try_poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.13/src/future.rs:84:9
  38: <warp::filters::cors::internal::WrappedFuture<F> as core::future::future::Future>::poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.5/src/filters/cors.rs:573:26
  39: <futures_util::future::either::Either<A,B> as core::future::future::Future>::poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.13/src/future/either.rs:73:33
  40: <F as futures_core::future::TryFuture>::try_poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.13/src/future.rs:84:9
  41: <warp::filter::map::MapFuture<T,F> as core::future::future::Future>::poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.5/src/filter/map.rs:51:22
  42: <F as futures_core::future::TryFuture>::try_poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.13/src/future.rs:84:9
  43: <warp::filters::log::internal::WithLogFuture<FN,F> as core::future::future::Future>::poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.5/src/filters/log.rs:257:49
  44: <F as futures_core::future::TryFuture>::try_poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.13/src/future.rs:84:9
  45: <warp::filter::service::FilteredFuture<F> as core::future::future::Future>::poll::{{closure}}
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.5/src/filter/service.rs:128:41
  46: scoped_tls::ScopedKey<T>::set
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137:9
  47: warp::route::set
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.5/src/route.rs:17:5
  48: <warp::filter::service::FilteredFuture<F> as core::future::future::Future>::poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.5/src/filter/service.rs:128:15
  49: <hyper::proto::h1::dispatch::Server<S,hyper::body::body::Body> as hyper::proto::h1::dispatch::Dispatch>::poll_msg
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.13.10/src/proto/h1/dispatch.rs:476:31
  50: hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T>::poll_write
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.13.10/src/proto/h1/dispatch.rs:284:43
  51: hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T>::poll_loop
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.13.10/src/proto/h1/dispatch.rs:151:21
  52: hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T>::poll_inner
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.13.10/src/proto/h1/dispatch.rs:127:16
  53: hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T>::poll_catch
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.13.10/src/proto/h1/dispatch.rs:110:28
  54: <hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T> as core::future::future::Future>::poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.13.10/src/proto/h1/dispatch.rs:411:9
  55: <hyper::server::conn::ProtoServer<T,B,S,E> as core::future::future::Future>::poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.13.10/src/server/conn.rs:884:39
  56: <hyper::server::conn::upgrades::UpgradeableConnection<I,S,E> as core::future::future::Future>::poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.13.10/src/server/conn.rs:1063:30
  57: <hyper::server::conn::spawn_all::NewSvcTask<I,N,S,E,W> as core::future::future::Future>::poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.13.10/src/server/conn.rs:1001:36
  58: tokio::runtime::task::core::Core<T,S>::poll::{{closure}}
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/task/core.rs:173:17
  59: tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/loom/std/unsafe_cell.rs:14:9
  60: tokio::runtime::task::core::Core<T,S>::poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/task/core.rs:158:13
  61: tokio::runtime::task::harness::Harness<T,S>::poll::{{closure}}
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/task/harness.rs:107:27
  62: core::ops::function::FnOnce::call_once
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/core/src/ops/function.rs:227:5
  63: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panic.rs:344:9
  64: std::panicking::try::do_call
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panicking.rs:379:40
  65: __rust_try
  66: std::panicking::try
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panicking.rs:343:19
  67: std::panic::catch_unwind
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panic.rs:431:14
  68: tokio::runtime::task::harness::Harness<T,S>::poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/task/harness.rs:89:19
  69: tokio::runtime::task::raw::poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/task/raw.rs:104:5
  70: tokio::runtime::task::raw::RawTask::poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/task/raw.rs:66:18
  71: tokio::runtime::task::Notified<S>::run
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/task/mod.rs:169:9
  72: tokio::runtime::thread_pool::worker::Context::run_task::{{closure}}
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/thread_pool/worker.rs:349:13
  73: tokio::coop::with_budget::{{closure}}
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/coop.rs:127:9
  74: std::thread::local::LocalKey<T>::try_with
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/thread/local.rs:272:16
  75: std::thread::local::LocalKey<T>::with
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/thread/local.rs:248:9
  76: tokio::coop::with_budget
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/coop.rs:120:5
  77: tokio::coop::budget
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/coop.rs:96:5
  78: tokio::runtime::thread_pool::worker::Context::run_task
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/thread_pool/worker.rs:348:9
  79: tokio::runtime::thread_pool::worker::Context::run
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/thread_pool/worker.rs:320:24
  80: tokio::runtime::thread_pool::worker::run::{{closure}}
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/thread_pool/worker.rs:305:17
  81: tokio::macros::scoped_tls::ScopedKey<T>::set
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/macros/scoped_tls.rs:63:9
  82: tokio::runtime::thread_pool::worker::run
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/thread_pool/worker.rs:302:5
  83: tokio::runtime::thread_pool::worker::Launch::launch::{{closure}}
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/thread_pool/worker.rs:281:45
  84: <tokio::runtime::blocking::task::BlockingTask<T> as core::future::future::Future>::poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/blocking/task.rs:41:21
  85: tokio::runtime::task::core::Core<T,S>::poll::{{closure}}
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/task/core.rs:173:17
  86: tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/loom/std/unsafe_cell.rs:14:9
  87: tokio::runtime::task::core::Core<T,S>::poll
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/task/core.rs:158:13
  88: tokio::runtime::task::harness::Harness<T,S>::poll::{{closure}}
             at <omitted>/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/task/harness.rs:107:27
  89: core::ops::function::FnOnce::call_once
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/core/src/ops/function.rs:227:5
  90: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panic.rs:344:9
  91: std::panicking::try::do_call
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panicking.rs:379:40
  92: __rust_try
  93: std::panicking::try
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panicking.rs:343:19
  94: std::panic::catch_unwind
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panic.rs:431:14
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.