当前位置: 首页>>代码示例>>Java>>正文


Java SQLInputImpl类代码示例

本文整理汇总了Java中javax.sql.rowset.serial.SQLInputImpl的典型用法代码示例。如果您正苦于以下问题:Java SQLInputImpl类的具体用法?Java SQLInputImpl怎么用?Java SQLInputImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SQLInputImpl类属于javax.sql.rowset.serial包,在下文中一共展示了SQLInputImpl类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testReadObject

import javax.sql.rowset.serial.SQLInputImpl; //导入依赖的package包/类
/**
 * @tests {@link javax.sql.rowset.serial.SQLInputImpl#readObject()}
 */
public void testReadObject() throws SQLException {
    Object[] structAttributes = { "hello", Boolean.TRUE, "abc",
            Integer.valueOf(99) };
    Struct struct = new MockStruct(structAttributes,
            "harmonytests.MockSQLData");
    Struct struct2 = new MockStruct(structAttributes, "not stored name");
    HashMap<String, Class<?>> types = new HashMap<String, Class<?>>();
    types.put("harmonytests.MockSQLData", MockSQLData.class);
    Object[] attributes = new Object[] { struct, struct2, null, "xyz" };
    SQLInputImpl impl = new SQLInputImpl(attributes, types);
    Object obj = impl.readObject();
    assertTrue(obj instanceof MockSQLData);
    MockSQLData sqlData = (MockSQLData) obj;
    assertEquals(structAttributes[0], sqlData.firstAttribute);
    assertEquals(structAttributes[1], sqlData.secondAttribute);
    assertEquals(structAttributes[2], sqlData.thirdAttribute);
    assertEquals(structAttributes[3], sqlData.fourthAttribute);
    Object obj2 = impl.readObject();
    assertEquals(struct2, obj2);
    Object obj3 = impl.readObject();
    assertNull(obj3);
    Object obj4 = impl.readObject();
    assertEquals(attributes[3], obj4);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:28,代码来源:SQLInputImplTest.java

示例2: testWasNull

import javax.sql.rowset.serial.SQLInputImpl; //导入依赖的package包/类
/**
 * @tests {@link javax.sql.rowset.serial.SQLInputImpl#wasNull()}
 * 
 */
public void testWasNull() throws SQLException {
    Object[] attributes = new Object[] { null, "hello" };
    SQLInputImpl impl = new SQLInputImpl(attributes,
            new HashMap<String, Class<?>>());
    assertFalse(impl.wasNull());
    assertEquals(null, impl.readString());
    assertTrue(impl.wasNull());
    assertEquals("hello", impl.readString());
    assertFalse(impl.wasNull());
    try {
        impl.readString();
        fail("should throw SQLException");
    } catch (SQLException e) {
        // expected
    }
    assertFalse(impl.wasNull());
    assertFalse(impl.wasNull());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:23,代码来源:SQLInputImplTest.java

示例3: testWasNull

import javax.sql.rowset.serial.SQLInputImpl; //导入依赖的package包/类
/**
 * @tests {@link javax.sql.rowset.serial.SQLInputImpl#wasNull()}
 */
public void testWasNull() throws SQLException {
    Object[] attributes = new Object[] { null, "hello" };
    SQLInputImpl impl = new SQLInputImpl(attributes,
            new HashMap<String, Class<?>>());
    assertFalse(impl.wasNull());
    assertEquals(null, impl.readString());
    assertTrue(impl.wasNull());
    assertEquals("hello", impl.readString());
    assertFalse(impl.wasNull());
    try {
        impl.readString();
        fail("should throw SQLException");
    } catch (SQLException e) {
        // expected
    }
    assertFalse(impl.wasNull());
    assertFalse(impl.wasNull());
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:22,代码来源:SQLInputImplTest.java

示例4: test03

import javax.sql.rowset.serial.SQLInputImpl; //导入依赖的package包/类
@Test()
public void test03() throws Exception {
    impl.readSQL(new SQLInputImpl(typeValues, map), "misc");
    impl.writeSQL(outImpl);
    assertTrue(Arrays.equals(results.toArray(), typeValues));
    // Null out a field and make sure the arrays do not match
    typeValues[2] = null;
    assertFalse(Arrays.equals(results.toArray(), typeValues));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:SQLOutputImplTests.java

示例5: test03

import javax.sql.rowset.serial.SQLInputImpl; //导入依赖的package包/类
@Test()
public void test03() throws Exception {
    impl.readSQL(new SQLInputImpl(typeValues, map), "misc");
    assertTrue(Arrays.equals(impl.toArray(), typeValues));
    // Null out a field and make sure the arrays do not match
    typeValues[2] = null;
    assertFalse(Arrays.equals(impl.toArray(), typeValues));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:9,代码来源:SQLInputImplTests.java

示例6: test04

import javax.sql.rowset.serial.SQLInputImpl; //导入依赖的package包/类
@Test()
public void test04() throws Exception {
    Object[] values = {"Hello", null, 1};
    SQLInputImpl sqli = new SQLInputImpl(values, map);
    String s = sqli.readString();
    assertFalse(sqli.wasNull());
    s = sqli.readString();
    assertTrue(sqli.wasNull());
    int i = sqli.readInt();
    assertFalse(sqli.wasNull());
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:12,代码来源:SQLInputImplTests.java

示例7: test05

import javax.sql.rowset.serial.SQLInputImpl; //导入依赖的package包/类
@Test()
public void test05() throws Exception {
    Object[] values = {hero};
    SQLInputImpl sqli = new SQLInputImpl(values, map);
    Object o = sqli.readObject();
    assertTrue(hero.equals(o));

}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:9,代码来源:SQLInputImplTests.java

示例8: test06

import javax.sql.rowset.serial.SQLInputImpl; //导入依赖的package包/类
@Test(enabled = true)
public void test06() throws Exception {
    Object[] coffees = new Object[]{"Espresso", "Colombian", "French Roast",
        "Cappuccino"};
    Array a = new StubArray("VARCHAR", coffees);
    Object[] values = {a};
    SQLInputImpl sqli = new SQLInputImpl(values, map);
    Array a2 = sqli.readArray();
    assertTrue(Arrays.equals((Object[]) a2.getArray(), (Object[]) a.getArray()));
    assertTrue(a.getBaseTypeName().equals(a2.getBaseTypeName()));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:12,代码来源:SQLInputImplTests.java

示例9: test07

import javax.sql.rowset.serial.SQLInputImpl; //导入依赖的package包/类
@Test(enabled = true)
public void test07() throws Exception {
    Blob b = new StubBlob();
    Object[] values = {b};
    SQLInputImpl sqli = new SQLInputImpl(values, map);
    Blob b2 = sqli.readBlob();
    assertTrue(Arrays.equals(
            b.getBytes(1, (int) b.length()),
            b2.getBytes(1, (int) b2.length())));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:SQLInputImplTests.java

示例10: test08

import javax.sql.rowset.serial.SQLInputImpl; //导入依赖的package包/类
@Test(enabled = true)
public void test08() throws Exception {
    Clob c = new StubClob();
    Object[] values = {c};
    SQLInputImpl sqli = new SQLInputImpl(values, map);
    Clob c2 = sqli.readClob();
    assertTrue(c.getSubString(1,
            (int) c.length()).equals(c2.getSubString(1, (int) c2.length())));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:SQLInputImplTests.java

示例11: test09

import javax.sql.rowset.serial.SQLInputImpl; //导入依赖的package包/类
@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()));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:SQLInputImplTests.java

示例12: test10

import javax.sql.rowset.serial.SQLInputImpl; //导入依赖的package包/类
@Test(enabled = true)
public void test10() throws Exception {
    URL u = new URL("http://www.oracle.com/");;
    Object[] values = {u};
    SQLInputImpl sqli = new SQLInputImpl(values, map);
    URL u2 = sqli.readURL();
    assertTrue(u2.equals(u));
    assertTrue(u2.sameFile(u));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:SQLInputImplTests.java

示例13: test11

import javax.sql.rowset.serial.SQLInputImpl; //导入依赖的package包/类
@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));

}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:14,代码来源:SQLInputImplTests.java


注:本文中的javax.sql.rowset.serial.SQLInputImpl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。