Remove dead datetime-related code

1) Removed unused date/time parsing methods from `Parser`

I don't see how the token-based parsing code would ever be used: the
date/time literals are usually quoted, like `DATE 'yyyy-mm-dd'` or
simply `'YYYYMMDD'`, so the date will be a single token.

2) Removed unused date/time related variants from `Value` and the
dependency on `chrono`.

We don't support parsing date/time literals at the moment and when we
do I think we should store the exact String to let the consumer parse
it as they see fit.

3) Removed `parse_timestamps_example` and
`parse_timestamps_with_millis_example` tests. They parsed as
`number(2016) minus number(02) minus number(15) <END OF EXPRESSION>`
(leaving the time part unparsed) as it makes no sense to try parsing
a yyyy-mm-dd value as an SQL expression.
This commit is contained in:
Nickolay Ponomarev 2019-05-03 01:10:07 +03:00
parent 9297ffbe18
commit de177f107c
4 changed files with 21 additions and 147 deletions

View file

@ -209,22 +209,6 @@ PHP ₱ USD $
//assert_eq!(sql, ast.to_string());
}
#[test]
fn parse_timestamps_example() {
let sql = "2016-02-15 09:43:33";
let _ = parse_sql_expr(sql);
//TODO add assertion
//assert_eq!(sql, ast.to_string());
}
#[test]
fn parse_timestamps_with_millis_example() {
let sql = "2017-11-02 19:15:42.308637";
let _ = parse_sql_expr(sql);
//TODO add assertion
//assert_eq!(sql, ast.to_string());
}
fn verified_stmt(query: &str) -> SQLStatement {
one_statement_parses_to(query, query)
}
@ -247,12 +231,6 @@ fn parse_sql_statements(sql: &str) -> Result<Vec<SQLStatement>, ParserError> {
Parser::parse_sql(&PostgreSqlDialect {}, sql.to_string())
}
fn parse_sql_expr(sql: &str) -> ASTNode {
debug!("sql: {}", sql);
let mut parser = parser(sql);
parser.parse_expr().unwrap()
}
fn parser(sql: &str) -> Parser {
let dialect = PostgreSqlDialect {};
let mut tokenizer = Tokenizer::new(&dialect, &sql);