/** * Adds a value to a set column. * * <p>This will generate: {@code name = name + {value}}. * * @param name the column name (must be of type set). * @param value the value to add. Using a BindMarker here is not supported. To use a BindMarker * use {@code QueryBuilder#addAll} with a singleton set. * @return the correspond assignment (to use in an update query) */ public static Assignment add(String name, Object value) { if (value instanceof BindMarker) { throw new InvalidQueryException( "Binding a value in add() is not supported, use addAll() and bind a singleton list"); } return addAll(name, Collections.singleton(value)); }
/** * Remove a value from a set column. * * <p>This will generate: {@code name = name - {value}}. * * @param name the column name (must be of type set). * @param value the value to remove. Using a BindMarker here is not supported. To use a BindMarker * use {@code QueryBuilder#removeAll} with a singleton set. * @return the correspond assignment (to use in an update query) */ public static Assignment remove(String name, Object value) { if (value instanceof BindMarker) { throw new InvalidQueryException( "Binding a value in remove() is not supported, use removeAll() and bind a singleton set"); } return removeAll(name, Collections.singleton(value)); }
/** * Discard a value from a list column. * * <p>This will generate: {@code name = name - [value]}. * * @param name the column name (must be of type list). * @param value the value to discard. Using a BindMarker here is not supported. To use a * BindMarker use {@code QueryBuilder#discardAll} with a singleton list. * @return the correspond assignment (to use in an update query) */ public static Assignment discard(String name, Object value) { if (value instanceof BindMarker) { throw new InvalidQueryException( "Binding a value in discard() is not supported, use discardAll() and bind a singleton list"); } return discardAll(name, Collections.singletonList(value)); }
/** * Append a value to a list column. * * <p>This will generate: {@code name = name + [value]}. * * @param name the column name (must be of type list). * @param value the value to append. Using a BindMarker here is not supported. To use a BindMarker * use {@code QueryBuilder#appendAll} with a singleton list. * @return the correspond assignment (to use in an update query) */ public static Assignment append(String name, Object value) { if (value instanceof BindMarker) { throw new InvalidQueryException( "Binding a value in append() is not supported, use appendAll() and bind a singleton list"); } return appendAll(name, Collections.singletonList(value)); }
/** * Prepend a value to a list column. * * <p>This will generate: {@code name = [ value ] + name}. * * @param name the column name (must be of type list). * @param value the value to prepend. Using a BindMarker here is not supported. To use a * BindMarker use {@code QueryBuilder#prependAll} with a singleton list. * @return the correspond assignment (to use in an update query) */ public static Assignment prepend(String name, Object value) { if (value instanceof BindMarker) { throw new InvalidQueryException( "binding a value in prepend() is not supported, use prependAll() and bind a singleton list"); } return prependAll(name, Collections.singletonList(value)); }
@Override public DriverException copy() { return new InvalidQueryException(getAddress(), getMessage(), this); }
@Test(groups = "unit") public void should_create_proper_invalid_query_exception() { InvalidQueryException e = new InvalidQueryException("Bad, really bad"); assertThat(e.getMessage()).isEqualTo("Bad, really bad"); e = (InvalidQueryException) e.copy(); assertThat(e.getMessage()).isEqualTo("Bad, really bad"); }
new BootstrappingException(null, "Bootstrapping"), new UnpreparedException(null, "Unprepared"), new InvalidQueryException("Validation", new Exception()));
@Override public DriverException copy() { return new InvalidQueryException(getMessage(), this); } }
return new UnauthorizedException(host, message); case INVALID: return new InvalidQueryException(host, message); case CONFIG_ERROR: return new InvalidConfigurationInQueryException(host, message);
/** * Remove a value from a set column. * <p/> * This will generate: {@code name = name - {value}}. * * @param name the column name (must be of type set). * @param value the value to remove. Using a BindMarker here is not supported. * To use a BindMarker use {@code QueryBuilder#removeAll} with a singleton set. * @return the correspond assignment (to use in an update query) */ public static Assignment remove(String name, Object value) { if (value instanceof BindMarker) { throw new InvalidQueryException("Binding a value in remove() is not supported, use removeAll() and bind a singleton set"); } return removeAll(name, Collections.singleton(value)); }
/** * Adds a value to a set column. * <p/> * This will generate: {@code name = name + {value}}. * * @param name the column name (must be of type set). * @param value the value to add. Using a BindMarker here is not supported. * To use a BindMarker use {@code QueryBuilder#addAll} with a * singleton set. * @return the correspond assignment (to use in an update query) */ public static Assignment add(String name, Object value) { if (value instanceof BindMarker) { throw new InvalidQueryException("Binding a value in add() is not supported, use addAll() and bind a singleton list"); } return addAll(name, Collections.singleton(value)); }
/** * Discard a value from a list column. * <p/> * This will generate: {@code name = name - [value]}. * * @param name the column name (must be of type list). * @param value the value to discard. Using a BindMarker here is not supported. * To use a BindMarker use {@code QueryBuilder#discardAll} with a singleton list. * @return the correspond assignment (to use in an update query) */ public static Assignment discard(String name, Object value) { if (value instanceof BindMarker) { throw new InvalidQueryException("Binding a value in discard() is not supported, use discardAll() and bind a singleton list"); } return discardAll(name, Collections.singletonList(value)); }
/** * Remove a value from a set column. * <p/> * This will generate: {@code name = name - {value}}. * * @param name the column name (must be of type set). * @param value the value to remove. Using a BindMarker here is not supported. * To use a BindMarker use {@code QueryBuilder#removeAll} with a singleton set. * @return the correspond assignment (to use in an update query) */ public static Assignment remove(String name, Object value) { if (value instanceof BindMarker) { throw new InvalidQueryException("Binding a value in remove() is not supported, use removeAll() and bind a singleton set"); } return removeAll(name, Collections.singleton(value)); }
/** * Remove a value from a set column. * <p/> * This will generate: {@code name = name - {value}}. * * @param name the column name (must be of type set). * @param value the value to remove. Using a BindMarker here is not supported. * To use a BindMarker use {@code QueryBuilder#removeAll} with a singleton set. * @return the correspond assignment (to use in an update query) */ public static Assignment remove(String name, Object value) { if (value instanceof BindMarker) { throw new InvalidQueryException("Binding a value in remove() is not supported, use removeAll() and bind a singleton set"); } return removeAll(name, Collections.singleton(value)); }
if (!cluster.manager.preparedQueries.containsKey( bs.statement.getPreparedId().boundValuesMetadata.id)) { throw new InvalidQueryException( String.format( "Tried to execute unknown prepared query : %s. "
@Override public DriverException copy() { return new InvalidQueryException(getAddress(), getMessage(), this); }
@Override public DriverException copy() { return new InvalidQueryException(getAddress(), getMessage(), this); }
@Override public DriverException copy() { return new InvalidQueryException(getAddress(), getMessage(), this); }
@Test(groups = "unit") public void should_create_proper_invalid_query_exception() { InvalidQueryException e = new InvalidQueryException("Bad, really bad"); assertThat(e.getMessage()).isEqualTo("Bad, really bad"); e = (InvalidQueryException) e.copy(); assertThat(e.getMessage()).isEqualTo("Bad, really bad"); }