Changeset: 9f2406ce479b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9f2406ce479b
Modified Files:
java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
Branch: Jun2016
Log Message:
Shrinking code size, class size and runtime String heap size by
replacing all "Method Xxxx not supported yet, sorry!" strings into
a method which composes and standardises the message string in one place.
diffs (truncated from 734 to 300 lines):
diff --git a/java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
b/java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
--- a/java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
+++ b/java/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
@@ -328,30 +328,30 @@ public class MonetResultSet extends Mone
}
@Override
- public Array getArray(int i) throws SQLException {
- throw new SQLFeatureNotSupportedException("Method getArray not
implemented yet, sorry!", "0A000");
+ public Array getArray(int columnIndex) throws SQLException {
+ throw newSQLFeatureNotSupportedException("getArray");
}
@Override
public Array getArray(String colName) throws SQLException {
- throw new SQLFeatureNotSupportedException("Method getArray not
implemented yet, sorry!", "0A000");
+ throw newSQLFeatureNotSupportedException("getArray");
}
/* Mapi doesn't allow something for streams at the moment, thus all not
implemented for now */
@Override
public InputStream getAsciiStream(int columnIndex) throws SQLException {
- throw new SQLFeatureNotSupportedException("Method
getAsciiStream not implemented yet, sorry!", "0A000");
+ throw newSQLFeatureNotSupportedException("getAsciiStream");
}
@Override
public InputStream getAsciiStream(String columnName) throws
SQLException {
- throw new SQLFeatureNotSupportedException("Method
getAsciiStream not implemented yet, sorry!", "0A000");
+ throw newSQLFeatureNotSupportedException("getAsciiStream");
}
@Override
public InputStream getUnicodeStream(int columnIndex) throws
SQLException {
- throw new SQLFeatureNotSupportedException("Method
getUnicodeStream not implemented yet, sorry!", "0A000");
+ throw newSQLFeatureNotSupportedException("getUnicodeStream");
}
@Override
public InputStream getUnicodeStream(String columnName) throws
SQLException {
- throw new SQLFeatureNotSupportedException("Method
getUnicodeStream not implemented yet, sorry!", "0A000");
+ throw newSQLFeatureNotSupportedException("getUnicodeStream");
}
/**
@@ -470,7 +470,7 @@ public class MonetResultSet extends Mone
*/
@Override
public Reader getNCharacterStream(int columnIndex) throws SQLException {
- throw new
SQLFeatureNotSupportedException("getNCharacterStream() not supported", "0A000");
+ throw newSQLFeatureNotSupportedException("getNCharacterStream");
}
/**
@@ -489,7 +489,7 @@ public class MonetResultSet extends Mone
*/
@Override
public Reader getNCharacterStream(String columnName) throws
SQLException {
- return getNCharacterStream(findColumn(columnName));
+ throw newSQLFeatureNotSupportedException("getNCharacterStream");
}
/**
@@ -578,7 +578,7 @@ public class MonetResultSet extends Mone
*/
@Override
public NClob getNClob(int i) throws SQLException {
- throw new SQLFeatureNotSupportedException("getNClob() not
supported", "0A000");
+ throw newSQLFeatureNotSupportedException("getNClob");
}
/**
@@ -596,7 +596,7 @@ public class MonetResultSet extends Mone
*/
@Override
public NClob getNClob(String colName) throws SQLException {
- return getNClob(findColumn(colName));
+ throw newSQLFeatureNotSupportedException("getNClob");
}
/**
@@ -2039,9 +2039,14 @@ public class MonetResultSet extends Mone
}
@Override
- public Ref getRef(int i) throws SQLException { throw new
SQLException("Method getRef not implemented yet, sorry!", "0A000"); }
+ public Ref getRef(int i) throws SQLException {
+ throw newSQLFeatureNotSupportedException("getRef");
+ }
+
@Override
- public Ref getRef(String colName) throws SQLException { throw new
SQLException("Method getRef not implemented yet, sorry!", "0A000"); }
+ public Ref getRef(String colName) throws SQLException {
+ throw newSQLFeatureNotSupportedException("getRef");
+ }
/**
* Retrieves the current row number. The first row is number 1, the
second
@@ -2068,7 +2073,7 @@ public class MonetResultSet extends Mone
*/
@Override
public RowId getRowId(int columnIndex) throws SQLException {
- throw new SQLFeatureNotSupportedException("getRowId() not
supported", "0A000");
+ throw newSQLFeatureNotSupportedException("getRowId");
}
/**
@@ -2085,7 +2090,7 @@ public class MonetResultSet extends Mone
*/
@Override
public RowId getRowId(String columnName) throws SQLException {
- return getRowId(findColumn(columnName));
+ throw newSQLFeatureNotSupportedException("getRowId");
}
/**
@@ -2226,7 +2231,7 @@ public class MonetResultSet extends Mone
*/
@Override
public SQLXML getSQLXML(int i) throws SQLException {
- throw new SQLFeatureNotSupportedException("getSQLXML() not
supported", "0A000");
+ throw newSQLFeatureNotSupportedException("getSQLXML");
}
/**
@@ -2244,7 +2249,7 @@ public class MonetResultSet extends Mone
*/
@Override
public SQLXML getSQLXML(String colName) throws SQLException {
- return getSQLXML(findColumn(colName));
+ throw newSQLFeatureNotSupportedException("getSQLXML");
}
// This behaviour is according table B-6 of Sun JDBC Specification 3.0
@@ -2598,10 +2603,11 @@ public class MonetResultSet extends Mone
throws SQLException
{
int nanos = getJavaDate(cal, columnIndex, Types.TIMESTAMP);
- if (nanos == -1) return null;
+ if (nanos == -1)
+ return null;
+
Timestamp ts = new Timestamp(cal.getTimeInMillis());
ts.setNanos(nanos);
-
return ts;
}
@@ -2849,193 +2855,477 @@ public class MonetResultSet extends Mone
/* these methods are all related to updateable result sets, which we
currently do not support */
@Override
- public void cancelRowUpdates() throws SQLException { throw new
SQLFeatureNotSupportedException("Method cancelRowUpdates not implemented yet,
sorry!", "0A000"); }
+ public void cancelRowUpdates() throws SQLException {
+ throw newSQLFeatureNotSupportedException("cancelRowUpdates");
+ }
+
@Override
- public void deleteRow() throws SQLException { throw new
SQLFeatureNotSupportedException("Method deleteRow not implemented yet, sorry!",
"0A000"); }
+ public void deleteRow() throws SQLException {
+ throw newSQLFeatureNotSupportedException("deleteRow");
+ }
+
@Override
- public void insertRow() throws SQLException { throw new
SQLFeatureNotSupportedException("Method insertRow not implemented yet, sorry!",
"0A000"); }
+ public void insertRow() throws SQLException {
+ throw newSQLFeatureNotSupportedException("insertRow");
+ }
+
@Override
- public void moveToCurrentRow() throws SQLException { throw new
SQLFeatureNotSupportedException("Method moveToCurrentRow not implemented yet,
sorry!", "0A000"); }
+ public void moveToCurrentRow() throws SQLException {
+ throw newSQLFeatureNotSupportedException("moveToCurrentRow");
+ }
+
@Override
- public void moveToInsertRow() throws SQLException { throw new
SQLFeatureNotSupportedException("Method moveToInsertRow not implemented yet,
sorry!", "0A000"); }
+ public void moveToInsertRow() throws SQLException {
+ throw newSQLFeatureNotSupportedException("moveToInsertRow");
+ }
+
@Override
- public void refreshRow() throws SQLException { throw new
SQLFeatureNotSupportedException("Method refreshRow not implemented yet,
sorry!", "0A000"); }
+ public void refreshRow() throws SQLException {
+ throw newSQLFeatureNotSupportedException("refreshRow");
+ }
+
@Override
- public boolean rowDeleted() throws SQLException { throw new
SQLFeatureNotSupportedException("Method rowDeleted not implemented yet,
sorry!", "0A000"); }
+ public boolean rowDeleted() throws SQLException {
+ throw newSQLFeatureNotSupportedException("rowDeleted");
+ }
+
@Override
- public boolean rowInserted() throws SQLException { throw new
SQLFeatureNotSupportedException("Method rowInserted not implemented yet,
sorry!", "0A000"); }
+ public boolean rowInserted() throws SQLException {
+ throw newSQLFeatureNotSupportedException("rowInserted");
+ }
+
@Override
- public boolean rowUpdated() throws SQLException { throw new
SQLFeatureNotSupportedException("Method rowUpdated not implemented yet,
sorry!", "0A000"); }
+ public boolean rowUpdated() throws SQLException {
+ throw newSQLFeatureNotSupportedException("rowUpdated");
+ }
+
@Override
- public void setFetchDirection(int direction) throws SQLException {
throw new SQLFeatureNotSupportedException("Method setFetchDirection not
implemented yet, sorry!", "0A000"); }
+ public void setFetchDirection(int direction) throws SQLException {
+ throw newSQLFeatureNotSupportedException("setFetchDirection");
+ }
+
@Override
- public void updateArray(int columnIndex, Array x) throws SQLException {
throw new SQLFeatureNotSupportedException("Method updateArray not implemented
yet, sorry!", "0A000"); }
+ public void updateArray(int columnIndex, Array x) throws SQLException {
+ throw newSQLFeatureNotSupportedException("updateArray");
+ }
+
@Override
- public void updateArray(String columnName, Array x) throws SQLException
{ throw new SQLFeatureNotSupportedException("Method updateArray not implemented
yet, sorry!", "0A000"); }
+ public void updateArray(String columnName, Array x) throws SQLException
{
+ throw newSQLFeatureNotSupportedException("updateArray");
+ }
+
@Override
- public void updateAsciiStream(int columnIndex, InputStream xh) throws
SQLException { throw new SQLFeatureNotSupportedException("Method
updateAsciiStream not implemented yet, sorry!", "0A000"); }
+ public void updateAsciiStream(int columnIndex, InputStream xh) throws
SQLException {
+ throw newSQLFeatureNotSupportedException("updateAsciiStream");
+ }
+
@Override
- public void updateAsciiStream(int columnIndex, InputStream x, int
length) throws SQLException { throw new SQLFeatureNotSupportedException("Method
updateAsciiStream not implemented yet, sorry!", "0A000"); }
+ public void updateAsciiStream(int columnIndex, InputStream x, int
length) throws SQLException {
+ throw newSQLFeatureNotSupportedException("updateAsciiStream");
+ }
+
@Override
- public void updateAsciiStream(int columnIndex, InputStream x, long
length) throws SQLException { throw new SQLFeatureNotSupportedException("Method
updateAsciiStream not implemented yet, sorry!", "0A000"); }
+ public void updateAsciiStream(int columnIndex, InputStream x, long
length) throws SQLException {
+ throw newSQLFeatureNotSupportedException("updateAsciiStream");
+ }
+
@Override
- public void updateAsciiStream(String columnName, InputStream x) throws
SQLException { throw new SQLFeatureNotSupportedException("Method
updateAsciiStream not implemented yet, sorry!", "0A000"); }
+ public void updateAsciiStream(String columnName, InputStream x) throws
SQLException {
+ throw newSQLFeatureNotSupportedException("updateAsciiStream");
+ }
+
@Override
- public void updateAsciiStream(String columnName, InputStream x, int
length) throws SQLException { throw new SQLFeatureNotSupportedException("Method
updateAsciiStream not implemented yet, sorry!", "0A000"); }
+ public void updateAsciiStream(String columnName, InputStream x, int
length) throws SQLException {
+ throw newSQLFeatureNotSupportedException("updateAsciiStream");
+ }
+
@Override
- public void updateAsciiStream(String columnName, InputStream x, long
length) throws SQLException { throw new SQLFeatureNotSupportedException("Method
updateAsciiStream not implemented yet, sorry!", "0A000"); }
+ public void updateAsciiStream(String columnName, InputStream x, long
length) throws SQLException {
+ throw newSQLFeatureNotSupportedException("updateAsciiStream");
+ }
+
@Override
- public void updateBigDecimal(int columnIndex, BigDecimal x) throws
SQLException { throw new SQLFeatureNotSupportedException("Method
updateBigDecimal not implemented yet, sorry!", "0A000"); }
+ public void updateBigDecimal(int columnIndex, BigDecimal x) throws
SQLException {
+ throw newSQLFeatureNotSupportedException("updateBigDecimal");
+ }
+
@Override
- public void updateBigDecimal(String columnName, BigDecimal x) throws
SQLException { throw new SQLFeatureNotSupportedException("Method
updateBigDecimal not implemented yet, sorry!", "0A000"); }
+ public void updateBigDecimal(String columnName, BigDecimal x) throws
SQLException {
+ throw newSQLFeatureNotSupportedException("updateBigDecimal");
+ }
+
@Override
- public void updateBinaryStream(int columnIndex, InputStream x) throws
SQLException { throw new SQLFeatureNotSupportedException("Method
updateBinaryStream not implemented yet, sorry!", "0A000"); }
+ public void updateBinaryStream(int columnIndex, InputStream x) throws
SQLException {
+ throw newSQLFeatureNotSupportedException("updateBinaryStream");
+ }
+
@Override
- public void updateBinaryStream(int columnIndex, InputStream x, int
length) throws SQLException { throw new SQLFeatureNotSupportedException("Method
updateBinaryStream not implemented yet, sorry!", "0A000"); }
+ public void updateBinaryStream(int columnIndex, InputStream x, int
length) throws SQLException {
+ throw newSQLFeatureNotSupportedException("updateBinaryStream");
+ }
+
@Override
- public void updateBinaryStream(int columnIndex, InputStream x, long
length) throws SQLException { throw new SQLFeatureNotSupportedException("Method
updateBinaryStream not implemented yet, sorry!", "0A000"); }
+ public void updateBinaryStream(int columnIndex, InputStream x, long
length) throws SQLException {
+ throw newSQLFeatureNotSupportedException("updateBinaryStream");
+ }
+
@Override
- public void updateBinaryStream(String columnName, InputStream x) throws
SQLException { throw new SQLFeatureNotSupportedException("Method
updateBinaryStream not implemented yet, sorry!", "0A000"); }
+ public void updateBinaryStream(String columnName, InputStream x) throws
SQLException {
+ throw newSQLFeatureNotSupportedException("updateBinaryStream");
+ }
+
@Override
- public void updateBinaryStream(String columnName, InputStream x, int
length) throws SQLException { throw new SQLFeatureNotSupportedException("Method
updateBinaryStream not implemented yet, sorry!", "0A000"); }
+ public void updateBinaryStream(String columnName, InputStream x, int
length) throws SQLException {
+ throw newSQLFeatureNotSupportedException("updateBinaryStream");
+ }
+
@Override
- public void updateBinaryStream(String columnName, InputStream x, long
length) throws SQLException { throw new SQLFeatureNotSupportedException("Method
updateBinaryStream not implemented yet, sorry!", "0A000"); }
+ public void updateBinaryStream(String columnName, InputStream x, long
length) throws SQLException {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list