@@ -307,7 +307,7 @@ fn it_parses_DROP_TABLE() {
307307 assert_eq ! ( result. ddl_tables( ) , [ "abc.test123" ] ) ;
308308 assert_eq ! ( result. statement_types( ) , [ "DropStmt" ] ) ;
309309 let drop = cast ! ( result. protobuf. nodes( ) [ 0 ] . 0 , NodeRef :: DropStmt ) ;
310- assert_eq ! ( protobuf:: DropBehavior :: from_i32 ( drop. behavior) , Some ( protobuf:: DropBehavior :: DropCascade ) ) ;
310+ assert_eq ! ( protobuf:: DropBehavior :: try_from ( drop. behavior) , Ok ( protobuf:: DropBehavior :: DropCascade ) ) ;
311311
312312 let query2 = "drop table abc.test123, test" ;
313313 assert_parse_raw_equals_parse ( query2) ;
@@ -327,7 +327,7 @@ fn it_parses_COMMIT() {
327327 assert_eq ! ( result. warnings. len( ) , 0 ) ;
328328 assert_eq ! ( result. statement_types( ) , [ "TransactionStmt" ] ) ;
329329 let stmt = cast ! ( result. protobuf. nodes( ) [ 0 ] . 0 , NodeRef :: TransactionStmt ) ;
330- assert_eq ! ( protobuf:: TransactionStmtKind :: from_i32 ( stmt. kind) , Some ( protobuf:: TransactionStmtKind :: TransStmtCommit ) ) ;
330+ assert_eq ! ( protobuf:: TransactionStmtKind :: try_from ( stmt. kind) , Ok ( protobuf:: TransactionStmtKind :: TransStmtCommit ) ) ;
331331}
332332
333333#[ test]
@@ -716,7 +716,7 @@ fn it_parses_CREATE_RULE() {
716716 assert_eq ! ( result. statement_types( ) , [ "RuleStmt" ] ) ;
717717 let stmt = cast ! ( result. protobuf. nodes( ) [ 0 ] . 0 , NodeRef :: RuleStmt ) ;
718718 assert_eq ! ( stmt. rulename, "shoe_ins_protect" ) ;
719- assert_eq ! ( protobuf:: CmdType :: from_i32 ( stmt. event) , Some ( protobuf:: CmdType :: CmdInsert ) ) ;
719+ assert_eq ! ( protobuf:: CmdType :: try_from ( stmt. event) , Ok ( protobuf:: CmdType :: CmdInsert ) ) ;
720720}
721721
722722#[ test]
@@ -732,8 +732,8 @@ fn it_parses_CREATE_TRIGGER() {
732732 let stmt = cast ! ( result. protobuf. nodes( ) [ 0 ] . 0 , NodeRef :: CreateTrigStmt ) ;
733733 let func = cast ! ( stmt. funcname[ 0 ] . node. as_ref( ) . unwrap( ) , NodeEnum :: String ) ;
734734 assert_eq ! ( func. sval, "check_account_update" ) ;
735- assert_eq ! ( TriggerType :: from_i32 ( stmt. timing) , Some ( TriggerType :: Before ) ) ;
736- assert_eq ! ( TriggerType :: from_i32 ( stmt. events) , Some ( TriggerType :: Update ) ) ;
735+ assert_eq ! ( TriggerType :: try_from ( stmt. timing) , Ok ( TriggerType :: Before ) ) ;
736+ assert_eq ! ( TriggerType :: try_from ( stmt. events) , Ok ( TriggerType :: Update ) ) ;
737737}
738738
739739#[ test]
0 commit comments