@Override public Value getValue(Session session) { Value x = left.getValue(session); if (x == ValueNull.INSTANCE) { return x; } boolean result = valueSet.contains(x); if (!result) { boolean setHasNull = valueSet.contains(ValueNull.INSTANCE); if (setHasNull) { return ValueNull.INSTANCE; } } return ValueBoolean.get(result); }
@Override public String getSQL() { return getString(); }
@Override public Expression getNotIfPossible(Session session) { return new Comparison(session, Comparison.EQUAL, this, ValueExpression.get(ValueBoolean.get(false))); }
@Override public Expression getNotIfPossible(Session session) { return new Comparison(session, Comparison.EQUAL, this, ValueExpression.get(ValueBoolean.get(false))); }
@Override public Expression getNotIfPossible(Session session) { return new Comparison(session, Comparison.EQUAL, this, ValueExpression.get(ValueBoolean.get(false))); }
@Override public Value getValue(Session session) { query.setSession(session); LocalResult result = query.query(1); session.addTemporaryResult(result); boolean r = result.getRowCount() > 0; return ValueBoolean.get(r); }
private Value getValueSlow(LocalResult rows, Value l) { // this only returns the correct result if the result has at least one // row, and if l is not null boolean hasNull = false; boolean result = all; while (rows.next()) { boolean value; Value r = rows.currentRow()[0]; if (r == ValueNull.INSTANCE) { value = false; hasNull = true; } else { value = Comparison.compareNotNull(database, l, r, compareType); } if (!value && all) { result = false; break; } else if (value && !all) { result = true; break; } } if (!result && hasNull) { return ValueNull.INSTANCE; } return ValueBoolean.get(result); }
/** * Updates a column in the current or insert row. * * @param columnIndex (1,2,...) * @param x the value * @throws SQLException if the result set is closed or not updatable */ @Override public void updateBoolean(int columnIndex, boolean x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBoolean(" + columnIndex + ", " + x + ");"); } update(columnIndex, ValueBoolean.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
@Override public void createIndexConditions(Session session, TableFilter filter) { TableFilter tf = getTableFilter(); if (filter == tf && column.getType() == Value.BOOLEAN) { IndexCondition cond = IndexCondition.get( Comparison.EQUAL, this, ValueExpression.get( ValueBoolean.get(true))); filter.addIndexCondition(cond); } }
/** * Sets the value of a parameter. * * @param parameterIndex the parameter index (1, 2, ...) * @param x the value * @throws SQLException if this object is closed */ @Override public void setBoolean(int parameterIndex, boolean x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setBoolean(" + parameterIndex + ", " + x + ");"); } setParameter(parameterIndex, ValueBoolean.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
result = compareAt(value, 0, 0, value.length(), patternChars, patternTypes); return ValueBoolean.get(result);
/** * Updates a column in the current or insert row. * * @param columnLabel the column label * @param x the value * @throws SQLException if result set is closed or not updatable */ @Override public void updateBoolean(String columnLabel, boolean x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBoolean(" + quote(columnLabel) + ", " + x + ");"); } update(columnLabel, ValueBoolean.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
boolean value = rs.getBoolean(columnIndex); v = rs.wasNull() ? (Value) ValueNull.INSTANCE : ValueBoolean.get(value); break;
@Override public Value getValue(Session session) { Value l = left.getValue(session); if (l == ValueNull.INSTANCE) { return l; } boolean result = false; boolean hasNull = false; for (Expression e : valueList) { Value r = e.getValue(session); if (r == ValueNull.INSTANCE) { hasNull = true; } else { r = r.convertTo(l.getType()); result = Comparison.compareNotNull(database, l, r, Comparison.EQUAL); if (result) { break; } } } if (!result && hasNull) { return ValueNull.INSTANCE; } return ValueBoolean.get(result); }
return ValueDecimal.get((BigDecimal) x); } else if (x instanceof Boolean) { return ValueBoolean.get(((Boolean) x).booleanValue()); } else if (x instanceof Byte) { return ValueByte.get(((Byte) x).byteValue());