You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by da...@apache.org on 2006/02/17 15:51:38 UTC

svn commit: r378538 - in /db/derby/code/trunk/java/client/org/apache/derby/client: am/CallableStatement40.java am/PreparedStatement40.java am/SQLExceptionFactory.java net/NetConnection40.java net/NetDatabaseMetaData40.java net/NetResultSet40.java

Author: davidvc
Date: Fri Feb 17 06:51:37 2006
New Revision: 378538

URL: http://svn.apache.org/viewcvs?rev=378538&view=rev
Log:
DERBY-983: Remove use of Util.notImplemented(), and instead have
a client-only utility class for shorthand exceptions

Contributed by Anurag Shekhar

Added:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/SQLExceptionFactory.java   (with props)
Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement40.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement40.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection40.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetDatabaseMetaData40.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement40.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement40.java?rev=378538&r1=378537&r2=378538&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement40.java Fri Feb 17 06:51:37 2006
@@ -20,7 +20,6 @@
 
 package org.apache.derby.client.am;
 
-import org.apache.derby.impl.jdbc.Util;
 import java.io.InputStream;
 import java.io.Reader;
 import java.sql.NClob;
@@ -45,72 +44,73 @@
     
     
     public RowId getRowId(int parameterIndex) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("getRowId (int)");
     }
     
     public RowId getRowId(String parameterName) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("getRowId (String)");
     }
     
     public void setRowId(String parameterName, RowId x) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("setRowId (String, RowId)");
     }
     
     
     public void setNString(String parameterName, String value)
     throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("setNString (String, String)");
     }
     
     public void setNCharacterStream(String parameterName, Reader value, long length)
     throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented (
+                "setNString (String, Reader, long)");
     }
     
     public void setNClob(String parameterName, NClob value) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("setNClob (String, NClob)");
     }
     
     public void setClob(String parameterName, Reader reader, long length)
     throws SQLException{
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("setClob (String, Reader, long)");
         
     }
     
     public void setBlob(String parameterName, InputStream inputStream, long length)
     throws SQLException{
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("setBlob (String, InputStream, long)");
     }
     
     public void setNClob(String parameterName, Reader reader, long length)
     throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("setNClob (String, Reader, long)");
     }
     
     public NClob getNClob(int i) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("setNClob (int)");
     }
     
     
     public NClob getNClob(String parameterName) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("setNClob (String)");
     }
     
     public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("setSQLXML (String, SQLXML)");
         
     }
     
     public SQLXML getSQLXML(int parameterIndex) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("getSQLXML (int)");
     }
     
     public SQLXML getSQLXML(String parametername) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("getSQLXML (String)");
     }
     
     public void setRowId(int parameterIndex, RowId x) throws SQLException{
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("setRowId (int, RowId)");
     }
     
     /*********************************************************************************************************

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement40.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement40.java?rev=378538&r1=378537&r2=378538&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement40.java Fri Feb 17 06:51:37 2006
@@ -20,7 +20,6 @@
 
 package org.apache.derby.client.am;
 
-import org.apache.derby.impl.jdbc.Util;
 import java.sql.RowId;
 import java.sql.NClob;
 import java.sql.SQLException;
@@ -47,46 +46,47 @@
     
     
     public void setRowId(int parameterIndex, RowId x) throws SQLException{
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("setRowId (int, RowId)");
     }
     
     public void setNString(int index, String value) throws SQLException{
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("setNString (int, String)");
     }
     
     public void setNCharacterStream(int index, Reader value, long length) throws SQLException{
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("setNCharacterStream " +
+                "(int,Reader,long)");
     }
     
     public void setNClob(int index, NClob value) throws SQLException{
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("setNClob (int, NClob)");
     }
     
     public void setClob(int parameterIndex, Reader reader, long length)
     throws SQLException{
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("setClob (int, Reader, long)");
     }
     
     public void setBlob(int parameterIndex, InputStream inputStream, long length)
     throws SQLException{
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("setBlob (int, InputStream, long)");
     }
     public void setNClob(int parameterIndex, Reader reader, long length)
     throws SQLException{
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("setNClob (int, Reader, long)");
     }
     
     public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException{
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("setSQLXML (int, SQLXML)");
     }
     
     public void setPoolable(boolean poolable)
     throws SQLException{
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("setPoolable (boolean)");
     }
     
     public boolean isPoolable()
     throws SQLException{
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("isPoolable ()");
     }
 }

Added: db/derby/code/trunk/java/client/org/apache/derby/client/am/SQLExceptionFactory.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/SQLExceptionFactory.java?rev=378538&view=auto
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/SQLExceptionFactory.java (added)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/SQLExceptionFactory.java Fri Feb 17 06:51:37 2006
@@ -0,0 +1,38 @@
+/*
+
+   Derby - Class org.apache.derby.client.am.SQLExceptionFactory
+
+   Copyright (c) 2006 The Apache Software Foundation or its licensors, where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.am;
+
+import java.sql.SQLException;
+import org.apache.derby.shared.common.reference.SQLState;
+
+/**
+ * class to create SQLException
+ */
+
+public class SQLExceptionFactory {     
+     
+    public static SQLException notImplemented (String feature) {
+        SqlException sqlException = new SqlException (null, 
+                new MessageId (SQLState.NOT_IMPLEMENTED), feature);
+        return sqlException.getSQLException();
+    }
+    
+}

Propchange: db/derby/code/trunk/java/client/org/apache/derby/client/am/SQLExceptionFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection40.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection40.java?rev=378538&r1=378537&r2=378538&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection40.java Fri Feb 17 06:51:37 2006
@@ -20,8 +20,8 @@
 
 package org.apache.derby.client.net;
 
+import org.apache.derby.client.am.SQLExceptionFactory;
 import org.apache.derby.client.am.SqlException;
-import org.apache.derby.impl.jdbc.Util;
 import org.apache.derby.jdbc.InternalDriver;
 import java.sql.Blob;
 import java.sql.ClientInfoException;
@@ -79,33 +79,33 @@
     
     
     public Clob createClob() throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("createClob ()");
     }
 
     public Blob createBlob() throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("createBlob ()");
     }
     
     public NClob createNClob() throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("createNClob ()");
     }
 
     public SQLXML createSQLXML() throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("createSQLXML ()");
     }
 
     public boolean isValid(int timeout) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("isValid ()");
     }
 
     public void setClientInfo(String name, String value)
 		throws SQLException{
-	throw Util.notImplemented();
+	throw SQLExceptionFactory.notImplemented ("setClientInfo (String, String)");
     }
 	
     public void setClientInfo(Properties properties)
 		throws ClientInfoException {
-	SQLException temp= Util.notImplemented();
+	SQLException temp= SQLExceptionFactory.notImplemented ("setClientInfo ()");
 	ClientInfoException clientInfoException = new ClientInfoException
 	(temp.getMessage(),temp.getSQLState(),(Properties) null);
 	throw clientInfoException; 
@@ -113,20 +113,20 @@
 	
     public String getClientInfo(String name)
 		throws SQLException{
-	throw Util.notImplemented();
+	throw SQLExceptionFactory.notImplemented ("getClientInfo (String)");
     }
 	
     public Properties getClientInfo()
 		throws SQLException{
-	throw Util.notImplemented();
+	throw SQLExceptionFactory.notImplemented ("getClientInfo (Properties)");
     }
     
     public <T> T createQueryObject(Class<T> ifc) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("createQueryObject (Class<T>)");
     }
     
     public java.util.Map<String,Class<?>> getTypeMap(){
-	throw new java.lang.UnsupportedOperationException();
+        throw new java.lang.UnsupportedOperationException("getTypeMap()");
     }
     
 }

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetDatabaseMetaData40.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetDatabaseMetaData40.java?rev=378538&r1=378537&r2=378538&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetDatabaseMetaData40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetDatabaseMetaData40.java Fri Feb 17 06:51:37 2006
@@ -23,7 +23,7 @@
 import java.sql.ResultSet;
 import java.sql.RowIdLifetime;
 import java.sql.SQLException;
-import org.apache.derby.impl.jdbc.Util;
+import org.apache.derby.client.am.SQLExceptionFactory;
 
 public class NetDatabaseMetaData40 extends org.apache.derby.client.net.NetDatabaseMetaData {
     
@@ -33,29 +33,31 @@
     }
     
     public RowIdLifetime getRowIdLifetime() throws SQLException {
-        throw Util.notImplemented();
+	throw SQLExceptionFactory.notImplemented ("getRowIdLifetime ()");
         
     }
     
     public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("getSchemas (String, String)");
     }
     
     
     public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented (
+                "supportsStoredFunctionsUsingCallSyntax ()");
     }
     
     public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented (
+                "autoCommitFailureClosesAllResultSets ()");
     }
     
     public ResultSet getClientInfoProperties()
     throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("getClientInfoProperties ()");
     }
     
     public boolean providesQueryObjectGenerator() throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("providesQueryObjectGenerator ()");
     }
 }

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java?rev=378538&r1=378537&r2=378538&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java Fri Feb 17 06:51:37 2006
@@ -26,7 +26,7 @@
 import java.sql.RowId;
 import java.sql.SQLException;
 import java.sql.SQLXML;
-import org.apache.derby.impl.jdbc.Util;
+import org.apache.derby.client.am.SQLExceptionFactory;
 import org.apache.derby.iapi.sql.ResultSet;
 import org.apache.derby.client.am.Cursor;
 
@@ -49,68 +49,68 @@
     }
     
     public RowId getRowId(int columnIndex) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("getRowId (int)");
     }
     
     
     public RowId getRowId(String columnName) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("getRowId (String)");
     }
     
     public void updateRowId(int columnIndex, RowId x) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("updateRowId (int, RowId)");
     }
     
     public void updateRowId(String columnName, RowId x) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("updateRowId (String, RowId)");
     }
     
     public int getHoldability() throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("getHoldability ()");
     }
     
     public boolean isClosed() throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("isClosed ()");
     }
     
     public void updateNString(int columnIndex, String nString) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("updateNString (int, String)");
     }
     
     public void updateNString(String columnName, String nString) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("updateNString (String, String)");
     }
     
     public void updateNClob(int columnIndex, NClob nClob) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("updateNClob (int, NClob)");
     }
     
     public void updateNClob(String columnName, NClob nClob) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("updateNClob (String, NClob)");
     }
     
     public NClob getNClob(int i) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("getNClob (int)");
     }
     
     public NClob getNClob(String colName) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("getNClob (String)");
     }
     
     public SQLXML getSQLXML(int columnIndex) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("getSQLXML (int)");
     }
     
     public SQLXML getSQLXML(String colName) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("getSQLXML (String)");
     }
     
     public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("updateSQLXML (int, SQLXML)");
     }
     
     public void updateSQLXML(String columnName, SQLXML xmlObject) throws SQLException {
-        throw Util.notImplemented();
+        throw SQLExceptionFactory.notImplemented ("updateSQLXML (String, SQLXML)");
     }
     
 }