本文整理汇总了Java中org.hsqldb.types.Type.collectionBaseType方法的典型用法代码示例。如果您正苦于以下问题:Java Type.collectionBaseType方法的具体用法?Java Type.collectionBaseType怎么用?Java Type.collectionBaseType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hsqldb.types.Type
的用法示例。
在下文中一共展示了Type.collectionBaseType方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeArray
import org.hsqldb.types.Type; //导入方法依赖的package包/类
protected void writeArray(Object[] o, Type type) {
type = type.collectionBaseType();
noSeparators = true;
write(BYTES_ARRAY);
for (int i = 0; i < o.length; i++) {
if (i > 0) {
write(',');
}
writeData(o[i], type);
}
write(']');
noSeparators = false;
}
示例2: writeArray
import org.hsqldb.types.Type; //导入方法依赖的package包/类
protected void writeArray(Object[] o, Type type) {
type = type.collectionBaseType();
noSeparators = true;
write(BYTES_ARRAY);
for (int i = 0; i < o.length; i++) {
if (i > 0) {
write(',');
}
writeData(type, o[i]);
}
write(']');
noSeparators = false;
}
示例3: getArray
import org.hsqldb.types.Type; //导入方法依赖的package包/类
/**
* <!-- start generic documentation -->
*
* Retrieves the value of the designated JDBC <code>ARRAY</code> parameter as an
* {@link java.sql.Array} object in the Java programming language.
*
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* HSQLDB supports this feature. <p>
*
* </div>
* <!-- end release-specific documentation -->
*
* @param parameterIndex the first parameter is 1, the second is 2, and
* so on
* @return the parameter value as an <code>Array</code> object in
* the Java programming language. If the value was SQL <code>NULL</code>, the
* value <code>null</code> is returned.
* @exception SQLException JDBC 4.1[if the parameterIndex is not valid;]
* if a database access error occurs or
* this method is called on a closed <code>CallableStatement</code>
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support
* this method
* @since JDK 1.2 (JDK 1.1.x developers: read the overview for
* JDBCParameterMetaData)
*/
public Array getArray(int parameterIndex) throws SQLException {
checkGetParameterIndex(parameterIndex);
Type type = parameterMetaData.columnTypes[parameterIndex - 1];
if (!type.isArrayType()) {
throw JDBCUtil.sqlException(ErrorCode.X_42561);
}
Object[] data = (Object[]) parameterValues[parameterIndex - 1];
if (data == null) {
return null;
}
return new JDBCArray(data, type.collectionBaseType(), type,
connection);
}
示例4: setArray
import org.hsqldb.types.Type; //导入方法依赖的package包/类
/**
* <!-- start generic documentation -->
* Sets the designated parameter to the given <code>java.sql.Array</code> object.
* The driver converts this to an SQL <code>ARRAY</code> value when it
* sends it to the database.
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* From version 2.0, HSQLDB supports the SQL ARRAY type.
*
* </div>
* <!-- end release-specific documentation -->
*
* @param parameterIndex the first parameter is 1, the second is 2, ...
* @param x an <code>Array</code> object that maps an SQL <code>ARRAY</code> value
* @exception SQLException if a database access error occurs or
* this method is called on a closed <code>PreparedStatement</code>
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
* @since JDK 1.2 (JDK 1.1.x developers: read the overview for
* JDBCParameterMetaData)
*/
public synchronized void setArray(int parameterIndex,
Array x) throws SQLException {
checkParameterIndex(parameterIndex);
Type type = this.parameterMetaData.columnTypes[parameterIndex - 1];
if (!type.isArrayType()) {
throw JDBCUtil.sqlException(ErrorCode.X_42561);
}
if (x == null) {
setParameter(parameterIndex, null);
return;
}
Object[] data = null;
if (x instanceof JDBCArray) {
data = ((JDBCArray) x).getArrayInternal();
} else {
Object object = x.getArray();
if (object instanceof Object[]) {
Type baseType = type.collectionBaseType();
Object[] array = (Object[]) object;
data = new Object[array.length];
for (int i = 0; i < data.length; i++) {
data[i] = baseType.convertJavaToSQL(session, array[i]);
}
} else {
// if foreign data is not Object[]
throw JDBCUtil.notSupported();
}
}
parameterValues[parameterIndex - 1] = data;
parameterSet[parameterIndex - 1] = Boolean.TRUE;
}
示例5: getArray
import org.hsqldb.types.Type; //导入方法依赖的package包/类
/**
* <!-- start generic documentation -->
* Retrieves the value of the designated column in the current row
* of this <code>ResultSet</code> object as an <code>Array</code> object
* in the Java programming language.
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* From version 2.0, HSQLDB supports array types.
*
* </div>
* <!-- end release-specific documentation -->
*
* @param columnIndex the first column is 1, the second is 2, ...
* @return an <code>Array</code> object representing the SQL
* <code>ARRAY</code> value in the specified column
* @exception SQLException if a database access error occurs
* or this method is called on a closed result set
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support
* this method
* @since JDK 1.2 (JDK 1.1.x developers: read the overview for
* JDBCResultSet)
*/
public Array getArray(int columnIndex) throws SQLException {
checkColumn(columnIndex);
Type type = resultMetaData.columnTypes[columnIndex - 1];
Object[] data = (Object[]) getCurrent()[columnIndex - 1];
if (!type.isArrayType()) {
throw JDBCUtil.sqlException(ErrorCode.X_42561);
}
if (trackNull(data)) {
return null;
}
return new JDBCArray(data, type.collectionBaseType(), type,
connection);
}
示例6: setArray
import org.hsqldb.types.Type; //导入方法依赖的package包/类
/**
* <!-- start generic documentation -->
* Sets the designated parameter to the given <code>java.sql.Array</code> object.
* The driver converts this to an SQL <code>ARRAY</code> value when it
* sends it to the database.
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* From version 2.0, HSQLDB supports the SQL ARRAY type.
*
* </div>
* <!-- end release-specific documentation -->
*
* @param parameterIndex the first parameter is 1, the second is 2, ...
* @param x an <code>Array</code> object that maps an SQL <code>ARRAY</code> value
* @exception SQLException if a database access error occurs or
* this method is called on a closed <code>PreparedStatement</code>
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
* @since JDK 1.2 (JDK 1.1.x developers: read the overview for
* JDBCParameterMetaData)
*/
public synchronized void setArray(int parameterIndex,
Array x) throws SQLException {
checkParameterIndex(parameterIndex);
Type type = this.parameterMetaData.columnTypes[parameterIndex - 1];
if (!type.isArrayType()) {
throw JDBCUtil.sqlException(ErrorCode.X_42561);
}
if (x == null) {
setParameter(parameterIndex, null);
return;
}
Object[] data = null;
if (x instanceof JDBCArray) {
data = (Object[]) ((JDBCArray) x).getArrayInternal();
} else {
Object object = x.getArray();
if (object instanceof Object[]) {
Type baseType = type.collectionBaseType();
Object[] array = (Object[]) object;
data = new Object[array.length];
for (int i = 0; i < data.length; i++) {
data[i] = baseType.convertJavaToSQL(session, array[i]);
}
} else {
// if foreign data is not Object[]
throw JDBCUtil.notSupported();
}
}
parameterValues[parameterIndex - 1] = data;
parameterSet[parameterIndex - 1] = Boolean.TRUE;
}
示例7: writeArray
import org.hsqldb.types.Type; //导入方法依赖的package包/类
protected void writeArray(Object[] o, Type type) {
type = type.collectionBaseType();
writeInt(o.length);
for (int i = 0; i < o.length; i++) {
writeData(o[i], type);
}
}
示例8: readArray
import org.hsqldb.types.Type; //导入方法依赖的package包/类
protected Object[] readArray(Type type) {
type = type.collectionBaseType();
int size = readInt();
Object[] data = new Object[size];
for (int i = 0; i < size; i++) {
data[i] = readData(type);
}
return data;
}
示例9: writeArray
import org.hsqldb.types.Type; //导入方法依赖的package包/类
protected void writeArray(Object[] o, Type type) {
type = type.collectionBaseType();
writeInt(o.length);
for (int i = 0; i < o.length; i++) {
writeData(type, o[i]);
}
}
示例10: readArray
import org.hsqldb.types.Type; //导入方法依赖的package包/类
protected Object[] readArray(Type type) throws IOException {
type = type.collectionBaseType();
int size = readInt();
Object[] data = new Object[size];
for (int i = 0; i < size; i++) {
data[i] = readData(type);
}
return data;
}