1 22 package org.jboss.resource.adapter.jdbc.remote; 23 24 import java.sql.ResultSetMetaData ; 25 import java.sql.SQLException ; 26 import java.io.Serializable ; 27 28 33 public class SerializableResultSetMetaData 34 implements ResultSetMetaData , Serializable 35 { 36 37 static final long serialVersionUID = -6663485432752348789L; 38 39 private ColumnData[] columnData; 40 41 private static class ColumnData implements Serializable 42 { 43 static final long serialVersionUID = 5060626133767712300L; 44 String className; 45 String label; 46 String name; 47 int type; 48 String typeName; 49 } 50 51 SerializableResultSetMetaData(ResultSetMetaData metaData) throws SQLException 52 { 53 int count = metaData.getColumnCount(); 54 columnData = new ColumnData[count+1]; 55 for(int c = 1; c <= count; c ++) 56 { 57 ColumnData data = new ColumnData(); 58 columnData[c] = data; 59 data.label = metaData.getColumnLabel(c); 60 data.name = metaData.getColumnName(c); 61 data.type = metaData.getColumnType(c); 62 63 } 64 } 65 66 public int getColumnCount() throws SQLException 67 { 68 return columnData.length - 1; 70 } 71 72 public boolean isAutoIncrement(int column) throws SQLException 73 { 74 return false; 75 } 76 77 public boolean isCaseSensitive(int column) throws SQLException 78 { 79 return false; 80 } 81 82 public boolean isSearchable(int column) throws SQLException 83 { 84 return false; 85 } 86 87 public boolean isCurrency(int column) throws SQLException 88 { 89 return false; 90 } 91 92 public int isNullable(int column) throws SQLException 93 { 94 return 0; 95 } 96 97 public boolean isSigned(int column) throws SQLException 98 { 99 return false; 100 } 101 102 public int getColumnDisplaySize(int column) throws SQLException 103 { 104 return 0; 105 } 106 107 public String getColumnLabel(int column) throws SQLException 108 { 109 return columnData[column].label; 110 } 111 112 public String getColumnName(int column) throws SQLException 113 { 114 return columnData[column].name; 115 } 116 117 public String getSchemaName(int column) throws SQLException 118 { 119 return null; 120 } 121 122 public int getPrecision(int column) throws SQLException 123 { 124 return 0; 125 } 126 127 public int getScale(int column) throws SQLException 128 { 129 return 0; 130 } 131 132 public String getTableName(int column) throws SQLException 133 { 134 return ""; 135 } 136 137 public String getCatalogName(int column) throws SQLException 138 { 139 return ""; 140 } 141 142 public int getColumnType(int column) throws SQLException 143 { 144 return columnData[column].type; 145 } 146 147 public String getColumnTypeName(int column) throws SQLException 148 { 149 return columnData[column].typeName; 150 } 151 152 public boolean isReadOnly(int column) throws SQLException 153 { 154 return false; 155 } 156 157 public boolean isWritable(int column) throws SQLException 158 { 159 return false; 160 } 161 162 public boolean isDefinitelyWritable(int column) throws SQLException 163 { 164 return false; 165 } 166 167 public String getColumnClassName(int column) throws SQLException 168 { 169 return columnData[column].className; 170 } 171 } 172 | Popular Tags |