类java.sql.Ref源码实例Demo

下面列出了怎么用java.sql.Ref的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: dragonwell8_jdk   文件: SQLInputImplTests.java
@Test(enabled = true)
public void test09() throws Exception {
    Ref ref = new StubRef(sqlType, hero);
    Object[] values = {ref};
    SQLInputImpl sqli = new SQLInputImpl(values, map);
    Ref ref2 = sqli.readRef();
    assertTrue(ref.getObject().equals(ref2.getObject()));
    assertTrue(ref.getBaseTypeName().equals(ref2.getBaseTypeName()));
}
 
@Override
public Ref getRef(final String parameterName) throws SQLException {
    checkOpen();
    try {
        return getDelegateCallableStatement().getRef(parameterName);
    } catch (final SQLException e) {
        handleException(e);
        return null;
    }
}
 
源代码3 项目: Tomcat8-Source-Read   文件: DelegatingResultSet.java
@Override
public Ref getRef(final int i) throws SQLException {
    try {
        return resultSet.getRef(i);
    } catch (final SQLException e) {
        handleException(e);
        return null;
    }
}
 
源代码4 项目: Tomcat8-Source-Read   文件: DelegatingResultSet.java
@Override
public Ref getRef(final String colName) throws SQLException {
    try {
        return resultSet.getRef(colName);
    } catch (final SQLException e) {
        handleException(e);
        return null;
    }
}
 
源代码5 项目: Tomcat8-Source-Read   文件: DelegatingResultSet.java
@Override
public void updateRef(final int columnIndex, final Ref x) throws SQLException {
    try {
        resultSet.updateRef(columnIndex, x);
    } catch (final SQLException e) {
        handleException(e);
    }
}
 
源代码6 项目: Tomcat8-Source-Read   文件: DelegatingResultSet.java
@Override
public void updateRef(final String columnName, final Ref x) throws SQLException {
    try {
        resultSet.updateRef(columnName, x);
    } catch (final SQLException e) {
        handleException(e);
    }
}
 
源代码7 项目: TencentKona-8   文件: SQLOutputImplTests.java
@Test(enabled = true)
public void test07() throws Exception {
    Ref ref = new StubRef(sqlType, hero);
    outImpl.writeRef(ref);
    SerialRef sr = (SerialRef) results.get(0);
    assertTrue(hero.equals(sr.getObject()));
}
 
源代码8 项目: TencentKona-8   文件: CommonCachedRowSetTests.java
protected void createDataTypesRows(RowSet crs) throws SQLException {

        Integer aInteger = 100;
        String aChar = "Oswald Cobblepot";
        Long aLong = Long.MAX_VALUE;
        Short aShort = Short.MAX_VALUE;
        Double aDouble = Double.MAX_VALUE;
        BigDecimal aBigDecimal = BigDecimal.ONE;
        Boolean aBoolean = false;
        Float aFloat = Float.MAX_VALUE;
        Byte aByte = Byte.MAX_VALUE;
        Date aDate = Date.valueOf(LocalDate.now());
        Time aTime = Time.valueOf(LocalTime.now());
        Timestamp aTimeStamp = Timestamp.valueOf(LocalDateTime.now());
        Array aArray = new StubArray("INTEGER", new Object[1]);
        Ref aRef = new SerialRef(new StubRef("INTEGER", query));
        byte[] bytes = new byte[10];
        crs.moveToInsertRow();
        crs.updateInt(1, aInteger);
        crs.updateString(2, aChar);
        crs.updateString(3, aChar);
        crs.updateLong(4, aLong);
        crs.updateBoolean(5, aBoolean);
        crs.updateShort(6, aShort);
        crs.updateDouble(7, aDouble);
        crs.updateBigDecimal(8, aBigDecimal);
        crs.updateFloat(9, aFloat);
        crs.updateByte(10, aByte);
        crs.updateDate(11, aDate);
        crs.updateTime(12, aTime);
        crs.updateTimestamp(13, aTimeStamp);
        crs.updateBytes(14, bytes);
        crs.updateArray(15, aArray);
        crs.updateRef(16, aRef);
        crs.updateDouble(17, aDouble);
        crs.insertRow();
        crs.moveToCurrentRow();

    }
 
源代码9 项目: dragonwell8_jdk   文件: CommonCachedRowSetTests.java
protected void createDataTypesRows(RowSet crs) throws SQLException {

        Integer aInteger = 100;
        String aChar = "Oswald Cobblepot";
        Long aLong = Long.MAX_VALUE;
        Short aShort = Short.MAX_VALUE;
        Double aDouble = Double.MAX_VALUE;
        BigDecimal aBigDecimal = BigDecimal.ONE;
        Boolean aBoolean = false;
        Float aFloat = Float.MAX_VALUE;
        Byte aByte = Byte.MAX_VALUE;
        Date aDate = Date.valueOf(LocalDate.now());
        Time aTime = Time.valueOf(LocalTime.now());
        Timestamp aTimeStamp = Timestamp.valueOf(LocalDateTime.now());
        Array aArray = new StubArray("INTEGER", new Object[1]);
        Ref aRef = new SerialRef(new StubRef("INTEGER", query));
        byte[] bytes = new byte[10];
        crs.moveToInsertRow();
        crs.updateInt(1, aInteger);
        crs.updateString(2, aChar);
        crs.updateString(3, aChar);
        crs.updateLong(4, aLong);
        crs.updateBoolean(5, aBoolean);
        crs.updateShort(6, aShort);
        crs.updateDouble(7, aDouble);
        crs.updateBigDecimal(8, aBigDecimal);
        crs.updateFloat(9, aFloat);
        crs.updateByte(10, aByte);
        crs.updateDate(11, aDate);
        crs.updateTime(12, aTime);
        crs.updateTimestamp(13, aTimeStamp);
        crs.updateBytes(14, bytes);
        crs.updateArray(15, aArray);
        crs.updateRef(16, aRef);
        crs.updateDouble(17, aDouble);
        crs.insertRow();
        crs.moveToCurrentRow();

    }
 
源代码10 项目: dragonwell8_jdk   文件: SQLOutputImplTests.java
@Test(enabled = true)
public void test07() throws Exception {
    Ref ref = new StubRef(sqlType, hero);
    outImpl.writeRef(ref);
    SerialRef sr = (SerialRef) results.get(0);
    assertTrue(hero.equals(sr.getObject()));
}
 
源代码11 项目: dragonwell8_jdk   文件: StubCachedRowSetImpl.java
@Override
public void updateRef(int columnIndex, Ref x) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
源代码12 项目: Tomcat8-Source-Read   文件: Jdbc41Bridge.java
/**
 * Delegates to {@link ResultSet#getObject(int, Class)} without throwing a {@link AbstractMethodError}.
 * <p>
 * If the JDBC driver does not implement {@link ResultSet#getObject(int, Class)}, then return 0.
 * </p>
 *
 * @param <T>
 *            See {@link ResultSet#getObject(int, Class)}
 * @param resultSet
 *            See {@link ResultSet#getObject(int, Class)}
 * @param columnIndex
 *            See {@link ResultSet#getObject(int, Class)}
 * @param type
 *            See {@link ResultSet#getObject(int, Class)}
 * @return See {@link ResultSet#getObject(int, Class)}
 * @throws SQLException
 *             See {@link ResultSet#getObject(int, Class)}
 * @see ResultSet#getObject(int, Class)
 */
@SuppressWarnings("unchecked")
public static <T> T getObject(final ResultSet resultSet, final int columnIndex, final Class<T> type)
        throws SQLException {
    try {
        return resultSet.getObject(columnIndex, type);
    } catch (final AbstractMethodError e) {
        if (type == String.class) {
            return (T) resultSet.getString(columnIndex);
        }
        // Numbers
        if (type == Integer.class) {
            return (T) Integer.valueOf(resultSet.getInt(columnIndex));
        }
        if (type == Long.class) {
            return (T) Long.valueOf(resultSet.getLong(columnIndex));
        }
        if (type == Double.class) {
            return (T) Double.valueOf(resultSet.getDouble(columnIndex));
        }
        if (type == Float.class) {
            return (T) Float.valueOf(resultSet.getFloat(columnIndex));
        }
        if (type == Short.class) {
            return (T) Short.valueOf(resultSet.getShort(columnIndex));
        }
        if (type == BigDecimal.class) {
            return (T) resultSet.getBigDecimal(columnIndex);
        }
        if (type == Byte.class) {
            return (T) Byte.valueOf(resultSet.getByte(columnIndex));
        }
        // Dates
        if (type == Date.class) {
            return (T) resultSet.getDate(columnIndex);
        }
        if (type == Time.class) {
            return (T) resultSet.getTime(columnIndex);
        }
        if (type == Timestamp.class) {
            return (T) resultSet.getTimestamp(columnIndex);
        }
        // Streams
        if (type == InputStream.class) {
            return (T) resultSet.getBinaryStream(columnIndex);
        }
        if (type == Reader.class) {
            return (T) resultSet.getCharacterStream(columnIndex);
        }
        // Other
        if (type == Object.class) {
            return (T) resultSet.getObject(columnIndex);
        }
        if (type == Boolean.class) {
            return (T) Boolean.valueOf(resultSet.getBoolean(columnIndex));
        }
        if (type == Array.class) {
            return (T) resultSet.getArray(columnIndex);
        }
        if (type == Blob.class) {
            return (T) resultSet.getBlob(columnIndex);
        }
        if (type == Clob.class) {
            return (T) resultSet.getClob(columnIndex);
        }
        if (type == Ref.class) {
            return (T) resultSet.getRef(columnIndex);
        }
        if (type == RowId.class) {
            return (T) resultSet.getRowId(columnIndex);
        }
        if (type == SQLXML.class) {
            return (T) resultSet.getSQLXML(columnIndex);
        }
        if (type == URL.class) {
            return (T) resultSet.getURL(columnIndex);
        }
        throw new SQLFeatureNotSupportedException(
                String.format("resultSet=%s, columnIndex=%,d, type=%s", resultSet, Integer.valueOf(columnIndex), type));
    }
}
 
源代码13 项目: TencentKona-8   文件: StubJoinRowSetImpl.java
@Override
public void updateRef(int columnIndex, Ref x) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
源代码14 项目: TencentKona-8   文件: StubCachedRowSetImpl.java
@Override
public Ref getRef(String columnLabel) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
源代码15 项目: Tomcat8-Source-Read   文件: Statement.java
@Override
public Ref getRef(String parameterName) throws SQLException {
    // TODO Auto-generated method stub
    return null;
}
 
源代码16 项目: Tomcat8-Source-Read   文件: Statement.java
@Override
public void setRef(int parameterIndex, Ref x) throws SQLException {
    // TODO Auto-generated method stub

}
 
源代码17 项目: TencentKona-8   文件: StubBaseRowSet.java
@Override
public Ref getRef(int columnIndex) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
源代码18 项目: Tomcat8-Source-Read   文件: ResultSet.java
@Override
public Ref getRef(String columnLabel) throws SQLException {
    // TODO Auto-generated method stub
    return null;
}
 
源代码19 项目: dragonwell8_jdk   文件: StubCachedRowSetImpl.java
@Override
public void updateRef(String columnLabel, Ref x) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
源代码20 项目: Tomcat8-Source-Read   文件: ResultSet.java
@Override
public void updateRef(String columnLabel, Ref x) throws SQLException {
    // TODO Auto-generated method stub

}
 
源代码21 项目: micro-integrator   文件: TResultSet.java
public Ref getRef(int columnIndex) throws SQLException {
    determineResultSetState();
    throw new SQLFeatureNotSupportedException("Data type is not supported");
}
 
源代码22 项目: TencentKona-8   文件: StubWebRowSetImpl.java
@Override
public Ref getRef(int columnIndex) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
源代码23 项目: dragonwell8_jdk   文件: StubJdbcRowSetImpl.java
@Override
public Ref getRef(int columnIndex) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
源代码24 项目: dragonwell8_jdk   文件: StubCachedRowSetImpl.java
@Override
public void setRef(int i, Ref x) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
源代码25 项目: TencentKona-8   文件: StubSyncResolver.java
@Override
public Ref getRef(String columnLabel) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
源代码26 项目: TencentKona-8   文件: StubCachedRowSetImpl.java
@Override
public Ref getRef(int columnIndex) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
源代码27 项目: dragonwell8_jdk   文件: StubFilteredRowSetImpl.java
@Override
public void setRef(int i, Ref x) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
@Override
public final void updateRef(final int columnIndex, final Ref x) throws SQLException {
    throw new SQLFeatureNotSupportedException("updateXXX");
}
 
源代码29 项目: TencentKona-8   文件: StubCachedRowSetImpl.java
@Override
public void updateRef(int columnIndex, Ref x) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
@Override
public final void setRef(final int parameterIndex, final Ref x) throws SQLException {
    throw new SQLFeatureNotSupportedException("setRef");
}