Ejemplo n.º 1
0
 public Map<String, Class<?>> getTypeMap() throws SQLException {
   String methodCall = "getTypeMap()";
   try {
     return (Map<String, Class<?>>) reportReturn(methodCall, realConnection.getTypeMap());
   } catch (SQLException s) {
     reportException(methodCall, s);
     throw s;
   }
 }
Ejemplo n.º 2
0
  public TypeMap(final Connection connection) {
    final Map<String, Class<?>> sqlTypeMap = createDefaultTypeMap();

    if (connection != null) {
      // Override and add mappings from the connection
      try {
        final Map<String, Class<?>> typeMap = connection.getTypeMap();
        if (typeMap != null && !typeMap.isEmpty()) {
          sqlTypeMap.putAll(typeMap);
        }
      } catch (final Exception e) {
        // Catch all exceptions, since even though most JDBC drivers
        // would throw SQLException, but the Sybase Adaptive
        // Server driver throws UnimplementedOperationException
        LOGGER.log(Level.WARNING, "Could not obtain data type map from connection", e);
      }
    }

    this.sqlTypeMap = sqlTypeMap;
  }
 /**
  * Pass thru method to the wrapped jdbc 1.x {@link java.sql.Connection}.
  *
  * @exception SQLException if this connection is closed or an error occurs in the wrapped
  *     connection.
  */
 public Map getTypeMap() throws SQLException {
   assertOpen();
   return connection.getTypeMap();
 }
Ejemplo n.º 4
0
 public Map getTypeMap() throws SQLException {
   return con.getTypeMap();
 }
Ejemplo n.º 5
0
 @Override
 public Map<String, Class<?>> getTypeMap() throws SQLException {
   return conn.getTypeMap();
 }
Ejemplo n.º 6
0
  @Test
  public void testUnsupportedOperations() throws Exception {
    Connection conn = getConnection();

    try {
      conn.prepareCall(null);
      fail();
    } catch (UnsupportedOperationException ignore) {
    }

    try {
      conn.setReadOnly(false);
      fail();
    } catch (UnsupportedOperationException ignore) {
    }

    try {
      conn.setCatalog(null);
      fail();
    } catch (UnsupportedOperationException ignore) {
    }

    try {
      conn.getCatalog();
      fail();
    } catch (UnsupportedOperationException ignore) {
    }

    try {
      conn.prepareCall(null, 0, 0);
      fail();
    } catch (UnsupportedOperationException ignore) {
    }

    try {
      conn.setTypeMap(null);
      fail();
    } catch (UnsupportedOperationException ignore) {
    }

    try {
      conn.getTypeMap();
      fail();
    } catch (UnsupportedOperationException ignore) {
    }

    try {
      conn.setSavepoint();
      fail();
    } catch (UnsupportedOperationException ignore) {
    }

    try {
      conn.setSavepoint(null);
      fail();
    } catch (UnsupportedOperationException ignore) {
    }

    try {
      conn.rollback(null);
      fail();
    } catch (UnsupportedOperationException ignore) {
    }

    try {
      conn.releaseSavepoint(null);
      fail();
    } catch (UnsupportedOperationException ignore) {
    }

    try {
      conn.prepareCall(null, 0, 0, 0);
      fail();
    } catch (UnsupportedOperationException ignore) {
    }

    try {
      conn.createClob();
      fail();
    } catch (UnsupportedOperationException ignore) {
    }

    try {
      conn.createBlob();
      fail();
    } catch (UnsupportedOperationException ignore) {
    }

    try {
      conn.createNClob();
      fail();
    } catch (UnsupportedOperationException ignore) {
    }

    try {
      conn.createSQLXML();
      fail();
    } catch (UnsupportedOperationException ignore) {
    }

    try {
      conn.createArrayOf(null, (Object[]) null);
      fail();
    } catch (UnsupportedOperationException ignore) {
    }

    try {
      conn.createStruct(null, (Object[]) null);
      fail();
    } catch (UnsupportedOperationException ignore) {
    }

    try {
      conn.setSchema(null);
      fail();
    } catch (UnsupportedOperationException ignore) {
    }

    try {
      conn.getSchema();
      fail();
    } catch (UnsupportedOperationException ignore) {
    }

    try {
      conn.abort(null);
      fail();
    } catch (UnsupportedOperationException ignore) {
    }

    try {
      conn.setNetworkTimeout(null, 0);
      fail();
    } catch (UnsupportedOperationException ignore) {
    }

    try {
      conn.getNetworkTimeout();
      fail();
    } catch (UnsupportedOperationException ignore) {
    }
  }