1 19 20 package org.netbeans.modules.db.sql.execute; 21 22 import java.sql.ResultSet ; 23 import java.sql.SQLException ; 24 import java.sql.Statement ; 25 26 31 public class SQLExecutionResult { 32 33 36 private final StatementInfo statementInfo; 37 38 41 private final Statement statement; 42 43 46 private final ResultSet resultSet; 47 48 51 private final SQLException exception; 52 53 56 private final long executionTime; 57 58 61 private final int rowCount; 62 63 public SQLExecutionResult(StatementInfo info, Statement statement, ResultSet resultSet, long executionTime) { 64 this(info, statement, resultSet, -1, null, executionTime); 65 } 66 67 public SQLExecutionResult(StatementInfo info, Statement statement, int rowCount, long executionTime) { 68 this(info, statement, null, rowCount, null, executionTime); 69 } 70 71 public SQLExecutionResult(StatementInfo info, Statement statement, SQLException exception) { 72 this(info, statement, null, -1, exception, 0); 73 } 74 75 private SQLExecutionResult(StatementInfo info, Statement statement, ResultSet resultSet, int rowCount, SQLException exception, long executionTime) { 76 this.statementInfo = info; 77 this.statement = statement; 78 this.resultSet = resultSet; 79 this.rowCount = rowCount; 80 this.exception = exception; 81 this.executionTime = executionTime; 82 } 83 84 public StatementInfo getStatementInfo() { 85 return statementInfo; 86 } 87 88 public ResultSet getResultSet() { 89 return resultSet; 90 } 91 92 public int getRowCount() { 93 return rowCount; 94 } 95 96 public SQLException getException() { 97 return exception; 98 } 99 100 public long getExecutionTime() { 101 return executionTime; 102 } 103 104 public void close() throws SQLException { 105 try { 106 if (resultSet != null) { 107 resultSet.close(); 108 } 109 } finally { 110 if (statement != null) { 111 statement.close(); 112 } 113 } 114 } 115 116 public String toString() { 117 return "SQLExecutionResult[resultSet=" + resultSet + ",rowCount=" + rowCount + ",exception=" + exception + ",executionTime=" + executionTime + "]"; 118 } 119 } 120 | Popular Tags |