mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-23 00:39:20 +08:00
Check chrono FromSql implementations
Make sure SQLite built-in CURRENT_DATE/TIME/TIMESTAMP output is supported.
This commit is contained in:
parent
e25f39e739
commit
3a178d6d17
@ -132,7 +132,7 @@ mod test {
|
|||||||
use super::chrono::{
|
use super::chrono::{
|
||||||
DateTime, Duration, Local, NaiveDate, NaiveDateTime, NaiveTime, TimeZone, Utc,
|
DateTime, Duration, Local, NaiveDate, NaiveDateTime, NaiveTime, TimeZone, Utc,
|
||||||
};
|
};
|
||||||
use {Connection, NO_PARAMS};
|
use {Connection, Result, NO_PARAMS};
|
||||||
|
|
||||||
fn checked_memory_handle() -> Connection {
|
fn checked_memory_handle() -> Connection {
|
||||||
let db = Connection::open_in_memory().unwrap();
|
let db = Connection::open_in_memory().unwrap();
|
||||||
@ -263,4 +263,21 @@ mod test {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(local, v);
|
assert_eq!(local, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_sqlite_functions() {
|
||||||
|
let db = checked_memory_handle();
|
||||||
|
let result: Result<NaiveTime> =
|
||||||
|
db.query_row("SELECT CURRENT_TIME", NO_PARAMS, |r| r.get(0));
|
||||||
|
assert!(result.is_ok());
|
||||||
|
let result: Result<NaiveDate> =
|
||||||
|
db.query_row("SELECT CURRENT_DATE", NO_PARAMS, |r| r.get(0));
|
||||||
|
assert!(result.is_ok());
|
||||||
|
let result: Result<NaiveDateTime> =
|
||||||
|
db.query_row("SELECT CURRENT_TIMESTAMP", NO_PARAMS, |r| r.get(0));
|
||||||
|
assert!(result.is_ok());
|
||||||
|
let result: Result<DateTime<Utc>> =
|
||||||
|
db.query_row("SELECT CURRENT_TIMESTAMP", NO_PARAMS, |r| r.get(0));
|
||||||
|
assert!(result.is_ok());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user