Java 类java.sql.Struct 实例源码

项目:the-vigilantes    文件:JDBC4ResultSet.java   
@SuppressWarnings("unchecked")
public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
    if (type == null) {
        throw SQLError.createSQLException("Type parameter can not be null", SQLError.SQL_STATE_ILLEGAL_ARGUMENT, getExceptionInterceptor());
    }

    if (type.equals(Struct.class)) {
        throw new SQLFeatureNotSupportedException();
    } else if (type.equals(RowId.class)) {
        return (T) getRowId(columnIndex);
    } else if (type.equals(NClob.class)) {
        return (T) getNClob(columnIndex);
    } else if (type.equals(SQLXML.class)) {
        return (T) getSQLXML(columnIndex);
    }

    return super.getObject(columnIndex, type);
}
项目:OpenVertretung    文件:JDBC4ResultSet.java   
@SuppressWarnings("unchecked")
public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
    if (type == null) {
        throw SQLError.createSQLException("Type parameter can not be null", SQLError.SQL_STATE_ILLEGAL_ARGUMENT, getExceptionInterceptor());
    }

    if (type.equals(Struct.class)) {
        throw new SQLFeatureNotSupportedException();
    } else if (type.equals(RowId.class)) {
        return (T) getRowId(columnIndex);
    } else if (type.equals(NClob.class)) {
        return (T) getNClob(columnIndex);
    } else if (type.equals(SQLXML.class)) {
        return (T) getSQLXML(columnIndex);
    }

    return super.getObject(columnIndex, type);
}
项目:lams    文件:JDBC4ResultSet.java   
@SuppressWarnings("unchecked")
public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
    if (type == null) {
        throw SQLError.createSQLException("Type parameter can not be null", SQLError.SQL_STATE_ILLEGAL_ARGUMENT, getExceptionInterceptor());
    }

    if (type.equals(Struct.class)) {
        throw new SQLFeatureNotSupportedException();
    } else if (type.equals(RowId.class)) {
        return (T) getRowId(columnIndex);
    } else if (type.equals(NClob.class)) {
        return (T) getNClob(columnIndex);
    } else if (type.equals(SQLXML.class)) {
        return (T) getSQLXML(columnIndex);
    }

    return super.getObject(columnIndex, type);
}
项目:lams    文件:JdbcTypeJavaClassMappings.java   
private static ConcurrentHashMap<Class, Integer> buildJdbcJavaClassMappings() {
    ConcurrentHashMap<Class, Integer> jdbcJavaClassMappings = new ConcurrentHashMap<Class, Integer>();

    // these mappings are the ones outlined specifically in the spec
    jdbcJavaClassMappings.put( String.class, Types.VARCHAR );
    jdbcJavaClassMappings.put( BigDecimal.class, Types.NUMERIC );
    jdbcJavaClassMappings.put( Boolean.class, Types.BIT );
    jdbcJavaClassMappings.put( Integer.class, Types.INTEGER );
    jdbcJavaClassMappings.put( Long.class, Types.BIGINT );
    jdbcJavaClassMappings.put( Float.class, Types.REAL );
    jdbcJavaClassMappings.put( Double.class, Types.DOUBLE );
    jdbcJavaClassMappings.put( byte[].class, Types.LONGVARBINARY );
    jdbcJavaClassMappings.put( java.sql.Date.class, Types.DATE );
    jdbcJavaClassMappings.put( Time.class, Types.TIME );
    jdbcJavaClassMappings.put( Timestamp.class, Types.TIMESTAMP );
    jdbcJavaClassMappings.put( Blob.class, Types.BLOB );
    jdbcJavaClassMappings.put( Clob.class, Types.CLOB );
    jdbcJavaClassMappings.put( Array.class, Types.ARRAY );
    jdbcJavaClassMappings.put( Struct.class, Types.STRUCT );
    jdbcJavaClassMappings.put( Ref.class, Types.REF );
    jdbcJavaClassMappings.put( Class.class, Types.JAVA_OBJECT );

    // additional "common sense" registrations
    jdbcJavaClassMappings.put( Character.class, Types.CHAR );
    jdbcJavaClassMappings.put( char[].class, Types.VARCHAR );
    jdbcJavaClassMappings.put( Character[].class, Types.VARCHAR );
    jdbcJavaClassMappings.put( Byte[].class, Types.LONGVARBINARY );
    jdbcJavaClassMappings.put( java.util.Date.class, Types.TIMESTAMP );
    jdbcJavaClassMappings.put( Calendar.class, Types.TIMESTAMP );

    return jdbcJavaClassMappings;
}
项目:ProyectoPacientes    文件:JDBC4ResultSet.java   
@SuppressWarnings("unchecked")
public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
    if (type == null) {
        throw SQLError.createSQLException("Type parameter can not be null", SQLError.SQL_STATE_ILLEGAL_ARGUMENT, getExceptionInterceptor());
    }

    if (type.equals(Struct.class)) {
        throw new SQLFeatureNotSupportedException();
    } else if (type.equals(RowId.class)) {
        return (T) getRowId(columnIndex);
    } else if (type.equals(NClob.class)) {
        return (T) getNClob(columnIndex);
    } else if (type.equals(SQLXML.class)) {
        return (T) getSQLXML(columnIndex);
    }

    return super.getObject(columnIndex, type);
}
项目:BibliotecaPS    文件:JDBC4ResultSet.java   
@SuppressWarnings("unchecked")
public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
    if (type == null) {
        throw SQLError.createSQLException("Type parameter can not be null", SQLError.SQL_STATE_ILLEGAL_ARGUMENT, getExceptionInterceptor());
    }

    if (type.equals(Struct.class)) {
        throw new SQLFeatureNotSupportedException();
    } else if (type.equals(RowId.class)) {
        return (T) getRowId(columnIndex);
    } else if (type.equals(NClob.class)) {
        return (T) getNClob(columnIndex);
    } else if (type.equals(SQLXML.class)) {
        return (T) getSQLXML(columnIndex);
    }

    return super.getObject(columnIndex, type);
}
项目:calcite-avatica    文件:AbstractCursor.java   
@Override public Struct getStruct() throws SQLException {
  final Object o = super.getObject();
  if (o == null) {
    return null;
  } else if (o instanceof StructImpl) {
    return (StructImpl) o;
  } else if (o instanceof List) {
    return new StructImpl((List) o);
  } else {
    final List<Object> list = new ArrayList<>();
    for (Accessor fieldAccessor : fieldAccessors) {
      try {
        list.add(fieldAccessor.getObject());
      } catch (SQLException e) {
        throw new RuntimeException(e);
      }
    }
    return new StructImpl(list);
  }
}
项目:NICON    文件:Call.java   
/**
 * Tratar o retorno vido do java
 * @param result
 * @param returnType
 * @return 
 */
@SuppressWarnings("CallToPrintStackTrace")
private static Object treatReturn (Object result, int returnType)
{
    Object currectObject = result;
    try
    {
        if (returnType == ARRAY && result instanceof Array)
        {
            Array r = (Array) result;
            currectObject = new ArrayList<> (Arrays.asList((Object [])r.getArray()));
        }
        else if (Types.STRUCT == returnType)
        {
            System.out.println("dbdkj");
            currectObject = ((Struct) result).getAttributes();
        }
    }catch(Exception ex)
    {
        ex.printStackTrace();
    }
    if(currectObject != null)

        System.out.println("RETURN = class{"+currectObject.getClass().getName()+"} | toString = "+currectObject.toString()+"\n");
    return currectObject;
}
项目:the-vigilantes    文件:JDBC4ConnectionWrapper.java   
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
    checkClosed();

    try {
        return ((java.sql.Connection) this.mc).createStruct(typeName, attributes);
    } catch (SQLException sqlException) {
        checkAndFireConnectionError(sqlException);
    }

    return null; // never reached, but compiler can't tell
}
项目:OpenVertretung    文件:JDBC4ConnectionWrapper.java   
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
    checkClosed();

    try {
        return ((java.sql.Connection) this.mc).createStruct(typeName, attributes);
    } catch (SQLException sqlException) {
        checkAndFireConnectionError(sqlException);
    }

    return null; // never reached, but compiler can't tell
}
项目:lams    文件:JDBC4ConnectionWrapper.java   
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
    checkClosed();

    try {
        return ((java.sql.Connection) this.mc).createStruct(typeName, attributes);
    } catch (SQLException sqlException) {
        checkAndFireConnectionError(sqlException);
    }

    return null; // never reached, but compiler can't tell
}
项目:ProyectoPacientes    文件:JDBC4ConnectionWrapper.java   
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
    checkClosed();

    try {
        return ((java.sql.Connection) this.mc).createStruct(typeName, attributes);
    } catch (SQLException sqlException) {
        checkAndFireConnectionError(sqlException);
    }

    return null; // never reached, but compiler can't tell
}
项目:dswork.jdbc    文件:ConnectionSpy.java   
public Struct createStruct(String typeName, Object[] attributes) throws SQLException
{
    try
    {
        return realConnection.createStruct(typeName, attributes);
    }
    catch(SQLException s)
    {
        String methodCall = "createStruct(" + typeName + ", " + attributes + ")";
        reportException(methodCall, s, null);
        throw s;
    }
}
项目:BibliotecaPS    文件:JDBC4ConnectionWrapper.java   
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
    checkClosed();

    try {
        return ((java.sql.Connection) this.mc).createStruct(typeName, attributes);
    } catch (SQLException sqlException) {
        checkAndFireConnectionError(sqlException);
    }

    return null; // never reached, but compiler can't tell
}
项目:jdk8u-jdk    文件:SQLOutputImplTests.java   
@Test(enabled = true)
public void test08() throws Exception {
    Object[] attributes = new Object[]{"Bruce", "Wayne", 1939,
        "Batman"};
    Struct s = new StubStruct(sqlType, attributes);
    outImpl.writeStruct(s);
    SerialStruct ss = (SerialStruct) results.get(0);
    assertTrue(Arrays.equals(attributes, (Object[]) ss.getAttributes()));
    assertTrue(sqlType.equals(ss.getSQLTypeName()));
}
项目:jdk8u-jdk    文件:SQLInputImplTests.java   
@Test()
public void test11() throws Exception {
    Object[] attributes = new Object[]{"Bruce", "Wayne", 1939,
        "Batman"};
    map.put(sqlType, Class.forName("util.SuperHero"));
    Struct struct = new StubStruct(sqlType, attributes);
    Object[] values = {struct};
    SQLInputImpl sqli = new SQLInputImpl(values, map);
    Object o = sqli.readObject();

    assertTrue(hero.equals(o));

}
项目:openjdk-jdk10    文件:SQLOutputImplTests.java   
@Test(enabled = true)
public void test08() throws Exception {
    Object[] attributes = new Object[]{"Bruce", "Wayne", 1939,
        "Batman"};
    Struct s = new StubStruct(sqlType, attributes);
    outImpl.writeStruct(s);
    SerialStruct ss = (SerialStruct) results.get(0);
    assertTrue(Arrays.equals(attributes, (Object[]) ss.getAttributes()));
    assertTrue(sqlType.equals(ss.getSQLTypeName()));
}
项目:openjdk-jdk10    文件:SQLInputImplTests.java   
@Test()
public void test11() throws Exception {
    Object[] attributes = new Object[]{"Bruce", "Wayne", 1939,
        "Batman"};
    map.put(sqlType, Class.forName("util.SuperHero"));
    Struct struct = new StubStruct(sqlType, attributes);
    Object[] values = {struct};
    SQLInputImpl sqli = new SQLInputImpl(values, map);
    Object o = sqli.readObject();

    assertTrue(hero.equals(o));

}
项目:calcite-avatica    文件:AbstractCursor.java   
@SuppressWarnings("unchecked")
@Override public <T> T getObject(Class<T> clz) throws SQLException {
  // getStruct() is not exposed on Accessor, only AccessorImpl. getObject(Class) is exposed,
  // so we can make it do the right thing (call getStruct()).
  if (clz.equals(Struct.class)) {
    return (T) getStruct();
  }
  return super.getObject(clz);
}
项目:dremio-oss    文件:DremioConnectionImpl.java   
@Override
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
  throwIfClosed();
  try {
    return super.createStruct(typeName, attributes);
  }
  catch (UnsupportedOperationException e) {
    throw new SQLFeatureNotSupportedException(e.getMessage(), e);
  }
}
项目:dswork    文件:ConnectionSpy.java   
public Struct createStruct(String typeName, Object[] attributes) throws SQLException
{
    try
    {
        return realConnection.createStruct(typeName, attributes);
    }
    catch(SQLException s)
    {
        String methodCall = "createStruct(" + typeName + ", " + attributes + ")";
        reportException(methodCall, s, null);
        throw s;
    }
}
项目:spanner-jdbc    文件:AbstractCloudSpannerConnection.java   
@Override
public Struct createStruct(String typeName, Object[] attributes) throws SQLException
{
    return checkClosedAndThrowUnsupportedException();
}
项目:sstore-soft    文件:JDBC4Connection.java   
@Override
public Struct createStruct(String typeName, Object[] attributes) throws SQLException
{
    checkClosed();
    throw SQLError.noSupport();
}
项目:burstcoin    文件:FilteredConnection.java   
@Override
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
    return con.createStruct(typeName, attributes);
}
项目:preflex    文件:ConnectionWrapper.java   
@Override
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
    return conn.createStruct(typeName, attributes);
}
项目:pugtsdb    文件:PugConnection.java   
@Override
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
    return connection.createStruct(typeName, attributes);
}
项目:alfresco-repository    文件:SchemaBootstrap.java   
@Override
public Struct createStruct(String typeName, Object[] attributes) throws SQLException
{
    return wrapped.createStruct(typeName, attributes);
}
项目:mycat-src-1.6.1-RELEASE    文件:SequoiaConnection.java   
@Override
public Struct createStruct(String typeName, Object[] attributes)
        throws SQLException {

    return null;
}
项目:mycat-src-1.6.1-RELEASE    文件:MongoConnection.java   
@Override
public Struct createStruct(String typeName, Object[] attributes)
        throws SQLException {

    return null;
}
项目:tomcat7    文件:Connection.java   
@Override
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
    return null;
}
项目:the-vigilantes    文件:JDBC4FabricMySQLConnectionProxy.java   
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
    transactionBegun();
    return getActiveConnection().createStruct(typeName, attributes);
}
项目:the-vigilantes    文件:JDBC4LoadBalancedMySQLConnection.java   
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
    return this.getJDBC4Connection().createStruct(typeName, attributes);
}
项目:the-vigilantes    文件:JDBC4Connection.java   
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
    throw SQLError.createSQLFeatureNotSupportedException();
}
项目:the-vigilantes    文件:JDBC4MultiHostMySQLConnection.java   
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
    return this.getJDBC4Connection().createStruct(typeName, attributes);
}
项目:the-vigilantes    文件:JDBC4ReplicationMySQLConnection.java   
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
    return this.getJDBC4Connection().createStruct(typeName, attributes);
}
项目:oscm    文件:ConnectionStub.java   
@Override
public Struct createStruct(String typeName, Object[] attributes)
        throws SQLException {

    return null;
}
项目:org.ops4j.pax.transx    文件:ConnectionHandle.java   
@Override
public Struct createStruct(String s, Object[] objects) throws SQLException {
    return call(c -> c.createStruct(s, objects));
}
项目:org.ops4j.pax.transx    文件:ConnectionWrapper.java   
@Override
public Struct createStruct(String s, Object[] objects) throws SQLException {
    return connection.createStruct(s, objects);
}
项目:org.ops4j.pax.transx    文件:StubConnection.java   
/** {@inheritDoc} */
public Struct createStruct(String typeName, Object[] attributes) throws SQLException
{
   return null;
}
项目:s-store    文件:JDBC4Connection.java   
@Override
public Struct createStruct(String typeName, Object[] attributes) throws SQLException
{
    checkClosed();
    throw SQLError.noSupport();
}