本文整理汇总了Java中org.hsqldb.types.Type类的典型用法代码示例。如果您正苦于以下问题:Java Type类的具体用法?Java Type怎么用?Java Type使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Type类属于org.hsqldb.types包,在下文中一共展示了Type类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeData
import org.hsqldb.types.Type; //导入依赖的package包/类
public void writeData(Row row, Type[] types) {
if (crypto == null) {
super.writeData(row, types);
} else {
int start = count;
ensureRoom(row.getStorageSize());
writeInt(0);
super.writeData(row, types);
int origLength = count - start - INT_STORE_SIZE;
int newLength = crypto.encode(buffer, start + INT_STORE_SIZE,
origLength, buffer,
start + INT_STORE_SIZE);
writeIntData(newLength, start);
count = start + INT_STORE_SIZE + newLength;
}
}
示例2: getUserDefinedType
import org.hsqldb.types.Type; //导入依赖的package包/类
public Type getUserDefinedType(String name, String schemaName,
boolean raise) {
Schema schema = (Schema) schemaMap.get(schemaName);
if (schema != null) {
SchemaObject object = schema.typeLookup.getObject(name);
if (object != null) {
return (Type) object;
}
}
if (raise) {
throw Error.error(ErrorCode.X_42501, name);
}
return null;
}
示例3: writeFieldType
import org.hsqldb.types.Type; //导入依赖的package包/类
protected void writeFieldType(Type type) {
writeBytes(nextSep);
switch (type.typeCode) {
case Types.SQL_VARCHAR :
nextSep = varSep;
nextSepEnd = varSepEnd;
break;
default :
nextSep = fieldSep;
nextSepEnd = fieldSepEnd;
break;
}
}
示例4: readNumberField
import org.hsqldb.types.Type; //导入依赖的package包/类
protected void readNumberField(Type type) {
readFieldPrefix();
scanner.scanNext();
boolean minus = scanner.getTokenType() == Tokens.MINUS_OP;
if (minus) {
scanner.scanNext();
}
value = scanner.getValue();
if (minus) {
try {
value = scanner.getDataType().negate(value);
} catch (HsqlException e) {}
}
}
示例5: compileCreateSequence
import org.hsqldb.types.Type; //导入依赖的package包/类
StatementSchema compileCreateSequence() {
read();
Boolean ifNotExists = readIfNotExists();
/*
CREATE SEQUENCE <name>
[AS {INTEGER | BIGINT}]
[START WITH <value>]
[INCREMENT BY <value>]
*/
HsqlName name = readNewSchemaObjectName(SchemaObject.SEQUENCE, false);
NumberSequence sequence = new NumberSequence(name, Type.SQL_INTEGER);
readSequenceOptions(sequence, true, false, false);
String sql = getLastPart();
Object[] args = new Object[] {
sequence, ifNotExists
};
HsqlName[] writeLockNames = database.schemaManager.catalogNameArray;
return new StatementSchema(sql, StatementTypes.CREATE_SEQUENCE, args,
null, writeLockNames);
}
示例6: testFirstPeriodContainsSecondPeriodEvenIfEquals
import org.hsqldb.types.Type; //导入依赖的package包/类
/**
* (TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '1999-12-31 01:02:03')
* CONTAINS
* (TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '1999-12-31 01:02:03')
* is true
*/
public void testFirstPeriodContainsSecondPeriodEvenIfEquals() {
Object[] a = {
scanner.newTimestamp("1999-12-01 01:02:03"),
scanner.newTimestamp("1999-12-31 01:02:03")
};
Object[] b = {
scanner.newTimestamp("1999-12-01 01:02:03"),
scanner.newTimestamp("1999-12-31 01:02:03")
};
Type[] ta = {
new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0),
new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0)
};
Type[] tb = {
new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0),
new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0)
};
Assert.assertTrue(DateTimeType.contains(session, a, ta, b, tb, false));
}
示例7: TableDerived
import org.hsqldb.types.Type; //导入依赖的package包/类
public TableDerived(Database database, HsqlName name, int type,
Type[] columnTypes, HashMappedList columnList,
QueryExpression queryExpression) {
this(database, name, type, queryExpression);
this.colTypes = columnTypes;
this.columnList = columnList;
columnCount = columnList.size();
primaryKeyCols = ValuePool.emptyIntArray;
primaryKeyTypes = Type.emptyArray;
primaryKeyColsSequence = ValuePool.emptyIntArray;
colDefaults = new Expression[columnCount];
colNotNull = new boolean[columnCount];
defaultColumnMap = new int[columnCount];
ArrayUtil.fillSequence(defaultColumnMap);
bestIndexForColumn = new int[colTypes.length];
ArrayUtil.fillArray(bestIndexForColumn, -1);
createPrimaryIndex(primaryKeyCols, primaryKeyTypes, null);
}
示例8: createIndexStructure
import org.hsqldb.types.Type; //导入依赖的package包/类
final Index createIndexStructure(HsqlName name, int[] columns, boolean[] descending, boolean[] nullsLast, boolean unique, boolean constraint, boolean forward) {
if (primaryKeyCols == null) {
throw Error.runtimeError(ErrorCode.U_S0500, "createIndex");
}
int s = columns.length;
int[] cols = new int[s];
Type[] types = new Type[s];
for (int j = 0; j < s; j++) {
cols[j] = columns[j];
types[j] = colTypes[cols[j]];
}
long id = database.persistentStoreCollection.getNextId();
Index newIndex = new IndexAVL(name, id, this, cols, descending, nullsLast, types, false, unique, constraint, forward);
return newIndex;
}
示例9: newSingleColumnTable
import org.hsqldb.types.Type; //导入依赖的package包/类
static Table newSingleColumnTable(Database database, HsqlName tableName,
int tableType, HsqlName colName,
Type colType) {
TableDerived table;
table = new TableDerived(database, tableName, tableType);
ColumnSchema column = new ColumnSchema(colName, colType, false, true,
null);
table.addColumn(column);
table.createPrimaryKeyConstraint(table.getName(), new int[]{ 0 },
true);
return table;
}
示例10: getString
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
* a <code>String</code> in the Java programming language.
* <!-- end generic documentation -->
*
* @param columnIndex the first column is 1, the second is 2, ...
* @return the column value; if the value is SQL <code>NULL</code>, the
* value returned is <code>null</code>
* @exception SQLException if a database access error occurs or this method is
* called on a closed result set
*/
public String getString(int columnIndex) throws SQLException {
checkColumn(columnIndex);
Type sourceType = resultMetaData.columnTypes[columnIndex - 1];
if (sourceType.typeCode == Types.SQL_CLOB) {
ClobDataID x = (ClobDataID) getColumnInType(columnIndex,
sourceType);
if (x == null) {
return null;
}
long length = x.length(session);
if (length > Integer.MAX_VALUE) {
JDBCUtil.throwError(Error.error(ErrorCode.X_42561));
}
return x.getSubString(session, 0, (int) length);
}
return (String) getColumnInType(columnIndex, Type.SQL_VARCHAR);
}
示例11: ignoredConstraintWarning
import org.hsqldb.types.Type; //导入依赖的package包/类
static private void ignoredConstraintWarning(Type hsqldbType) {
if (hsqldbType.precision == 0 && hsqldbType.scale == 0) {
return;
}
// TODO: Use logging system!
/*
System.err.println(
"WARNING: Not passing INTERVAL precision setting "
+ "or second precision setting to ODBC client");
*/
}
示例12: getFirstRowMulti
import org.hsqldb.types.Type; //导入依赖的package包/类
/**
* Uses multiple EQUAL expressions
*/
private void getFirstRowMulti() {
boolean convertible = true;
Object[] currentJoinData =
new Object[rangeVar.rangeIndex.getVisibleColumns()];
for (int i = 0; i < rangeVar.multiColumnCount; i++) {
Type valueType =
rangeVar.findFirstExpressions[i].getRightNode()
.getDataType();
Type targetType =
rangeVar.findFirstExpressions[i].getLeftNode()
.getDataType();
Object value =
rangeVar.findFirstExpressions[i].getRightNode().getValue(
session);
if (targetType.compareToTypeRange(value) != 0) {
convertible = false;
break;
}
currentJoinData[i] = targetType.convertToType(session, value,
valueType);
}
it = convertible
? rangeVar.rangeIndex.findFirstRow(session, store,
currentJoinData, rangeVar.multiColumnCount)
: rangeVar.rangeIndex.emptyIterator();
}
示例13: SYSTEM_VERSIONCOLUMNS
import org.hsqldb.types.Type; //导入依赖的package包/类
/**
* Retrieves a <code>Table</code> object describing the accessible
* columns that are automatically updated when any value in a row
* is updated. <p>
*
* Each row is a version column description with the following columns: <p>
*
* <OL>
* <LI><B>SCOPE</B> <code>SMALLINT</code> => is not used
* <LI><B>COLUMN_NAME</B> <code>VARCHAR</code> => column name
* <LI><B>DATA_TYPE</B> <code>SMALLINT</code> =>
* SQL data type from java.sql.Types
* <LI><B>TYPE_NAME</B> <code>SMALLINT</code> =>
* Data source dependent type name
* <LI><B>COLUMN_SIZE</B> <code>INTEGER</code> => precision
* <LI><B>BUFFER_LENGTH</B> <code>INTEGER</code> =>
* length of column value in bytes
* <LI><B>DECIMAL_DIGITS</B> <code>SMALLINT</code> => scale
* <LI><B>PSEUDO_COLUMN</B> <code>SMALLINT</code> =>
* is this a pseudo column like an Oracle <code>ROWID</code>:<BR>
* (as defined in <code>java.sql.DatabaseMetadata</code>)
* <UL>
* <LI><code>versionColumnUnknown</code> - may or may not be
* pseudo column
* <LI><code>versionColumnNotPseudo</code> - is NOT a pseudo column
* <LI><code>versionColumnPseudo</code> - is a pseudo column
* </UL>
* </OL> <p>
*
* <B>Note:</B> Currently, the HSQLDB engine does not support version
* columns, so an empty table is returned. <p>
*
* @return a <code>Table</code> object describing the columns
* that are automatically updated when any value
* in a row is updated
*/
Table SYSTEM_VERSIONCOLUMNS(Session session, PersistentStore store) {
Table t = sysTables[SYSTEM_VERSIONCOLUMNS];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[SYSTEM_VERSIONCOLUMNS]);
// ----------------------------------------------------------------
// required by DatabaseMetaData.getVersionColumns result set
// ----------------------------------------------------------------
addColumn(t, "SCOPE", Type.SQL_INTEGER);
addColumn(t, "COLUMN_NAME", SQL_IDENTIFIER); // not null
addColumn(t, "DATA_TYPE", Type.SQL_SMALLINT); // not null
addColumn(t, "TYPE_NAME", SQL_IDENTIFIER); // not null
addColumn(t, "COLUMN_SIZE", Type.SQL_SMALLINT);
addColumn(t, "BUFFER_LENGTH", Type.SQL_INTEGER);
addColumn(t, "DECIMAL_DIGITS", Type.SQL_SMALLINT);
addColumn(t, "PSEUDO_COLUMN", Type.SQL_SMALLINT); // not null
// -----------------------------------------------------------------
// required by DatabaseMetaData.getVersionColumns filter parameters
// -----------------------------------------------------------------
addColumn(t, "TABLE_CAT", SQL_IDENTIFIER);
addColumn(t, "TABLE_SCHEM", SQL_IDENTIFIER);
addColumn(t, "TABLE_NAME", SQL_IDENTIFIER); // not null
// -----------------------------------------------------------------
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(
sysTableHsqlNames[SYSTEM_VERSIONCOLUMNS].name, false,
SchemaObject.INDEX);
t.createPrimaryKeyConstraint(name, null, false);
return t;
}
return t;
}
示例14: setColumnTypeVars
import org.hsqldb.types.Type; //导入依赖的package包/类
void setColumnTypeVars(int i) {
ColumnSchema column = getColumn(i);
Type dataType = column.getDataType();
if (dataType.isDomainType()) {
hasDomainColumns = true;
}
if (dataType.isLobType()) {
hasLobColumn = true;
}
colTypes[i] = dataType;
colNotNull[i] = column.isPrimaryKey() || !column.isNullable();
defaultColumnMap[i] = i;
if (column.isIdentity()) {
identitySequence = column.getIdentitySequence();
identityColumn = i;
} else if (identityColumn == i) {
identityColumn = -1;
}
colDefaults[i] = column.getDefaultExpression();
colGenerated[i] = column.isGenerated();
resetDefaultsFlag();
}
示例15: resolveTypesPartTwo
import org.hsqldb.types.Type; //导入依赖的package包/类
void resolveTypesPartTwo(Session session) {
resolveGroups();
for (int i = 0; i < unionColumnMap.length; i++) {
Type type = unionColumnTypes[unionColumnMap[i]];
if (type == null) {
throw Error.error(ErrorCode.X_42567);
}
exprColumns[unionColumnMap[i]].setDataType(session, type);
}
for (int i = 0; i < indexStartOrderBy; i++) {
if (exprColumns[i].dataType == null) {
throw Error.error(ErrorCode.X_42567);
}
}
setReferenceableColumns();
setUpdatability();
createResultMetaData();
createTable(session);
if (isUpdatable) {
getMergedSelect();
}
}