001package gudusoft.gsqlparser.nodes.mssql; 002 003import gudusoft.gsqlparser.nodes.TParseTreeNode; 004import gudusoft.gsqlparser.nodes.TStatementListSqlNode; 005 006/** 007 * Parse tree node for SQL Server TRY...CATCH block. 008 * Contains separate statement lists for the TRY block and CATCH block. 009 */ 010public class TTryCatchSqlNode extends TParseTreeNode { 011 012 private TStatementListSqlNode tryStmts = null; 013 private TStatementListSqlNode catchStmts = null; 014 015 /** 016 * Initialize with TRY statements only (no CATCH block). 017 */ 018 public void init(Object arg1) { 019 this.tryStmts = (TStatementListSqlNode) arg1; 020 } 021 022 /** 023 * Initialize with both TRY and CATCH statements. 024 */ 025 public void init(Object arg1, Object arg2) { 026 this.tryStmts = (TStatementListSqlNode) arg1; 027 this.catchStmts = (TStatementListSqlNode) arg2; 028 } 029 030 /** 031 * Get the statements inside the BEGIN TRY ... END TRY block. 032 */ 033 public TStatementListSqlNode getTryStmts() { 034 return tryStmts; 035 } 036 037 /** 038 * Get the statements inside the BEGIN CATCH ... END CATCH block. 039 * May be null if there is no CATCH block. 040 */ 041 public TStatementListSqlNode getCatchStmts() { 042 return catchStmts; 043 } 044 045 public void setTryStmts(TStatementListSqlNode tryStmts) { 046 this.tryStmts = tryStmts; 047 } 048 049 public void setCatchStmts(TStatementListSqlNode catchStmts) { 050 this.catchStmts = catchStmts; 051 } 052}