Parse data modification statements (INSERT, MATCH INSERT, SET, REMOVE, DELETE)
(tokens: &[Token])
| 3914 | |
| 3915 | /// Parse data modification statements (INSERT, MATCH INSERT, SET, REMOVE, DELETE) |
| 3916 | fn data_statement(tokens: &[Token]) -> IResult<&[Token], DataStatement> { |
| 3917 | log::debug!( |
| 3918 | "data_statement called with tokens: {:?}", |
| 3919 | tokens.get(0..3).unwrap_or(&[]) |
| 3920 | ); |
| 3921 | let result = alt(( |
| 3922 | // Try MATCH-* patterns first (more specific) |
| 3923 | map(match_insert_statement, DataStatement::MatchInsert), |
| 3924 | map(match_set_statement, DataStatement::MatchSet), |
| 3925 | map(match_remove_statement, DataStatement::MatchRemove), |
| 3926 | map(match_delete_statement, DataStatement::MatchDelete), |
| 3927 | // Then try standalone patterns |
| 3928 | map(insert_statement, DataStatement::Insert), |
| 3929 | map(set_statement, DataStatement::Set), |
| 3930 | map(remove_statement, DataStatement::Remove), |
| 3931 | map(delete_statement, DataStatement::Delete), |
| 3932 | ))(tokens); |
| 3933 | if result.is_err() { |
| 3934 | log::debug!("data_statement parsing failed"); |
| 3935 | } |
| 3936 | result |
| 3937 | } |
| 3938 | |
| 3939 | /// Parse MATCH INSERT statement: MATCH pattern... [WITH ...] [WHERE condition] INSERT graph_pattern [, graph_pattern]* |
| 3940 | fn match_insert_statement(tokens: &[Token]) -> IResult<&[Token], MatchInsertStatement> { |