1 16 17 package org.springframework.jdbc.support.rowset; 18 19 import java.sql.ResultSetMetaData ; 20 import java.sql.SQLException ; 21 22 import org.springframework.jdbc.InvalidResultSetAccessException; 23 24 37 public class ResultSetWrappingSqlRowSetMetaData implements SqlRowSetMetaData { 38 39 private final ResultSetMetaData resultSetMetaData; 40 41 private String [] columnNames; 42 43 44 53 public ResultSetWrappingSqlRowSetMetaData(ResultSetMetaData resultSetMetaData) { 54 this.resultSetMetaData = resultSetMetaData; 55 } 56 57 58 public String getCatalogName(int column) throws InvalidResultSetAccessException { 59 try { 60 return this.resultSetMetaData.getCatalogName(column); 61 } 62 catch (SQLException se) { 63 throw new InvalidResultSetAccessException(se); 64 } 65 } 66 67 public String getColumnClassName(int column) throws InvalidResultSetAccessException { 68 try { 69 return this.resultSetMetaData.getColumnClassName(column); 70 } 71 catch (SQLException se) { 72 throw new InvalidResultSetAccessException(se); 73 } 74 } 75 76 public int getColumnCount() throws InvalidResultSetAccessException { 77 try { 78 return this.resultSetMetaData.getColumnCount(); 79 } 80 catch (SQLException se) { 81 throw new InvalidResultSetAccessException(se); 82 } 83 } 84 85 public String [] getColumnNames() throws InvalidResultSetAccessException { 86 if (this.columnNames == null) { 87 this.columnNames = new String [getColumnCount()]; 88 for (int i = 0; i < getColumnCount(); i++) { 89 this.columnNames[i] = getColumnName(i + 1); 90 } 91 } 92 return this.columnNames; 93 } 94 95 public int getColumnDisplaySize(int column) throws InvalidResultSetAccessException { 96 try { 97 return this.resultSetMetaData.getColumnDisplaySize(column); 98 } 99 catch (SQLException se) { 100 throw new InvalidResultSetAccessException(se); 101 } 102 } 103 104 public String getColumnLabel(int column) throws InvalidResultSetAccessException { 105 try { 106 return this.resultSetMetaData.getColumnLabel(column); 107 } 108 catch (SQLException se) { 109 throw new InvalidResultSetAccessException(se); 110 } 111 } 112 113 public String getColumnName(int column) throws InvalidResultSetAccessException { 114 try { 115 return this.resultSetMetaData.getColumnName(column); 116 } 117 catch (SQLException se) { 118 throw new InvalidResultSetAccessException(se); 119 } 120 } 121 122 public int getColumnType(int column) throws InvalidResultSetAccessException { 123 try { 124 return this.resultSetMetaData.getColumnType(column); 125 } 126 catch (SQLException se) { 127 throw new InvalidResultSetAccessException(se); 128 } 129 } 130 131 public String getColumnTypeName(int column) throws InvalidResultSetAccessException { 132 try { 133 return this.resultSetMetaData.getColumnTypeName(column); 134 } 135 catch (SQLException se) { 136 throw new InvalidResultSetAccessException(se); 137 } 138 } 139 140 public int getPrecision(int column) throws InvalidResultSetAccessException { 141 try { 142 return this.resultSetMetaData.getPrecision(column); 143 } 144 catch (SQLException se) { 145 throw new InvalidResultSetAccessException(se); 146 } 147 } 148 149 public int getScale(int column) throws InvalidResultSetAccessException { 150 try { 151 return this.resultSetMetaData.getScale(column); 152 } 153 catch (SQLException se) { 154 throw new InvalidResultSetAccessException(se); 155 } 156 } 157 158 public String getSchemaName(int column) throws InvalidResultSetAccessException { 159 try { 160 return this.resultSetMetaData.getSchemaName(column); 161 } 162 catch (SQLException se) { 163 throw new InvalidResultSetAccessException(se); 164 } 165 } 166 167 public String getTableName(int column) throws InvalidResultSetAccessException { 168 try { 169 return this.resultSetMetaData.getTableName(column); 170 } 171 catch (SQLException se) { 172 throw new InvalidResultSetAccessException(se); 173 } 174 } 175 176 public boolean isCaseSensitive(int column) throws InvalidResultSetAccessException { 177 try { 178 return this.resultSetMetaData.isCaseSensitive(column); 179 } 180 catch (SQLException se) { 181 throw new InvalidResultSetAccessException(se); 182 } 183 } 184 185 public boolean isCurrency(int column) throws InvalidResultSetAccessException { 186 try { 187 return this.resultSetMetaData.isCurrency(column); 188 } 189 catch (SQLException se) { 190 throw new InvalidResultSetAccessException(se); 191 } 192 } 193 194 public boolean isSigned(int column) throws InvalidResultSetAccessException { 195 try { 196 return this.resultSetMetaData.isSigned(column); 197 } 198 catch (SQLException se) { 199 throw new InvalidResultSetAccessException(se); 200 } 201 } 202 203 } 204 | Popular Tags |