< prev index next >

src/java.sql.rowset/share/classes/com/sun/rowset/CachedRowSetImpl.java

Print this page




2945         checkCursor();
2946 
2947         setLastValueNull(false);
2948         value = getCurrentRow().getColumnObject(columnIndex);
2949 
2950         // check for SQL NULL
2951         if (value == null) {
2952             setLastValueNull(true);
2953             return null;
2954         }
2955         if (value instanceof Struct) {
2956             Struct s = (Struct)value;
2957             map = getTypeMap();
2958             // look up the class in the map
2959             Class<?> c = map.get(s.getSQLTypeName());
2960             if (c != null) {
2961                 // create new instance of the class
2962                 SQLData obj = null;
2963                 try {
2964                     ReflectUtil.checkPackageAccess(c);
2965                     obj = (SQLData) c.newInstance();


2966                 } catch(Exception ex) {
2967                     throw new SQLException("Unable to Instantiate: ", ex);
2968                 }
2969                 // get the attributes from the struct
2970                 Object attribs[] = s.getAttributes(map);
2971                 // create the SQLInput "stream"
2972                 SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
2973                 // read the values...
2974                 obj.readSQL(sqlInput, s.getSQLTypeName());
2975                 return (Object)obj;
2976             }
2977         }
2978         return value;
2979     }
2980 
2981     /**
2982      * Retrieves the value of the designated column in the current row
2983      * of this <code>CachedRowSetImpl</code> object as an
2984      * <code>Object</code> value.
2985      * <P>


5693         checkCursor();
5694 
5695         setLastValueNull(false);
5696         value = getCurrentRow().getColumnObject(columnIndex);
5697 
5698         // check for SQL NULL
5699         if (value == null) {
5700             setLastValueNull(true);
5701             return null;
5702         }
5703         if (value instanceof Struct) {
5704             Struct s = (Struct)value;
5705 
5706             // look up the class in the map
5707             Class<?> c = map.get(s.getSQLTypeName());
5708             if (c != null) {
5709                 // create new instance of the class
5710                 SQLData obj = null;
5711                 try {
5712                     ReflectUtil.checkPackageAccess(c);
5713                     obj = (SQLData) c.newInstance();


5714                 } catch(Exception ex) {
5715                     throw new SQLException("Unable to Instantiate: ", ex);
5716                 }
5717                 // get the attributes from the struct
5718                 Object attribs[] = s.getAttributes(map);
5719                 // create the SQLInput "stream"
5720                 SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
5721                 // read the values...
5722                 obj.readSQL(sqlInput, s.getSQLTypeName());
5723                 return (Object)obj;
5724             }
5725         }
5726         return value;
5727     }
5728 
5729     /**
5730      * Retrieves the value of the designated column in this
5731      * <code>CachedRowSetImpl</code> object as a <code>Ref</code> object
5732      * in the Java programming language.
5733      *




2945         checkCursor();
2946 
2947         setLastValueNull(false);
2948         value = getCurrentRow().getColumnObject(columnIndex);
2949 
2950         // check for SQL NULL
2951         if (value == null) {
2952             setLastValueNull(true);
2953             return null;
2954         }
2955         if (value instanceof Struct) {
2956             Struct s = (Struct)value;
2957             map = getTypeMap();
2958             // look up the class in the map
2959             Class<?> c = map.get(s.getSQLTypeName());
2960             if (c != null) {
2961                 // create new instance of the class
2962                 SQLData obj = null;
2963                 try {
2964                     ReflectUtil.checkPackageAccess(c);
2965                     @SuppressWarnings("deprecation")
2966                     Object tmp = c.newInstance();
2967                     obj = (SQLData) tmp;
2968                 } catch(Exception ex) {
2969                     throw new SQLException("Unable to Instantiate: ", ex);
2970                 }
2971                 // get the attributes from the struct
2972                 Object attribs[] = s.getAttributes(map);
2973                 // create the SQLInput "stream"
2974                 SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
2975                 // read the values...
2976                 obj.readSQL(sqlInput, s.getSQLTypeName());
2977                 return (Object)obj;
2978             }
2979         }
2980         return value;
2981     }
2982 
2983     /**
2984      * Retrieves the value of the designated column in the current row
2985      * of this <code>CachedRowSetImpl</code> object as an
2986      * <code>Object</code> value.
2987      * <P>


5695         checkCursor();
5696 
5697         setLastValueNull(false);
5698         value = getCurrentRow().getColumnObject(columnIndex);
5699 
5700         // check for SQL NULL
5701         if (value == null) {
5702             setLastValueNull(true);
5703             return null;
5704         }
5705         if (value instanceof Struct) {
5706             Struct s = (Struct)value;
5707 
5708             // look up the class in the map
5709             Class<?> c = map.get(s.getSQLTypeName());
5710             if (c != null) {
5711                 // create new instance of the class
5712                 SQLData obj = null;
5713                 try {
5714                     ReflectUtil.checkPackageAccess(c);
5715                     @SuppressWarnings("deprecation")
5716                     Object tmp = c.newInstance();
5717                     obj = (SQLData) tmp;
5718                 } catch(Exception ex) {
5719                     throw new SQLException("Unable to Instantiate: ", ex);
5720                 }
5721                 // get the attributes from the struct
5722                 Object attribs[] = s.getAttributes(map);
5723                 // create the SQLInput "stream"
5724                 SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
5725                 // read the values...
5726                 obj.readSQL(sqlInput, s.getSQLTypeName());
5727                 return (Object)obj;
5728             }
5729         }
5730         return value;
5731     }
5732 
5733     /**
5734      * Retrieves the value of the designated column in this
5735      * <code>CachedRowSetImpl</code> object as a <code>Ref</code> object
5736      * in the Java programming language.
5737      *


< prev index next >