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

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

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

origin: com.h2database/h2

/**
 * Check if this user has admin rights. An exception is thrown if he does
 * not have them.
 *
 * @throws DbException if this user is not an admin
 */
public void checkAdmin() {
  if (!admin) {
    throw DbException.get(ErrorCode.ADMIN_RIGHTS_REQUIRED);
  }
}
origin: com.h2database/h2

/**
 * INTERNAL
 */
static SQLException getUnsupportedException() {
  return DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1).
      getSQLException();
}
origin: com.h2database/h2

/**
 * Create a database exception for a specific error code.
 *
 * @param errorCode the error code
 * @param p1 the first parameter of the message
 * @return the exception
 */
public static DbException get(int errorCode, String p1) {
  return get(errorCode, new String[] { p1 });
}
origin: com.h2database/h2

@Override
public void checkWritingAllowed() {
  if (readOnly) {
    throw DbException.get(ErrorCode.DATABASE_IS_READ_ONLY);
  }
  if (fileLockMethod == FileLockMethod.SERIALIZED) {
    if (!reconnectChangePending) {
      throw DbException.get(ErrorCode.DATABASE_IS_READ_ONLY);
    }
  }
}
origin: com.h2database/h2

private static JdbcSavepoint convertSavepoint(Savepoint savepoint) {
  if (!(savepoint instanceof JdbcSavepoint)) {
    throw DbException.get(ErrorCode.SAVEPOINT_IS_INVALID_1,
        "" + savepoint);
  }
  return (JdbcSavepoint) savepoint;
}
origin: com.h2database/h2

private void checkCommitRollback() {
  if (commitOrRollbackDisabled && !locks.isEmpty()) {
    throw DbException.get(ErrorCode.COMMIT_ROLLBACK_NOT_ALLOWED);
  }
}
origin: com.h2database/h2

/**
 * Gets a SQL exception meaning this value is invalid.
 *
 * @param param the name of the parameter
 * @param value the value passed
 * @return the IllegalArgumentException object
 */
public static DbException getInvalidValueException(String param,
    Object value) {
  return get(ErrorCode.INVALID_VALUE_2,
      value == null ? "null" : value.toString(), param);
}
origin: com.h2database/h2

private void logWritingError(Exception e) {
  if (writingErrorLogged) {
    return;
  }
  writingErrorLogged = true;
  Exception se = DbException.get(
      ErrorCode.TRACE_FILE_ERROR_2, e, fileName, e.toString());
  // print this error only once
  fileName = null;
  sysOut.println(se);
  se.printStackTrace();
}
origin: com.h2database/h2

private ValueDecimal(BigDecimal value) {
  if (value == null) {
    throw new IllegalArgumentException("null");
  } else if (!value.getClass().equals(BigDecimal.class)) {
    throw DbException.get(ErrorCode.INVALID_CLASS_2,
        BigDecimal.class.getName(), value.getClass().getName());
  }
  this.value = value;
}
origin: com.h2database/h2

private void checkOnValidRow() {
  if (!isOnValidRow()) {
    throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);
  }
}
origin: com.h2database/h2

@Override
public boolean needRebuild() {
  try {
    return dataMap.sizeAsLongMax() == 0;
  } catch (IllegalStateException e) {
    throw DbException.get(ErrorCode.OBJECT_CLOSED, e);
  }
}
origin: com.h2database/h2

@Override
public boolean needRebuild() {
  try {
    return dataMap.sizeAsLongMax() == 0;
  } catch (IllegalStateException e) {
    throw DbException.get(ErrorCode.OBJECT_CLOSED, e);
  }
}
origin: com.h2database/h2

/**
 * Create a syntax error exception.
 *
 * @param sql the SQL statement
 * @param index the position of the error in the SQL statement
 * @return the exception
 */
public static DbException getSyntaxError(String sql, int index) {
  sql = StringUtils.addAsterisk(sql, index);
  return get(ErrorCode.SYNTAX_ERROR_1, sql);
}
origin: com.h2database/h2

@Override
public void createDirectory() {
  if (exists() && isDirectory()) {
    throw DbException.get(ErrorCode.FILE_CREATION_FAILED_1,
        name + " (a file with this name already exists)");
  }
  // TODO directories are not really supported
}
origin: com.h2database/h2

/**
 * Checks that this user has the given rights for this database object.
 *
 * @param table the database object
 * @param rightMask the rights required
 * @throws DbException if this user does not have the required rights
 */
public void checkRight(Table table, int rightMask) {
  if (!hasRight(table, rightMask)) {
    throw DbException.get(ErrorCode.NOT_ENOUGH_RIGHTS_FOR_1, table.getSQL());
  }
}
origin: com.h2database/h2

public void setGranteeName(String granteeName) {
  Database db = session.getDatabase();
  grantee = db.findUser(granteeName);
  if (grantee == null) {
    grantee = db.findRole(granteeName);
    if (grantee == null) {
      throw DbException.get(ErrorCode.USER_OR_ROLE_NOT_FOUND_1, granteeName);
    }
  }
}
origin: com.h2database/h2

private Cursor find(Session session, SearchRow first, boolean bigger,
    SearchRow last) {
  if (SysProperties.CHECK && store == null) {
    throw DbException.get(ErrorCode.OBJECT_CLOSED);
  }
  PageBtree root = getPage(rootPageId);
  PageBtreeCursor cursor = new PageBtreeCursor(session, this, last);
  root.find(cursor, first, bigger);
  return cursor;
}
origin: com.h2database/h2

public DbException getNewDuplicateKeyException() {
  String sql = "PRIMARY KEY ON " + table.getSQL();
  if (mainIndexColumn >= 0 && mainIndexColumn < indexColumns.length) {
    sql +=  "(" + indexColumns[mainIndexColumn].getSQL() + ")";
  }
  DbException e = DbException.get(ErrorCode.DUPLICATE_KEY_1, sql);
  e.setSource(this);
  return e;
}
origin: com.h2database/h2

private boolean nextRow() {
  if (result.isLazy() && stat.isCancelled()) {
    throw DbException.get(ErrorCode.STATEMENT_WAS_CANCELED);
  }
  boolean next = result.next();
  if (!next && !scrollable) {
    result.close();
  }
  return next;
}
origin: com.h2database/h2

@Override
public Expression optimize(Session session) {
  left = left.optimize(session);
  query.setRandomAccessResult(true);
  session.optimizeQueryExpression(query);
  if (query.getColumnCount() != 1) {
    throw DbException.get(ErrorCode.SUBQUERY_IS_NOT_SINGLE_COLUMN);
  }
  // Can not optimize: the data may change
  return this;
}
org.h2.messageDbExceptionget

Javadoc

Create a database exception for a specific error code.

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
  • <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.
  • getInvalidValueException
    Gets a SQL exception meaning this value is invalid.
  • getJdbcSQLException
    Gets the SQL exception object for a specific error code.
  • getInvalidValueException,
  • getJdbcSQLException,
  • getMessage,
  • getSQLException,
  • getSource,
  • getSyntaxError,
  • printStackTrace,
  • setSource,
  • toSQLException

Popular in Java

  • Running tasks concurrently on multiple threads
  • putExtra (Intent)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getResourceAsStream (ClassLoader)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Github Copilot alternatives
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