|
| 1 | +package org.postgresql.jdbc2; |
| 2 | + |
| 3 | +// IMPORTANT NOTE: This is the begining of supporting updatable ResultSets. |
| 4 | +// It is not a working solution (yet)! |
| 5 | +// |
| 6 | +// You will notice here we really do throw org.postgresql.Driver.notImplemented() |
| 7 | +// This is because here we should be updateable, so any unimplemented methods |
| 8 | +// must say so. |
| 9 | +// |
| 10 | +// Also you'll notice that the String columnName based calls are not present. |
| 11 | +// They are not required as they are in the super class. |
| 12 | +// |
| 13 | + |
| 14 | +import java.lang.*; |
| 15 | +import java.io.*; |
| 16 | +import java.math.*; |
| 17 | +import java.text.*; |
| 18 | +import java.util.*; |
| 19 | +import java.sql.*; |
| 20 | +import org.postgresql.Field; |
| 21 | +import org.postgresql.largeobject.*; |
| 22 | +import org.postgresql.util.*; |
| 23 | + |
| 24 | +/** |
| 25 | + * @see ResultSet |
| 26 | + * @see ResultSetMetaData |
| 27 | + * @see java.sql.ResultSet |
| 28 | + */ |
| 29 | +public class UpdateableResultSet extends org.postgresql.jdbc2.ResultSet |
| 30 | +{ |
| 31 | + |
| 32 | + /** |
| 33 | + * Create a new ResultSet - Note that we create ResultSets to |
| 34 | + * represent the results of everything. |
| 35 | + * |
| 36 | + * @param fields an array of Field objects (basically, the |
| 37 | + * ResultSet MetaData) |
| 38 | + * @param tuples Vector of the actual data |
| 39 | + * @param status the status string returned from the back end |
| 40 | + * @param updateCount the number of rows affected by the operation |
| 41 | + * @param cursor the positioned update/delete cursor name |
| 42 | + */ |
| 43 | + public UpdateableResultSet(Connection conn, Field[] fields, Vector tuples, String status, int updateCount,int insertOID) |
| 44 | + { |
| 45 | + super(conn,fields,tuples,status,updateCount,insertOID); |
| 46 | + } |
| 47 | + |
| 48 | + /** |
| 49 | + * Create a new ResultSet - Note that we create ResultSets to |
| 50 | + * represent the results of everything. |
| 51 | + * |
| 52 | + * @param fields an array of Field objects (basically, the |
| 53 | + * ResultSet MetaData) |
| 54 | + * @param tuples Vector of the actual data |
| 55 | + * @param status the status string returned from the back end |
| 56 | + * @param updateCount the number of rows affected by the operation |
| 57 | + * @param cursor the positioned update/delete cursor name |
| 58 | + */ |
| 59 | + public UpdateableResultSet(Connection conn, Field[] fields, Vector tuples, String status, int updateCount) |
| 60 | + { |
| 61 | + super(conn,fields,tuples,status,updateCount,0); |
| 62 | + } |
| 63 | + |
| 64 | + public void cancelRowUpdates() throws SQLException |
| 65 | + { |
| 66 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 67 | + throw org.postgresql.Driver.notImplemented(); |
| 68 | + } |
| 69 | + |
| 70 | + public void deleteRow() throws SQLException |
| 71 | + { |
| 72 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 73 | + throw org.postgresql.Driver.notImplemented(); |
| 74 | + } |
| 75 | + |
| 76 | + public int getConcurrency() throws SQLException |
| 77 | + { |
| 78 | + // New in 7.1 - The updateable ResultSet class will now return |
| 79 | + // CONCUR_UPDATEABLE. |
| 80 | + return CONCUR_UPDATABLE; |
| 81 | + } |
| 82 | + |
| 83 | + public void insertRow() throws SQLException |
| 84 | + { |
| 85 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 86 | + throw org.postgresql.Driver.notImplemented(); |
| 87 | + } |
| 88 | + |
| 89 | + public void moveToCurrentRow() throws SQLException |
| 90 | + { |
| 91 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 92 | + throw org.postgresql.Driver.notImplemented(); |
| 93 | + } |
| 94 | + |
| 95 | + public void moveToInsertRow() throws SQLException |
| 96 | + { |
| 97 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 98 | + throw org.postgresql.Driver.notImplemented(); |
| 99 | + } |
| 100 | + |
| 101 | + public boolean rowDeleted() throws SQLException |
| 102 | + { |
| 103 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 104 | + throw org.postgresql.Driver.notImplemented(); |
| 105 | + //return false; // javac complains about not returning a value! |
| 106 | + } |
| 107 | + |
| 108 | + public boolean rowInserted() throws SQLException |
| 109 | + { |
| 110 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 111 | + throw org.postgresql.Driver.notImplemented(); |
| 112 | + //return false; // javac complains about not returning a value! |
| 113 | + } |
| 114 | + |
| 115 | + public boolean rowUpdated() throws SQLException |
| 116 | + { |
| 117 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 118 | + throw org.postgresql.Driver.notImplemented(); |
| 119 | + //return false; // javac complains about not returning a value! |
| 120 | + } |
| 121 | + |
| 122 | + public void updateAsciiStream(int columnIndex, |
| 123 | + java.io.InputStream x, |
| 124 | + int length |
| 125 | + ) throws SQLException |
| 126 | + { |
| 127 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 128 | + throw org.postgresql.Driver.notImplemented(); |
| 129 | + } |
| 130 | + |
| 131 | + public void updateBigDecimal(int columnIndex, |
| 132 | + java.math.BigDecimal x |
| 133 | + ) throws SQLException |
| 134 | + { |
| 135 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 136 | + throw org.postgresql.Driver.notImplemented(); |
| 137 | + } |
| 138 | + |
| 139 | + public void updateBinaryStream(int columnIndex, |
| 140 | + java.io.InputStream x, |
| 141 | + int length |
| 142 | + ) throws SQLException |
| 143 | + { |
| 144 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 145 | + throw org.postgresql.Driver.notImplemented(); |
| 146 | + } |
| 147 | + |
| 148 | + public void updateBoolean(int columnIndex,boolean x) throws SQLException |
| 149 | + { |
| 150 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 151 | + throw org.postgresql.Driver.notImplemented(); |
| 152 | + } |
| 153 | + |
| 154 | + public void updateByte(int columnIndex,byte x) throws SQLException |
| 155 | + { |
| 156 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 157 | + throw org.postgresql.Driver.notImplemented(); |
| 158 | + } |
| 159 | + |
| 160 | + public void updateBytes(int columnIndex,byte[] x) throws SQLException |
| 161 | + { |
| 162 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 163 | + throw org.postgresql.Driver.notImplemented(); |
| 164 | + } |
| 165 | + |
| 166 | + public void updateCharacterStream(int columnIndex, |
| 167 | + java.io.Reader x, |
| 168 | + int length |
| 169 | + ) throws SQLException |
| 170 | + { |
| 171 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 172 | + throw org.postgresql.Driver.notImplemented(); |
| 173 | + } |
| 174 | + |
| 175 | + public void updateDate(int columnIndex,java.sql.Date x) throws SQLException |
| 176 | + { |
| 177 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 178 | + throw org.postgresql.Driver.notImplemented(); |
| 179 | + } |
| 180 | + |
| 181 | + public void updateDouble(int columnIndex,double x) throws SQLException |
| 182 | + { |
| 183 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 184 | + throw org.postgresql.Driver.notImplemented(); |
| 185 | + } |
| 186 | + |
| 187 | + public void updateFloat(int columnIndex,float x) throws SQLException |
| 188 | + { |
| 189 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 190 | + throw org.postgresql.Driver.notImplemented(); |
| 191 | + } |
| 192 | + |
| 193 | + public void updateInt(int columnIndex,int x) throws SQLException |
| 194 | + { |
| 195 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 196 | + throw org.postgresql.Driver.notImplemented(); |
| 197 | + } |
| 198 | + |
| 199 | + public void updateLong(int columnIndex,long x) throws SQLException |
| 200 | + { |
| 201 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 202 | + throw org.postgresql.Driver.notImplemented(); |
| 203 | + } |
| 204 | + |
| 205 | + public void updateNull(int columnIndex) throws SQLException |
| 206 | + { |
| 207 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 208 | + throw org.postgresql.Driver.notImplemented(); |
| 209 | + } |
| 210 | + |
| 211 | + public void updateObject(int columnIndex,Object x) throws SQLException |
| 212 | + { |
| 213 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 214 | + throw org.postgresql.Driver.notImplemented(); |
| 215 | + } |
| 216 | + |
| 217 | + public void updateObject(int columnIndex,Object x,int scale) throws SQLException |
| 218 | + { |
| 219 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 220 | + throw org.postgresql.Driver.notImplemented(); |
| 221 | + } |
| 222 | + |
| 223 | + public void updateRow() throws SQLException |
| 224 | + { |
| 225 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 226 | + throw org.postgresql.Driver.notImplemented(); |
| 227 | + } |
| 228 | + |
| 229 | + public void updateShort(int columnIndex,short x) throws SQLException |
| 230 | + { |
| 231 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 232 | + throw org.postgresql.Driver.notImplemented(); |
| 233 | + } |
| 234 | + |
| 235 | + public void updateString(int columnIndex,String x) throws SQLException |
| 236 | + { |
| 237 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 238 | + throw org.postgresql.Driver.notImplemented(); |
| 239 | + } |
| 240 | + |
| 241 | + public void updateTime(int columnIndex,Time x) throws SQLException |
| 242 | + { |
| 243 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 244 | + throw org.postgresql.Driver.notImplemented(); |
| 245 | + } |
| 246 | + |
| 247 | + public void updateTimestamp(int columnIndex,Timestamp x) throws SQLException |
| 248 | + { |
| 249 | + // only sub-classes implement CONCUR_UPDATEABLE |
| 250 | + throw org.postgresql.Driver.notImplemented(); |
| 251 | + } |
| 252 | + |
| 253 | +} |
| 254 | + |
0 commit comments