📄 serialarray.java
字号:
break; case java.sql.Types.DATALINK: for (int i = 0; i < len; i++) { elements[i] = new SerialDatalink((URL)elements[i]); } break; case java.sql.Types.JAVA_OBJECT: for (int i = 0; i < len; i++) { elements[i] = new SerialJavaObject((Object)elements[i]); } default: ; } } /** * Returns a new array that is a copy of this <code>SerialArray</code> * object. * * @return a copy of this <code>SerialArray</code> object as an * <code>Object</code> in the Java programming language * @throws SerialException if an error occurs retrieving a copy of * this <code>SerialArray</code> object */ public Object getArray() throws SerialException { Object dst = new Object[len]; System.arraycopy((Object)elements, 0, dst, 0, len); return dst; } //[if an error occurstype map used??] /** * Returns a new array that is a copy of this <code>SerialArray</code> * object, using the given type map for the custom * mapping of each element when the elements are SQL UDTs. * <P> * This method does custom mapping if the array elements are a UDT * and the given type map has an entry for that UDT. * Custom mapping is recursive, * meaning that if, for instance, an element of an SQL structured type * is an SQL structured type that itself has an element that is an SQL * structured type, each structured type that has a custom mapping will be * mapped according to the given type map. * * @param map a <code>java.util.Map</code> object in which * each entry consists of 1) a <code>String</code> object * giving the fully qualified name of a UDT and 2) the * <code>Class</code> object for the <code>SQLData</code> implementation * that defines how the UDT is to be mapped * @return a copy of this <code>SerialArray</code> object as an * <code>Object</code> in the Java programming language * @throws SerialException if an error occurs */ public Object getArray(Map<String, Class<?>> map) throws SerialException { Object dst[] = new Object[len]; System.arraycopy((Object)elements, 0, dst, 0, len); return dst; } /** * Returns a new array that is a copy of a slice * of this <code>SerialArray</code> object, starting with the * element at the given index and containing the given number * of consecutive elements. * * @param index the index into this <code>SerialArray</code> object * of the first element to be copied; * the index of the first element is <code>0</code> * @param count the number of consecutive elements to be copied, starting * at the given index * @return a copy of the designated elements in this <code>SerialArray</code> * object as an <code>Object</code> in the Java programming language * @throws SerialException if an error occurs */ public Object getArray(long index, int count) throws SerialException { Object dst = new Object[count]; System.arraycopy((Object)elements, (int)index, dst, 0, count); return dst; } /** * Returns a new array that is a copy of a slice * of this <code>SerialArray</code> object, starting with the * element at the given index and containing the given number * of consecutive elements. * <P> * This method does custom mapping if the array elements are a UDT * and the given type map has an entry for that UDT. * Custom mapping is recursive, * meaning that if, for instance, an element of an SQL structured type * is an SQL structured type that itself has an element that is an SQL * structured type, each structured type that has a custom mapping will be * mapped according to the given type map. * * @param index the index into this <code>SerialArray</code> object * of the first element to be copied; the index of the * first element in the array is <code>0</code> * @param count the number of consecutive elements to be copied, starting * at the given index * @param map a <code>java.util.Map</code> object in which * each entry consists of 1) a <code>String</code> object * giving the fully qualified name of a UDT and 2) the * <code>Class</code> object for the <code>SQLData</code> implementation * that defines how the UDT is to be mapped * @return a copy of the designated elements in this <code>SerialArray</code> * object as an <code>Object</code> in the Java programming language * @throws SerialException if an error occurs */ public Object getArray(long index, int count, Map<String,Class<?>> map) throws SerialException { Object dst = new Object[count]; System.arraycopy((Object)elements, (int)index, dst, 0, count); return dst; } /** * Retrieves the SQL type of the elements in this <code>SerialArray</code> * object. The <code>int</code> returned is one of the constants in the class * <code>java.sql.Types</code>. * * @return one of the constants in <code>java.sql.Types</code>, indicating * the SQL type of the elements in this <code>SerialArray</code> object * @throws SerialException if an error occurs */ public int getBaseType() throws SerialException { return baseType; } /** * Retrieves the DBMS-specific type name for the elements in this * <code>SerialArray</code> object. * * @return the SQL type name used by the DBMS for the base type of this * <code>SerialArray</code> object * @throws SerialException if an error occurs */ public String getBaseTypeName() throws SerialException { return baseTypeName; } /** * Retrieves a <code>ResultSet</code> object holding the elements of * the subarray that starts at * index <i>index</i> and contains up to <i>count</i> successive elements. * This method uses the connection's type map to map the elements of * the array if the map contains * an entry for the base type. Otherwise, the standard mapping is used. * * @param index the index into this <code>SerialArray</code> object * of the first element to be copied; the index of the * first element in the array is <code>0</code> * @param count the number of consecutive elements to be copied, starting * at the given index * @return a <code>ResultSet</code> object containing the designated * elements in this <code>SerialArray</code> object, with a * separate row for each element * @throws SerialException, which in turn throws an * <code>UnsupportedOperationException</code>, if this method is called */ public ResultSet getResultSet(long index, int count) throws SerialException { throw new UnsupportedOperationException(); } /** * * Retrieves a <code>ResultSet</code> object that contains all of * the elements of the SQL <code>ARRAY</code> * value represented by this <code>SerialArray</code> object. This method uses * the specified map for type map customizations unless the base type of the * array does not match a user-defined type (UDT) in <i>map</i>, in * which case it uses the * standard mapping. This version of the method <code>getResultSet</code> * uses either the given type map or the standard mapping; it never uses the * type map associated with the connection. * * @param map a <code>java.util.Map</code> object in which * each entry consists of 1) a <code>String</code> object * giving the fully qualified name of a UDT and 2) the * <code>Class</code> object for the <code>SQLData</code> implementation * that defines how the UDT is to be mapped * @return a <code>ResultSet</code> object containing all of the * elements in this <code>SerialArray</code> object, with a * separate row for each element * @throws SerialException, which in turn throws an * <code>UnsupportedOperationException</code>, if this method is called */ public ResultSet getResultSet(Map<String, Class<?>> map) throws SerialException { throw new UnsupportedOperationException(); } /** * Retrieves a <code>ResultSet</code> object that contains all of * the elements in the <code>ARRAY</code> value that this * <code>SerialArray</code> object represents. * If appropriate, the elements of the array are mapped using the connection's * type map; otherwise, the standard mapping is used. * * @return a <code>ResultSet</code> object containing all of the * elements in this <code>SerialArray</code> object, with a * separate row for each element * @throws SerialException if called, which in turn throws an * <code>UnsupportedOperationException</code>, if this method is called */ public ResultSet getResultSet() throws SerialException { throw new UnsupportedOperationException(); } /** * Retrieves a result set holding the elements of the subarray that starts at * Retrieves a <code>ResultSet</code> object that contains a subarray of the * elements in this <code>SerialArray</code> object, starting at * index <i>index</i> and containing up to <i>count</i> successive * elements. This method uses * the specified map for type map customizations unless the base type of the * array does not match a user-defined type (UDT) in <i>map</i>, in * which case it uses the * standard mapping. This version of the method <code>getResultSet</code> uses * either the given type map or the standard mapping; it never uses the type * map associated with the connection. * * @param index the index into this <code>SerialArray</code> object * of the first element to be copied; the index of the * first element in the array is <code>0</code> * @param count the number of consecutive elements to be copied, starting * at the given index * @param map a <code>java.util.Map</code> object in which * each entry consists of 1) a <code>String</code> object * giving the fully qualified name of a UDT and 2) the * <code>Class</code> object for the <code>SQLData</code> implementation * that defines how the UDT is to be mapped * @return a <code>ResultSet</code> object containing the designated * elements in this <code>SerialArray</code> object, with a * separate row for each element * @throws SerialException if called, which in turn throws an * <code>UnsupportedOperationException</code> */ public ResultSet getResultSet(long index, int count, Map<String,Class<?>> map) throws SerialException { throw new UnsupportedOperationException(); } /** * The identifier that assists in the serialization of this <code>SerialArray</code> * object. */ static final long serialVersionUID = -8466174297270688520L;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -