1 2 12 package com.versant.core.jdbc.logging; 13 14 import java.sql.ResultSet ; 15 import java.sql.Statement ; 16 import java.sql.SQLException ; 17 import java.util.List ; 18 import java.util.Arrays ; 19 20 24 public class JdbcResultSetEvent extends JdbcLogEvent { 25 26 private int statementID; 27 private int resultSetID; 28 private boolean next; 29 private Object [] row; 30 private int rows; 31 32 public JdbcResultSetEvent(long txId, ResultSet rs, String descr, int type) { 33 super(txId, type, descr); 34 this.resultSetID = System.identityHashCode(rs); 35 try { 36 Statement s = rs.getStatement(); 37 if (s != null) statementID = System.identityHashCode(s); 38 } catch (SQLException e) { 39 } 41 } 42 43 46 public String getDescription() { 47 StringBuffer s = new StringBuffer (); 48 if (descr != null) { 49 s.append(descr); 50 s.append(' '); 51 } 52 if (row != null) { 53 s.append('['); 54 int n = row.length; 55 for (int i = 0; i < n; i++) { 56 if (i > 0) s.append(", "); 57 s.append(row[i]); 58 } 59 s.append(']'); 60 } 61 return s.toString(); 62 } 63 64 public int getStatementID() { 65 return statementID; 66 } 67 68 public void setStatementID(int statementID) { 69 this.statementID = statementID; 70 } 71 72 public int getResultSetID() { 73 return resultSetID; 74 } 75 76 public void setResultSetID(int resultSetID) { 77 this.resultSetID = resultSetID; 78 } 79 80 public boolean isNext() { 81 return next; 82 } 83 84 public void setNext(boolean next) { 85 this.next = next; 86 } 87 88 public Object [] getRow() { 89 return row; 90 } 91 92 public void setRow(Object [] row) { 93 this.row = row; 94 } 95 96 public List getRowList() { 97 return Arrays.asList(row); 98 } 99 100 public int getRows() { 101 return rows; 102 } 103 104 public void setRows(int rows) { 105 this.rows = rows; 106 } 107 108 public int getResourceID() { 109 return statementID; 110 } 111 } 112 113 | Popular Tags |