NULL need to be detected in COPY

This commit is contained in:
Jovansonlee Cesar 2018-09-30 04:19:15 +08:00
parent 5abd9e7dec
commit ba8a9bd48f
3 changed files with 8 additions and 1 deletions

View file

@ -223,6 +223,7 @@ impl ToString for ASTNode{
.collect::<Vec<String>>().join("\t")
);
}
s += "\n\\.";
s
}
ASTNode::SQLUpdate{table_name, assignments, selection} => {

View file

@ -656,6 +656,10 @@ impl Parser {
Token::Backslash => {
if let Ok(true) = self.consume_token(&Token::Period) {
return Ok(values);
}if let Some(token) = self.next_token(){
if token == Token::Identifier("N".to_string()){
values.push(Value::Null);
}
}else{
continue;
}

View file

@ -558,9 +558,11 @@ Kwara & Kogi
{"Deleted Scenes","Behind the Scenes"}
'awe':5 'awe-inspir':4 'barbarella':1 'cat':13 'conquer':16 'dog':18 'feminist':10 'inspir':6 'monasteri':21 'must':15 'stori':7 'streetcar':2
PHP USD $
\N Some other value
\\."#);
let ast = parse_sql(&sql);
//assert_eq!(sql, ast.to_string());
println!("{:#?}", ast);
assert_eq!(sql, ast.to_string());
}
#[test]