本文整理汇总了Java中org.hsqldb.types.JavaObjectData类的典型用法代码示例。如果您正苦于以下问题:Java JavaObjectData类的具体用法?Java JavaObjectData怎么用?Java JavaObjectData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JavaObjectData类属于org.hsqldb.types包,在下文中一共展示了JavaObjectData类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getObject
import org.hsqldb.types.JavaObjectData; //导入依赖的package包/类
/**
* <!-- start generic documentation -->
*
* Retrieves the value of the designated parameter as an <code>Object</code>
* in the Java programming language. If the value is an SQL <code>NULL</code>,
* the driver returns a Java <code>null</code>.
* <p>
* This method returns a Java object whose type corresponds to the JDBC
* type that was registered for this parameter using the method
* <code>registerOutParameter</code>. By registering the target JDBC
* type as <code>java.sql.Types.OTHER</code>, this method can be used
* to read database-specific abstract data types.
*
* <!-- 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 A <code>java.lang.Object</code> holding the OUT parameter value
* @exception SQLException if a database access error occurs or
* this method is called on a closed <code>CallableStatement</code>
* @see java.sql.Types
* @see #setObject
*/
public synchronized Object getObject(
int parameterIndex) throws SQLException {
checkGetParameterIndex(parameterIndex);
Type sourceType = parameterTypes[parameterIndex - 1];
switch (sourceType.typeCode) {
case Types.SQL_DATE :
return getDate(parameterIndex);
case Types.SQL_TIME :
case Types.SQL_TIME_WITH_TIME_ZONE :
return getTime(parameterIndex);
case Types.SQL_TIMESTAMP :
case Types.SQL_TIMESTAMP_WITH_TIME_ZONE :
return getTimestamp(parameterIndex);
case Types.SQL_BINARY :
case Types.SQL_VARBINARY :
return getBytes(parameterIndex);
case Types.OTHER :
case Types.JAVA_OBJECT : {
Object o = getColumnInType(parameterIndex, sourceType);
if (o == null) {
return null;
}
try {
return ((JavaObjectData) o).getObject();
} catch (HsqlException e) {
throw Util.sqlException(e);
}
}
default :
return getColumnInType(parameterIndex, sourceType);
}
}
示例2: readOther
import org.hsqldb.types.JavaObjectData; //导入依赖的package包/类
protected Object readOther() {
String s = readString();
if (s == null) {
return null;
}
BinaryData data = scanner.convertToBinary(s);
if (data.length(null) == 0) {
return null;
}
return new JavaObjectData(data.getBytes());
}
示例3: writeOther
import org.hsqldb.types.JavaObjectData; //导入依赖的package包/类
protected void writeOther(JavaObjectData o) {
writeByteArray(o.getBytes());
}
示例4: readOther
import org.hsqldb.types.JavaObjectData; //导入依赖的package包/类
protected Object readOther() {
readFieldPrefix();
if (scanner.scanNull()) {
return null;
}
scanner.scanBinaryStringWithQuote();
if (scanner.getTokenType() == Tokens.X_MALFORMED_BINARY_STRING) {
throw Error.error(ErrorCode.X_42587);
}
value = scanner.getValue();
return new JavaObjectData(((BinaryData) value).getBytes());
}
示例5: readOther
import org.hsqldb.types.JavaObjectData; //导入依赖的package包/类
protected Object readOther() {
return new JavaObjectData(readByteArray());
}
示例6: readOther
import org.hsqldb.types.JavaObjectData; //导入依赖的package包/类
protected Object readOther() throws IOException {
String s = readString();
if (s == null) {
return null;
}
BinaryData data = scanner.convertToBinary(s);
if (data.length(null) == 0) {
return null;
}
return new JavaObjectData(data.getBytes());
}
示例7: readOther
import org.hsqldb.types.JavaObjectData; //导入依赖的package包/类
protected Object readOther() throws IOException {
readFieldPrefix();
if (scanner.scanNull()) {
return null;
}
scanner.scanBinaryStringWithQuote();
if (scanner.getTokenType() == Tokens.X_MALFORMED_BINARY_STRING) {
throw Error.error(ErrorCode.X_42587);
}
value = scanner.getValue();
return new JavaObjectData(((BinaryData) value).getBytes());
}
示例8: readOther
import org.hsqldb.types.JavaObjectData; //导入依赖的package包/类
protected Object readOther() throws IOException {
return new JavaObjectData(readByteArray());
}
示例9: fire
import org.hsqldb.types.JavaObjectData; //导入依赖的package包/类
public void fire(int type, String name, String tableName, Object[] oldR,
Object[] newR) {
UcanaccessConnection conn = UcanaccessConnection.getCtxConnection();
if (conn.isFeedbackState())
return;
try {
Table t = conn.getDbIO().getTable(tableName);
if (t == null)
throw new RuntimeException(
Logger.getMessage("TABLE_DOESNT_EXIST") + " :"
+ tableName);
int i = 0;
for (Column cl : t.getColumns()) {
if (cl.isAppendOnly()) {
ColumnImpl verCol = (ColumnImpl)cl.getVersionHistoryColumn();
Date upTime = new Date();
String val = newR[i] == null ? null : newR[i].toString();
if (type == TriggerBase.INSERT_BEFORE_ROW)
newR[verCol.getColumnNumber()] = new JavaObjectData(
new Version[] { new Version(val, upTime) });
else if (type == TriggerBase.UPDATE_BEFORE_ROW
&& (oldR[i] != null || newR[i] != null)) {
if ((oldR[i] == null && newR[i] != null)
|| (oldR[i] != null && newR[i] == null)
|| (!oldR[i].equals(newR[i]))) {
Version[] oldV = (Version[]) ((JavaObjectData)oldR[verCol
.getColumnNumber()]).getObject();
Version[] newV =new Version[oldV.length + 1];
for(int j=0;j<oldV.length;j++){
newV[j+1]=oldV[j];
}
newV[0] = new Version(val, upTime);
newR[verCol.getColumnNumber()] = new JavaObjectData(
newV);
}
}
}
++i;
}
} catch (Exception e) {
throw new TriggerException(e.getMessage());
}
}
示例10: writeOther
import org.hsqldb.types.JavaObjectData; //导入依赖的package包/类
protected void writeOther(JavaObjectData o) {
ensureRoom(o.getBytesLength() * 2 + 2);
write('\'');
StringConverter.writeHexBytes(getBuffer(), count, o.getBytes());
count += o.getBytesLength() * 2;
write('\'');
}
示例11: getObject
import org.hsqldb.types.JavaObjectData; //导入依赖的package包/类
/**
* <!-- start generic documentation -->
* <p>Gets the value of the designated column in the current row
* of this <code>ResultSet</code> object as
* an <code>Object</code> in the Java programming language.
*
* <p>This method will return the value of the given column as a
* Java object. The type of the Java object will be the default
* Java object type corresponding to the column's SQL type,
* following the mapping for built-in types specified in the JDBC
* specification. If the value is an SQL <code>NULL</code>,
* the driver returns a Java <code>null</code>.
*
* <p>This method may also be used to read database-specific
* abstract data types.
*
* In the JDBC 2.0 API, the behavior of method
* <code>getObject</code> is extended to materialize
* data of SQL user-defined types.
* <p>
* If <code>Connection.getTypeMap</code> does not throw a
* <code>SQLFeatureNotSupportedException</code>,
* then when a column contains a structured or distinct value,
* the behavior of this method is as
* if it were a call to: <code>getObject(columnIndex,
* this.getStatement().getConnection().getTypeMap())</code>.
*
* If <code>Connection.getTypeMap</code> does throw a
* <code>SQLFeatureNotSupportedException</code>,
* then structured values are not supported, and distinct values
* are mapped to the default Java class as determined by the
* underlying SQL type of the DISTINCT type.
* <!-- end generic documentation -->
*
* @param columnIndex the first column is 1, the second is 2, ...
* @return a <code>java.lang.Object</code> holding the column value
* @exception SQLException if a database access error occurs or this method is
* called on a closed result set
*/
public Object getObject(int columnIndex) throws SQLException {
checkColumn(columnIndex);
Type sourceType = resultMetaData.columnTypes[columnIndex - 1];
switch (sourceType.typeCode) {
case Types.SQL_DATE :
return getDate(columnIndex);
case Types.SQL_TIME :
case Types.SQL_TIME_WITH_TIME_ZONE :
return getTime(columnIndex);
case Types.SQL_TIMESTAMP :
case Types.SQL_TIMESTAMP_WITH_TIME_ZONE :
return getTimestamp(columnIndex);
case Types.SQL_BINARY :
case Types.SQL_VARBINARY :
return getBytes(columnIndex);
case Types.OTHER :
case Types.JAVA_OBJECT : {
Object o = getColumnInType(columnIndex, sourceType);
if (o == null) {
return null;
}
try {
return ((JavaObjectData) o).getObject();
} catch (HsqlException e) {
throw Util.sqlException(e);
}
}
default :
return getColumnInType(columnIndex, sourceType);
}
}
示例12: writeOther
import org.hsqldb.types.JavaObjectData; //导入依赖的package包/类
protected void writeOther(JavaObjectData o) {
byte[] ba = o.getBytes();
writeByteArray(ba);
}