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

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

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

origin: com.h2database/h2

/**
 * Set the SQL statement of the exception to the given row.
 *
 * @param e the exception
 * @param rowId the row number
 * @param values the values of the row
 * @return the exception
 */
protected DbException setRow(DbException e, int rowId, String values) {
  StringBuilder buff = new StringBuilder();
  if (sqlStatement != null) {
    buff.append(sqlStatement);
  }
  buff.append(" -- ");
  if (rowId > 0) {
    buff.append("row #").append(rowId + 1).append(' ');
  }
  buff.append('(').append(values).append(')');
  return e.addSQL(buff.toString());
}
origin: com.h2database/h2

private DbException getExceptionAlreadyInUse(String reason) {
  DbException e = DbException.get(
      ErrorCode.DATABASE_ALREADY_OPEN_1, reason);
  if (fileName != null) {
    try {
      Properties prop = load();
      String server = prop.getProperty("server");
      if (server != null) {
        String serverId = server + "/" + prop.getProperty("id");
        e = e.addSQL(serverId);
      }
    } catch (DbException e2) {
      // ignore
    }
  }
  return e;
}
origin: com.h2database/h2

/**
 * Parse a statement or a list of statements, and prepare it for execution.
 *
 * @param sql the SQL statement to parse
 * @return the command object
 */
public Command prepareCommand(String sql) {
  try {
    Prepared p = parse(sql);
    boolean hasMore = isToken(";");
    if (!hasMore && currentTokenType != END) {
      throw getSyntaxError();
    }
    p.prepare();
    Command c = new CommandContainer(this, sql, p);
    if (hasMore) {
      String remaining = originalSQL.substring(parseIndex);
      if (remaining.trim().length() != 0) {
        c = new CommandList(this, sql, c, remaining);
      }
    }
    return c;
  } catch (DbException e) {
    throw e.addSQL(originalSQL);
  }
}
origin: com.h2database/h2

private void execute(String sql) {
  try {
    Prepared command = session.prepare(sql);
    if (command.isQuery()) {
      command.query(0);
    } else {
      command.update();
    }
    if (session.getAutoCommit()) {
      session.commit(false);
    }
  } catch (DbException e) {
    throw e.addSQL(sql);
  }
}
origin: com.h2database/h2

/**
 * Parse the statement, but don't prepare it for execution.
 *
 * @param sql the SQL statement to parse
 * @return the prepared object
 */
Prepared parse(String sql) {
  Prepared p;
  try {
    // first, try the fast variant
    p = parse(sql, false);
  } catch (DbException e) {
    if (e.getErrorCode() == ErrorCode.SYNTAX_ERROR_1) {
      // now, get the detailed exception
      p = parse(sql, true);
    } else {
      throw e.addSQL(sql);
    }
  }
  p.setPrepareAlways(recompileAlways);
  p.setParameterList(parameters);
  return p;
}
origin: com.h2database/h2

/**
 * Execute the meta data statement.
 *
 * @param db the database
 * @param systemSession the system session
 * @param listener the database event listener
 */
void execute(Database db, Session systemSession,
    DatabaseEventListener listener) {
  try {
    Prepared command = systemSession.prepare(sql);
    command.setObjectId(id);
    command.update();
  } catch (DbException e) {
    e = e.addSQL(sql);
    SQLException s = e.getSQLException();
    db.getTrace(Trace.DATABASE).error(s, sql);
    if (listener != null) {
      listener.exceptionThrown(s, sql);
      // continue startup in this case
    } else {
      throw e;
    }
  }
}
origin: com.h2database/h2

DbException e = DbException.get(
    ErrorCode.DATABASE_ALREADY_OPEN_1, "Server is running");
throw e.addSQL(server + "/" + id);
origin: com.h2database/h2

e = e.addSQL(sql);
SQLException s = e.getSQLException();
database.exceptionThrown(s, sql);
origin: com.h2database/h2

  viewQuery = compiledQuery;
} catch (DbException e) {
  e.addSQL(getCreateSQL());
  createException = e;
origin: com.h2database/h2

e = e.addSQL(sql);
SQLException s = e.getSQLException();
database.exceptionThrown(s, sql);
origin: com.h2database/h2

  ValueEnum.check(enumerators);
} catch (DbException e) {
  throw e.addSQL(original);
origin: com.eventsourcing/h2

/**
 * Set the SQL statement of the exception to the given row.
 *
 * @param e the exception
 * @param rowId the row number
 * @param values the values of the row
 * @return the exception
 */
protected DbException setRow(DbException e, int rowId, String values) {
  StringBuilder buff = new StringBuilder();
  if (sqlStatement != null) {
    buff.append(sqlStatement);
  }
  buff.append(" -- ");
  if (rowId > 0) {
    buff.append("row #").append(rowId + 1).append(' ');
  }
  buff.append('(').append(values).append(')');
  return e.addSQL(buff.toString());
}
origin: org.wowtools/h2

/**
 * Set the SQL statement of the exception to the given row.
 *
 * @param e the exception
 * @param rowId the row number
 * @param values the values of the row
 * @return the exception
 */
protected DbException setRow(DbException e, int rowId, String values) {
  StringBuilder buff = new StringBuilder();
  if (sqlStatement != null) {
    buff.append(sqlStatement);
  }
  buff.append(" -- ");
  if (rowId > 0) {
    buff.append("row #").append(rowId + 1).append(' ');
  }
  buff.append('(').append(values).append(')');
  return e.addSQL(buff.toString());
}
origin: com.eventsourcing/h2

private DbException getExceptionAlreadyInUse(String reason) {
  DbException e = DbException.get(
      ErrorCode.DATABASE_ALREADY_OPEN_1, reason);
  if (fileName != null) {
    try {
      Properties prop = load();
      String server = prop.getProperty("server");
      if (server != null) {
        String serverId = server + "/" + prop.getProperty("id");
        e = e.addSQL(serverId);
      }
    } catch (DbException e2) {
      // ignore
    }
  }
  return e;
}
origin: org.wowtools/h2

private DbException getExceptionAlreadyInUse(String reason) {
  DbException e = DbException.get(
      ErrorCode.DATABASE_ALREADY_OPEN_1, reason);
  if (fileName != null) {
    try {
      Properties prop = load();
      String server = prop.getProperty("server");
      if (server != null) {
        String serverId = server + "/" + prop.getProperty("id");
        e = e.addSQL(serverId);
      }
    } catch (DbException e2) {
      // ignore
    }
  }
  return e;
}
origin: org.wowtools/h2

private void execute(String sql) {
  try {
    Prepared command = session.prepare(sql);
    if (command.isQuery()) {
      command.query(0);
    } else {
      command.update();
    }
    if (session.getAutoCommit()) {
      session.commit(false);
    }
  } catch (DbException e) {
    throw e.addSQL(sql);
  }
}
origin: com.eventsourcing/h2

private void execute(String sql) {
  try {
    Prepared command = session.prepare(sql);
    if (command.isQuery()) {
      command.query(0);
    } else {
      command.update();
    }
    if (session.getAutoCommit()) {
      session.commit(false);
    }
  } catch (DbException e) {
    throw e.addSQL(sql);
  }
}
origin: org.wowtools/h2

/**
 * Parse the statement, but don't prepare it for execution.
 *
 * @param sql the SQL statement to parse
 * @return the prepared object
 */
Prepared parse(String sql) {
  Prepared p;
  try {
    // first, try the fast variant
    p = parse(sql, false);
  } catch (DbException e) {
    if (e.getErrorCode() == ErrorCode.SYNTAX_ERROR_1) {
      // now, get the detailed exception
      p = parse(sql, true);
    } else {
      throw e.addSQL(sql);
    }
  }
  p.setPrepareAlways(recompileAlways);
  p.setParameterList(parameters);
  return p;
}
origin: org.wowtools/h2

/**
 * Execute the meta data statement.
 *
 * @param db the database
 * @param systemSession the system session
 * @param listener the database event listener
 */
void execute(Database db, Session systemSession,
    DatabaseEventListener listener) {
  try {
    Prepared command = systemSession.prepare(sql);
    command.setObjectId(id);
    command.update();
  } catch (DbException e) {
    e = e.addSQL(sql);
    SQLException s = e.getSQLException();
    db.getTrace(Trace.DATABASE).error(s, sql);
    if (listener != null) {
      listener.exceptionThrown(s, sql);
      // continue startup in this case
    } else {
      throw e;
    }
  }
}
origin: com.eventsourcing/h2

/**
 * Execute the meta data statement.
 *
 * @param db the database
 * @param systemSession the system session
 * @param listener the database event listener
 */
void execute(Database db, Session systemSession,
    DatabaseEventListener listener) {
  try {
    Prepared command = systemSession.prepare(sql);
    command.setObjectId(id);
    command.update();
  } catch (DbException e) {
    e = e.addSQL(sql);
    SQLException s = e.getSQLException();
    db.getTrace(Trace.DATABASE).error(s, sql);
    if (listener != null) {
      listener.exceptionThrown(s, sql);
      // continue startup in this case
    } else {
      throw e;
    }
  }
}
org.h2.messageDbExceptionaddSQL

Javadoc

Set the SQL statement of the given exception. This method may create a new object.

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>
  • 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
  • From CI to AI: The AI layer in your organization
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