15
15
import org .postgresql .util .PSQLException ;
16
16
17
17
18
- /* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.13 2003/02/04 09:20:10 barry Exp $
18
+ /* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.14 2003/02/27 05:56:27 barry Exp $
19
19
* This class defines methods of the jdbc2 specification. This class extends
20
20
* org.postgresql.jdbc1.AbstractJdbc1ResultSet which provides the jdbc1
21
21
* methods. The real Statement class (for jdbc2) is org.postgresql.jdbc2.Jdbc2ResultSet
@@ -1261,22 +1261,6 @@ public synchronized void updateObject(String columnName, Object x)
1261
1261
}
1262
1262
1263
1263
1264
- private int _findColumn ( String columnName )
1265
- {
1266
- int i ;
1267
-
1268
- final int flen = fields .length ;
1269
- for (i = 0 ; i < flen ; ++i )
1270
- {
1271
- if (fields [i ].getName ().equalsIgnoreCase (columnName ))
1272
- {
1273
- return (i + 1 );
1274
- }
1275
- }
1276
- return -1 ;
1277
- }
1278
-
1279
-
1280
1264
/**
1281
1265
* Is this ResultSet updateable?
1282
1266
*/
@@ -1313,12 +1297,18 @@ boolean isUpdateable() throws SQLException
1313
1297
1314
1298
1315
1299
usingOID = false ;
1316
- int oidIndex = _findColumn ( "oid" );
1300
+ int oidIndex = 0 ;
1301
+ try {
1302
+ oidIndex = findColumn ( "oid" );
1303
+ } catch (SQLException l_se ) {
1304
+ //Ignore if column oid isn't selected
1305
+ }
1317
1306
int i = 0 ;
1318
1307
1319
1308
1320
1309
// if we find the oid then just use it
1321
1310
1311
+ //oidIndex will be >0 if the oid was in the select list
1322
1312
if ( oidIndex > 0 )
1323
1313
{
1324
1314
i ++;
@@ -1343,7 +1333,6 @@ boolean isUpdateable() throws SQLException
1343
1333
for (; rs .next (); i ++ )
1344
1334
{
1345
1335
String columnName = rs .getString (4 ); // get the columnName
1346
-
1347
1336
int index = findColumn ( columnName );
1348
1337
1349
1338
if ( index > 0 )
@@ -1413,7 +1402,7 @@ private void updateRowBuffer() throws SQLException
1413
1402
while ( columns .hasMoreElements () )
1414
1403
{
1415
1404
String columnName = (String ) columns .nextElement ();
1416
- int columnIndex = _findColumn ( columnName ) - 1 ;
1405
+ int columnIndex = findColumn ( columnName ) - 1 ;
1417
1406
1418
1407
Object valueObject = updateValues .get (columnName );
1419
1408
if (valueObject instanceof NullObject ) {
0 commit comments