Package java.sql

Examples of java.sql.Struct


                    .get("NCL"), rs.getString(10));
                assertEquals("NVarChar did not match for row " + id, fields
                    .get("NVC"), rs.getString(11));
                assertEquals("RowId did not match for row " + id, fields
                    .get("R"), new String(rs.getRowId(12).getBytes()));
                Struct url = (Struct) rs.getObject(13); // TODO: Find a fix for
                                                        // this workaround
                String urlString = (String) url.getAttributes()[0];
                if (url.getSQLTypeName().equals("SYS.HTTPURITYPE")) {
                  urlString = "http://" + urlString;
                } else if (url.getSQLTypeName().equals("SYS.DBURITYPE")) {
                  urlString = "/ORADB" + urlString;
                }
                assertEquals("UriType did not match for row " + id, fields
                    .get("U"), urlString);
                assertEquals("Interval Year to Month did not match for row "
View Full Code Here


        if(readPosition >= attributes.length) {
            throw new SQLException(Messages.getString("sql.35")); //$NON-NLS-1$
        }
        Object o = attributes[readPosition++];
        if (o instanceof Struct) {
            Struct structuredType = (Struct)o;
            String typeName = structuredType.getSQLTypeName();
            Class<?> c = map.get(typeName);
            if(c != null) {
                try {
                    SQLData data = (SQLData)c.newInstance();
                    SQLInputImpl input = new SQLInputImpl(structuredType.getAttributes(), map);
                    data.readSQL(input, typeName);
                    return data;
                } catch (IllegalAccessException e) {
                    throw new SQLException(e.getMessage());
                } catch (InstantiationException e) {
View Full Code Here

        if (readPosition >= attributes.length) {
            throw new SQLException(Messages.getString("sql.35")); //$NON-NLS-1$
        }
        Object o = attributes[readPosition++];
        if (o instanceof Struct) {
            Struct structuredType = (Struct) o;
            String typeName = structuredType.getSQLTypeName();
            Class<?> c = map.get(typeName);
            if (c != null) {
                try {
                    SQLData data = (SQLData) c.newInstance();
                    SQLInputImpl input = new SQLInputImpl(structuredType
                            .getAttributes(), map);
                    data.readSQL(input, typeName);
                    return data;
                } catch (IllegalAccessException e) {
                    throw new SQLException(e);
View Full Code Here

        if (readPosition >= attributes.length) {
            throw new SQLException(Messages.getString("sql.35")); //$NON-NLS-1$
        }
        Object o = attributes[readPosition++];
        if (o instanceof Struct) {
            Struct structuredType = (Struct) o;
            String typeName = structuredType.getSQLTypeName();
            Class<?> c = map.get(typeName);
            if (c != null) {
                try {
                    SQLData data = (SQLData) c.newInstance();
                    SQLInputImpl input = new SQLInputImpl(structuredType
                            .getAttributes(), map);
                    data.readSQL(input, typeName);
                    return data;
                } catch (IllegalAccessException e) {
                    throw new SQLException(e.getMessage());
View Full Code Here

        if (readPosition >= attributes.length) {
            throw new SQLException(Messages.getString("sql.35")); //$NON-NLS-1$
        }
        Object o = attributes[readPosition++];
        if (o instanceof Struct) {
            Struct structuredType = (Struct) o;
            String typeName = structuredType.getSQLTypeName();
            Class<?> c = map.get(typeName);
            if (c != null) {
                try {
                    SQLData data = (SQLData) c.newInstance();
                    SQLInputImpl input = new SQLInputImpl(structuredType
                            .getAttributes(), map);
                    data.readSQL(input, typeName);
                    return data;
                } catch (IllegalAccessException e) {
                    throw new SQLException(e.getMessage());
View Full Code Here

     * @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();
View Full Code Here

    /**
     * @tests {@link javax.sql.rowset.serial.SQLOutputImpl#writeStruct(java.sql.Struct)}
     */
    public void test_writeStructLjava_sql_Struct() throws SQLException {
        Struct struct = new MockStruct(new Object[] {}, "mockStruct1");
        impl.writeStruct(struct);
        assertEquals(1, attr.size());
        assertTrue(attr.get(0) instanceof SerialStruct);
        SerialStruct ss = (SerialStruct) attr.get(0);
        assertEquals(0, ss.getAttributes().length);
View Full Code Here

    }

    @Override
    public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
        FilterChainImpl chain = createChain();
        Struct value = chain.connection_createStruct(this, typeName, attributes);
        recycleFilterChain(chain);
        return value;
    }
View Full Code Here

    }

    @Override
    public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
        FilterChainImpl chain = createChain();
        Struct value = chain.connection_createStruct(this, typeName, attributes);
        recycleFilterChain(chain);
        return value;
    }
View Full Code Here

      lastValueWasNull = true;
      return null;
    }
    lastValueWasNull = false;
    if (obj instanceof Struct) {
      Struct struct = (Struct) obj;
      Class class1 = (Class) map.get(struct.getSQLTypeName());
      if (class1 != null) {
        SQLData sqldata = null;
        try {
          sqldata = (SQLData) class1.newInstance();
        } catch (InstantiationException instantiationexception) {
          throw new SQLException("Unable to instantiate: " + instantiationexception.getMessage());
        } catch (IllegalAccessException illegalaccessexception) {
          throw new SQLException("Unable to instantiate: " + illegalaccessexception.getMessage());
        }
        Object aobj[] = struct.getAttributes(map);
        SQLInputImpl sqlinputimpl = new SQLInputImpl(aobj, map);
        sqldata.readSQL(sqlinputimpl, struct.getSQLTypeName());
        return sqldata;
      }
    }
    return obj;
  }
View Full Code Here

TOP

Related Classes of java.sql.Struct

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.