Tabnine Logo
DbException.getInvalidValueException
Code IndexAdd Tabnine to your IDE (free)

How to use
getInvalidValueException
method
in
org.h2.message.DbException

Best Java code snippets using org.h2.message.DbException.getInvalidValueException (Showing top 20 results out of 315)

origin: com.h2database/h2

private static void checkParamLength(int expected, int got) {
  if (expected != got) {
    throw DbException.getInvalidValueException("paramLen", got);
  }
}
origin: com.h2database/h2

private static void checkHoldability(int resultSetHoldability) {
  // TODO compatibility / correctness: DBPool uses
  // ResultSet.HOLD_CURSORS_OVER_COMMIT
  if (resultSetHoldability != ResultSet.HOLD_CURSORS_OVER_COMMIT
      && resultSetHoldability != ResultSet.CLOSE_CURSORS_AT_COMMIT) {
    throw DbException.getInvalidValueException("resultSetHoldability",
        resultSetHoldability);
  }
}
origin: com.h2database/h2

private static void rangeCheckUnknown(long zeroBasedOffset, long length) {
  if (zeroBasedOffset < 0) {
    throw DbException.getInvalidValueException("offset", zeroBasedOffset + 1);
  }
  if (length < 0) {
    throw DbException.getInvalidValueException("length", length);
  }
}
origin: com.h2database/h2

/**
 * Check the range of the parameters.
 *
 * @param zeroBasedOffset the offset (0 meaning no offset)
 * @param length the length of the target
 * @param dataSize the length of the source
 */
static void rangeCheck(long zeroBasedOffset, long length, long dataSize) {
  if ((zeroBasedOffset | length) < 0 || length > dataSize - zeroBasedOffset) {
    if (zeroBasedOffset < 0 || zeroBasedOffset > dataSize) {
      throw DbException.getInvalidValueException("offset", zeroBasedOffset + 1);
    }
    throw DbException.getInvalidValueException("length", length);
  }
}
origin: com.h2database/h2

/**
 * Set the scale of a BigDecimal value.
 *
 * @param bd the BigDecimal value
 * @param scale the new scale
 * @return the scaled value
 */
public static BigDecimal setScale(BigDecimal bd, int scale) {
  if (scale > BIG_DECIMAL_SCALE_MAX || scale < -BIG_DECIMAL_SCALE_MAX) {
    throw DbException.getInvalidValueException("scale", scale);
  }
  return bd.setScale(scale, BigDecimal.ROUND_HALF_UP);
}
origin: com.h2database/h2

private Object[] get(long index, int count) {
  Object[] array = get();
  if (count < 0 || count > array.length) {
    throw DbException.getInvalidValueException("count (1.."
        + array.length + ")", count);
  }
  if (index < 1 || index > array.length) {
    throw DbException.getInvalidValueException("index (1.."
        + array.length + ")", index);
  }
  int offset = (int) (index - 1);
  return Arrays.copyOfRange(array, offset, offset + count);
}
origin: com.h2database/h2

private void checkIndexBounds(int parameterIndex) {
  checkClosed();
  if (parameterIndex < 1 || parameterIndex > maxOutParameters) {
    throw DbException.getInvalidValueException("parameterIndex", parameterIndex);
  }
}
origin: com.h2database/h2

private void checkColumnIndex(int columnIndex) {
  checkClosed();
  if (columnIndex < 1 || columnIndex > columnCount) {
    throw DbException.getInvalidValueException("columnIndex", columnIndex);
  }
}
origin: com.h2database/h2

private static byte[] getHash(String algorithm, byte[] bytes, int iterations) {
  if (!"SHA256".equalsIgnoreCase(algorithm)) {
    throw DbException.getInvalidValueException("algorithm", algorithm);
  }
  for (int i = 0; i < iterations; i++) {
    bytes = SHA256.getHash(bytes, false);
  }
  return bytes;
}
origin: com.h2database/h2

public void setMaxIdentiferLength(int maxIdentiferLength) {
  this.maxIdentiferLength = Math.max(30, maxIdentiferLength);
  if (maxIdentiferLength != getMaxIdentiferLength()) {
    throw DbException.getInvalidValueException("Illegal value (<30) in SET COLUMN_NAME_RULES",
        "MAX_IDENTIFIER_LENGTH=" + maxIdentiferLength);
  }
}
origin: com.h2database/h2

private void checkColumnIndex(int columnIndex) {
  checkClosed();
  if (columnIndex < 1 || columnIndex > columnCount) {
    throw DbException.getInvalidValueException("columnIndex", columnIndex);
  }
}
origin: com.h2database/h2

private static int getDatePart(String part) {
  Integer p = DATE_PART.get(StringUtils.toUpperEnglish(part));
  if (p == null) {
    throw DbException.getInvalidValueException("date part", part);
  }
  return p.intValue();
}
origin: com.h2database/h2

private int readPositiveInt() {
  int v = readInt();
  if (v < 0) {
    throw DbException.getInvalidValueException("positive integer", v);
  }
  return v;
}
origin: com.h2database/h2

private void checkColumnIndex(int columnIndex) throws SQLException {
  if (columnIndex < 1 || columnIndex > columns.size()) {
    throw DbException.getInvalidValueException(
        "columnIndex", columnIndex).getSQLException();
  }
}
origin: com.h2database/h2

private ParameterInterface getParameter(int param) {
  checkClosed();
  if (param < 1 || param > paramCount) {
    throw DbException.getInvalidValueException("param", param);
  }
  return parameters.get(param - 1);
}
origin: com.h2database/h2

/**
 * Convert the time using the specified calendar.
 *
 * @param x the time
 * @param calendar the calendar
 * @return the time
 */
public static ValueTime convertTime(Time x, Calendar calendar) {
  if (calendar == null) {
    throw DbException.getInvalidValueException("calendar", null);
  }
  Calendar cal = (Calendar) calendar.clone();
  cal.setTimeInMillis(x.getTime());
  long nanos = nanosFromCalendar(cal);
  return ValueTime.fromNanos(nanos);
}
origin: com.h2database/h2

private void setParameter(int parameterIndex, Value value) {
  checkClosed();
  parameterIndex--;
  ArrayList<? extends ParameterInterface> parameters = command.getParameters();
  if (parameterIndex < 0 || parameterIndex >= parameters.size()) {
    throw DbException.getInvalidValueException("parameterIndex",
        parameterIndex + 1);
  }
  ParameterInterface param = parameters.get(parameterIndex);
  // can only delete old temp files if they are not in the batch
  param.setValue(value, batchParameters == null);
}
origin: com.h2database/h2

/**
 * Return an object of this class if possible.
 *
 * @param iface the class
 * @return this
 */
@Override
@SuppressWarnings("unchecked")
public <T> T unwrap(Class<T> iface) throws SQLException {
  try {
    if (isWrapperFor(iface)) {
      return (T) this;
    }
    throw DbException.getInvalidValueException("iface", iface);
  } catch (Exception e) {
    throw logAndConvert(e);
  }
}
origin: com.h2database/h2

private void checkRegistered(int parameterIndex) throws SQLException {
  try {
    checkIndexBounds(parameterIndex);
    if (!outParameters.get(parameterIndex - 1)) {
      throw DbException.getInvalidValueException("parameterIndex", parameterIndex);
    }
  } catch (Exception e) {
    throw logAndConvert(e);
  }
}
origin: com.h2database/h2

private Set parseSetBinaryCollation() {
  Set command = new Set(session, SetTypes.BINARY_COLLATION);
  String name = readAliasIdentifier();
  command.setString(name);
  if (equalsToken(name, CompareMode.UNSIGNED) ||
      equalsToken(name, CompareMode.SIGNED)) {
    return command;
  }
  throw DbException.getInvalidValueException("BINARY_COLLATION", name);
}
org.h2.messageDbExceptiongetInvalidValueException

Javadoc

Gets a SQL exception meaning this value is invalid.

Popular methods of DbException

  • getUnsupportedException
    Gets a SQL exception meaning this feature is not supported.
  • throwInternalError
    Throw an internal error. This method seems to return an exception object, so that it can be used ins
  • convert
    Convert a throwable to an SQL exception using the default mapping. All errors except the following a
  • get
    Create a database exception for a specific error code.
  • <init>
  • addSQL
    Set the SQL statement of the given exception. This method may create a new object.
  • convertIOException
    Convert an IO exception to a database exception.
  • convertInvocation
    Convert an InvocationTarget exception to a database exception.
  • convertToIOException
    Convert an exception to an IO exception.
  • getCause
  • getErrorCode
    Get the error code.
  • getJdbcSQLException
    Gets the SQL exception object for a specific error code.
  • getErrorCode,
  • getJdbcSQLException,
  • getMessage,
  • getSQLException,
  • getSource,
  • getSyntaxError,
  • printStackTrace,
  • setSource,
  • toSQLException

Popular in Java

  • Making http post requests using okhttp
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • runOnUiThread (Activity)
  • requestLocationUpdates (LocationManager)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now