@Override public final int compare(DataValueDescriptor other) { // just use some arbitrary criteria like hashCode for ordering if (this == other) { return 0; } return this.hashCode() - other.hashCode(); }
/** * Make a ViewDescriptor out of a SYSFOREIGNKEYS row * * @param row a SYSFOREIGNKEYS row * @param parentTupleDescriptor Null for this kind of descriptor. * @param dd dataDictionary * @exception StandardException thrown on failure */ public TupleDescriptor buildDescriptor( ExecRow row, TupleDescriptor parentTupleDescriptor, DataDictionary dd) throws StandardException { if (SanityManager.DEBUG) { SanityManager.ASSERT( row.nColumns() == SYSFOREIGNKEYS_COLUMN_COUNT, "Wrong number of columns for a SYSKEYS row"); } DataValueDescriptor col; DataDescriptorGenerator ddg; UUID constraintUUID; UUID conglomerateUUID; UUID keyConstraintUUID; String constraintUUIDString; String conglomerateUUIDString; String raRuleString; int raDeleteRule; int raUpdateRule; ddg = dd.getDataDescriptorGenerator(); /* 1st column is CONSTRAINTID (UUID - char(36)) */ col = row.getColumn(SYSFOREIGNKEYS_CONSTRAINTID); constraintUUIDString = col.getString(); constraintUUID = getUUIDFactory().recreateUUID(constraintUUIDString); /* 2nd column is CONGLOMERATEID (UUID - char(36)) */ col = row.getColumn(SYSFOREIGNKEYS_CONGLOMERATEID); conglomerateUUIDString = col.getString(); conglomerateUUID = getUUIDFactory().recreateUUID(conglomerateUUIDString); /* 3rd column is KEYCONSTRAINTID (UUID - char(36)) */ col = row.getColumn(SYSFOREIGNKEYS_KEYCONSTRAINTID); constraintUUIDString = col.getString(); keyConstraintUUID = getUUIDFactory().recreateUUID(constraintUUIDString); /* 4th column is DELETERULE char(1) */ col = row.getColumn(SYSFOREIGNKEYS_DELETERULE); raRuleString = col.getString(); raDeleteRule = getRefActionAsInt(raRuleString); /* 5th column is UPDATERULE char(1) */ col = row.getColumn(SYSFOREIGNKEYS_UPDATERULE); raRuleString = col.getString(); raUpdateRule = getRefActionAsInt(raRuleString); /* now build and return the descriptor */ return new SubKeyConstraintDescriptor( constraintUUID, conglomerateUUID, keyConstraintUUID, raDeleteRule, raUpdateRule); }
void isNotNullCriteriaSatisfied(DataValueDescriptor dvd) throws StandardException { if (!this.columnType.isNullable() && (dvd == null || dvd.isNull())) { throw StandardException.newException( SQLState.LANG_NULL_INTO_NON_NULL, this.exposedColumnName); } }
public TupleDescriptor buildDescriptor(ExecRow row, TupleDescriptor parentDesc, DataDictionary dd) throws StandardException { if (SanityManager.DEBUG) { SanityManager.ASSERT( row.nColumns() == ASYNCEEVENTLISTENERS_COLUMN_COUNT, "Wrong number of columns for a ASYNCEEVENTLISTENERS row"); } DataValueDescriptor col; UUID id; col = row.getColumn(SENDER_ID); String senderId = col.getString(); id = getUUIDFactory().recreateUUID(senderId); col = row.getColumn(LISTENER_CLASS); String className = col.getString(); col = row.getColumn(SERVER_GROUPS); String serverGroups = col.getString(); col = row.getColumn(MANUAL_START); Boolean manualStart = col.getBoolean(); col = row.getColumn(BATCH_CONFLATION); Boolean batchConflation = col.getBoolean(); col = row.getColumn(BATCH_SIZE); Integer batchSize = col.getInt(); col = row.getColumn(BATCH_TIME_INTERVAL); Integer batchTimeInterval = col.getInt(); col = row.getColumn(IS_PERSISTENCE); Boolean isPersistent = col.getBoolean(); col = row.getColumn(DISK_SYNCHRONOUS); Boolean diskSynchronous = col.getBoolean(); col = row.getColumn(DISK_STORE_NAME); String diskStoreName = col.getString(); col = row.getColumn(MAX_QUEUE_MEMORY); Integer maxQueueMemory = col.getInt(); col = row.getColumn(ALERT_THRESHOLD); Integer alertThreshold = col.getInt(); col = row.getColumn(IS_STARTED); Boolean isStarted = col.getBoolean(); col = row.getColumn(INIT_PARAMS); String initParams = col.getString(); return new GfxdAsyncEventListenerDescriptor( dd, id, senderId, className, serverGroups, manualStart, batchConflation, batchSize, batchTimeInterval, isPersistent, diskSynchronous, diskStoreName, maxQueueMemory, alertThreshold, isStarted, initParams); }
/** * Called by UnaryOperatorNode.bindExpression. * * <p>If the operand is a constant then evaluate the function at compile time. Otherwise, if the * operand input type is the same as the output type then discard this node altogether. If the * function is "date" and the input is a timestamp then change this node to a cast. * * @param fromList The FROM list for the query this expression is in, for binding columns. * @param subqueryList The subquery list being built as we find SubqueryNodes * @param aggregateVector The aggregate vector being built as we find AggregateNodes * @return The new top of the expression tree. * @exception StandardException Thrown on error */ public ValueNode bindExpression( FromList fromList, SubqueryList subqueryList, Vector aggregateVector) throws StandardException { boolean isIdentity = false; // Is this function the identity operator? boolean operandIsNumber = false; bindOperand(fromList, subqueryList, aggregateVector); DataTypeDescriptor operandType = operand.getTypeServices(); switch (operandType.getJDBCTypeId()) { case Types.BIGINT: case Types.INTEGER: case Types.SMALLINT: case Types.TINYINT: case Types.DECIMAL: case Types.NUMERIC: case Types.DOUBLE: case Types.FLOAT: if (TIMESTAMP_METHOD_NAME.equals(methodName)) invalidOperandType(); operandIsNumber = true; break; case Types.CHAR: case Types.VARCHAR: break; case Types.DATE: if (TIMESTAMP_METHOD_NAME.equals(methodName)) invalidOperandType(); isIdentity = true; break; case Types.NULL: break; case Types.TIMESTAMP: if (TIMESTAMP_METHOD_NAME.equals(methodName)) isIdentity = true; break; default: invalidOperandType(); } if (operand instanceof ConstantNode) { DataValueFactory dvf = getLanguageConnectionContext().getDataValueFactory(); DataValueDescriptor sourceValue = ((ConstantNode) operand).getValue(); DataValueDescriptor destValue = null; if (sourceValue.isNull()) { destValue = (TIMESTAMP_METHOD_NAME.equals(methodName)) ? dvf.getNullTimestamp((DateTimeDataValue) null) : dvf.getNullDate((DateTimeDataValue) null); } else { destValue = (TIMESTAMP_METHOD_NAME.equals(methodName)) ? dvf.getTimestamp(sourceValue) : dvf.getDate(sourceValue); } return (ValueNode) getNodeFactory() .getNode(C_NodeTypes.USERTYPE_CONSTANT_NODE, destValue, getContextManager()); } if (isIdentity) return operand; return this; } // end of bindUnaryOperator