557 rsval = rs.getObject(i);
558 /*
559 * the following block creates equivalent objects
560 * that would have been created if this rs is populated
561 * into a CachedRowSet so that comparison of the column values
562 * from the ResultSet and CachedRowSet are possible
563 */
564 Map<String, Class<?>> map = (crs.getTypeMap() == null)?con.getTypeMap():crs.getTypeMap();
565 if (rsval instanceof Struct) {
566
567 Struct s = (Struct)rsval;
568
569 // look up the class in the map
570 Class<?> c = null;
571 c = map.get(s.getSQLTypeName());
572 if (c != null) {
573 // create new instance of the class
574 SQLData obj = null;
575 try {
576 ReflectUtil.checkPackageAccess(c);
577 obj = (SQLData)c.newInstance();
578 } catch (Exception ex) {
579 throw new SQLException("Unable to Instantiate: ", ex);
580 }
581 // get the attributes from the struct
582 Object attribs[] = s.getAttributes(map);
583 // create the SQLInput "stream"
584 SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
585 // read the values...
586 obj.readSQL(sqlInput, s.getSQLTypeName());
587 rsval = obj;
588 }
589 } else if (rsval instanceof SQLData) {
590 rsval = new SerialStruct((SQLData)rsval, map);
591 } else if (rsval instanceof Blob) {
592 rsval = new SerialBlob((Blob)rsval);
593 } else if (rsval instanceof Clob) {
594 rsval = new SerialClob((Clob)rsval);
595 } else if (rsval instanceof java.sql.Array) {
596 rsval = new SerialArray((java.sql.Array)rsval, map);
597 }
|
557 rsval = rs.getObject(i);
558 /*
559 * the following block creates equivalent objects
560 * that would have been created if this rs is populated
561 * into a CachedRowSet so that comparison of the column values
562 * from the ResultSet and CachedRowSet are possible
563 */
564 Map<String, Class<?>> map = (crs.getTypeMap() == null)?con.getTypeMap():crs.getTypeMap();
565 if (rsval instanceof Struct) {
566
567 Struct s = (Struct)rsval;
568
569 // look up the class in the map
570 Class<?> c = null;
571 c = map.get(s.getSQLTypeName());
572 if (c != null) {
573 // create new instance of the class
574 SQLData obj = null;
575 try {
576 ReflectUtil.checkPackageAccess(c);
577 @SuppressWarnings("deprecation")
578 Object tmp = c.newInstance();
579 obj = (SQLData)tmp;
580 } catch (Exception ex) {
581 throw new SQLException("Unable to Instantiate: ", ex);
582 }
583 // get the attributes from the struct
584 Object attribs[] = s.getAttributes(map);
585 // create the SQLInput "stream"
586 SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
587 // read the values...
588 obj.readSQL(sqlInput, s.getSQLTypeName());
589 rsval = obj;
590 }
591 } else if (rsval instanceof SQLData) {
592 rsval = new SerialStruct((SQLData)rsval, map);
593 } else if (rsval instanceof Blob) {
594 rsval = new SerialBlob((Blob)rsval);
595 } else if (rsval instanceof Clob) {
596 rsval = new SerialClob((Clob)rsval);
597 } else if (rsval instanceof java.sql.Array) {
598 rsval = new SerialArray((java.sql.Array)rsval, map);
599 }
|