@@ -2830,4 +2830,109 @@ fn test_supports_statements_without_semicolon_delimiter() {
28302830 } ,
28312831 }
28322832 ) ;
2833+
2834+ let exec_then_update = "\
2835+ EXEC my_sp \
2836+ UPDATE my_table SET col = 1 \
2837+ ";
2838+ assert_eq ! (
2839+ parse_n_statements( 2 , exec_then_update) ,
2840+ vec![
2841+ Statement :: Execute {
2842+ name: Some ( ObjectName :: from( vec![ Ident :: new( "my_sp" ) ] ) ) ,
2843+ parameters: vec![ ] ,
2844+ has_parentheses: false ,
2845+ immediate: false ,
2846+ into: vec![ ] ,
2847+ using: vec![ ] ,
2848+ output: false ,
2849+ default : false ,
2850+ } ,
2851+ Statement :: Update {
2852+ table: TableWithJoins {
2853+ relation: TableFactor :: Table {
2854+ name: ObjectName :: from( vec![ Ident :: new( "my_table" ) ] ) ,
2855+ alias: None ,
2856+ with_hints: vec![ ] ,
2857+ args: None ,
2858+ version: None ,
2859+ with_ordinality: false ,
2860+ partitions: vec![ ] ,
2861+ json_path: None ,
2862+ sample: None ,
2863+ index_hints: vec![ ]
2864+ } ,
2865+ joins: vec![ ] ,
2866+ } ,
2867+ assignments: vec![ Assignment {
2868+ value: Expr :: Value (
2869+ number( "1" )
2870+ . with_span( Span :: new( Location :: new( 3 , 16 ) , Location :: new( 3 , 17 ) ) )
2871+ ) ,
2872+ target: AssignmentTarget :: ColumnName ( ObjectName :: from( vec![ Ident :: new( "col" ) ] ) ) ,
2873+ } , ] ,
2874+ selection: None ,
2875+ returning: None ,
2876+ from: None ,
2877+ or: None
2878+ } ,
2879+ ]
2880+ ) ;
2881+
2882+ let exec_params_then_update = "\
2883+ EXEC my_sp 1, 2 \
2884+ UPDATE my_table SET col = 1 \
2885+ ";
2886+ assert_eq ! (
2887+ parse_n_statements( 2 , exec_params_then_update) ,
2888+ vec![
2889+ Statement :: Execute {
2890+ name: Some ( ObjectName :: from( vec![ Ident :: with_span(
2891+ Span :: new( Location :: new( 1 , 6 ) , Location :: new( 1 , 11 ) ) ,
2892+ "my_sp"
2893+ ) ] ) ) ,
2894+ parameters: vec![ ] ,
2895+ has_parentheses: false ,
2896+ immediate: false ,
2897+ into: vec![ ] ,
2898+ using: vec![ ] ,
2899+ output: false ,
2900+ default : false ,
2901+ } ,
2902+ Statement :: Update {
2903+ table: TableWithJoins {
2904+ relation: TableFactor :: Table {
2905+ name: ObjectName :: from( vec![ Ident :: with_span(
2906+ Span :: new( Location :: new( 1 , 24 ) , Location :: new( 1 , 32 ) ) ,
2907+ "my_table"
2908+ ) ] ) ,
2909+ alias: None ,
2910+ with_hints: vec![ ] ,
2911+ args: None ,
2912+ version: None ,
2913+ with_ordinality: false ,
2914+ partitions: vec![ ] ,
2915+ json_path: None ,
2916+ sample: None ,
2917+ index_hints: vec![ ]
2918+ } ,
2919+ joins: vec![ ] ,
2920+ } ,
2921+ assignments: vec![ Assignment {
2922+ value: Expr :: Value (
2923+ number( "1" )
2924+ . with_span( Span :: new( Location :: new( 3 , 16 ) , Location :: new( 3 , 17 ) ) )
2925+ ) ,
2926+ target: AssignmentTarget :: ColumnName ( ObjectName :: from( vec![ Ident :: with_span(
2927+ Span :: new( Location :: new( 1 , 37 ) , Location :: new( 1 , 40 ) ) ,
2928+ "col"
2929+ ) ] ) ) ,
2930+ } , ] ,
2931+ selection: None ,
2932+ returning: None ,
2933+ from: None ,
2934+ or: None
2935+ } ,
2936+ ]
2937+ ) ;
28332938}
0 commit comments