1 18 19 package org.webdocwf.util.xml; 20 21 import java.sql.ResultSetMetaData ; 22 import java.sql.SQLException ; 23 import java.sql.Types ; 24 25 30 public class XmlResultSetMetaData implements ResultSetMetaData 31 { 32 33 final static int DISPLAY_SIZE = 20; 34 35 protected String [] columnNames; 36 37 protected String tableName; 38 39 44 XmlResultSetMetaData(String tableName, String [] columnNames) 45 { 46 this.tableName = tableName; 47 this.columnNames = columnNames; 48 } 49 50 51 58 public String getColumnClassName(int column) throws SQLException 59 { 60 return String .class.getName(); 61 } 62 63 64 69 public int getColumnCount() throws SQLException 70 { 71 return columnNames.length; 72 } 73 74 75 81 public String getCatalogName(int column) throws SQLException 82 { 83 return ""; 84 } 85 86 87 93 public int getColumnDisplaySize(int column) throws SQLException 94 { 95 return DISPLAY_SIZE; 96 } 97 98 99 105 public boolean isAutoIncrement(int column) throws SQLException 106 { 107 return false; 108 } 109 110 111 117 public boolean isCaseSensitive(int column) throws SQLException 118 { 119 return false; 121 } 122 123 124 130 public boolean isSearchable(int column) throws SQLException 131 { 132 return true; 134 } 135 136 137 143 public boolean isCurrency(int column) throws SQLException 144 { 145 return false; 146 } 147 148 149 155 public int isNullable(int column) throws SQLException 156 { 157 return ResultSetMetaData.columnNullableUnknown; 158 } 159 160 161 167 public boolean isSigned(int column) throws SQLException 168 { 169 return false; 170 } 171 172 173 179 public String getColumnLabel(int column) throws SQLException 180 { 181 return columnNames[column-1]; 183 } 184 185 186 192 public String getColumnName(int column) throws SQLException 193 { 194 return columnNames[column-1]; 196 } 197 198 199 204 public String getSchemaName(int column) throws SQLException 205 { 206 return ""; 207 } 208 209 210 215 public int getPrecision(int column) throws SQLException 216 { 217 return 0; 219 } 220 221 222 227 public int getScale(int column) throws SQLException 228 { 229 return 0; 231 } 232 233 234 239 public String getTableName(int column) throws SQLException 240 { 241 return tableName; 242 } 243 244 245 250 public int getColumnType(int column) throws SQLException 251 { 252 return Types.VARCHAR; 253 } 254 255 256 261 public String getColumnTypeName(int column) throws SQLException 262 { 263 return "VARCHAR"; 264 } 265 266 267 272 public boolean isReadOnly(int column) throws SQLException 273 { 274 return true; 275 } 276 277 278 283 public boolean isWritable(int column) throws SQLException 284 { 285 return false; 286 } 287 288 289 294 public boolean isDefinitelyWritable(int column) throws SQLException 295 { 296 return false; 297 } 298 299 } 300 301 | Popular Tags |