All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.scalar.db.sql.common.SqlError Maven / Gradle / Ivy

There is a newer version: 3.14.0
Show newest version
package com.scalar.db.sql.common;

import com.scalar.db.common.error.Category;
import com.scalar.db.common.error.ScalarDbError;

public enum SqlError implements ScalarDbError {
  NAMESPACE_NOT_FOUND(
      Category.USER_ERROR, "0000", "The namespace does not exist. Namespace: %s", "", ""),
  TABLE_NOT_FOUND(Category.USER_ERROR, "0001", "The table does not exist. Table: %s", "", ""),
  COLUMN_NOT_FOUND(Category.USER_ERROR, "0002", "The column %s does not exist", "", ""),
  COLUMN_NOT_FOUND2(
      Category.USER_ERROR, "0003", "The column does not exist. Table: %s; Column: %s", "", ""),
  COLUMN_INDEX_OUT_OF_BOUNDS(
      Category.USER_ERROR,
      "0004",
      "The column index is out of bounds. Index: %d; Size: %d",
      "",
      ""),
  POSITIONAL_BIND_MARKER_NOT_ALLOWED(
      Category.USER_ERROR,
      "0005",
      "A positional bind marker is not allowed when binding named values",
      "",
      ""),
  NAMED_BIND_MARKER_NOT_ALLOWED(
      Category.USER_ERROR,
      "0006",
      "A named bind marker is not allowed when binding positional values",
      "",
      ""),
  CANNOT_CONVERT_BLOB_TO_SQL(
      Category.USER_ERROR,
      "0007",
      "Cannot convert BLOB values to SQL. Please use a bind marker for a BLOB value and bind it separately",
      "",
      ""),
  NAMESPACE_NAME_NOT_SPECIFIED(
      Category.USER_ERROR,
      "0008",
      "No namespace name has been specified. Set a default namespace name, or explicitly specify a namespace name",
      "",
      ""),
  ZERO_BYTES_IN_STRING(
      Category.USER_ERROR, "0009", "Zero bytes may not occur in string parameters", "", ""),
  MIXED_POSITIONAL_AND_NAMED_VALUES(
      Category.USER_ERROR,
      "0010",
      "Mixing positional values and named values is not allowed",
      "",
      ""),
  PREPARE_NOT_SUPPORTED(
      Category.USER_ERROR,
      "0011",
      "Preparing a transaction is supported only in two-phase commit transaction mode",
      "",
      ""),
  VALIDATE_NOT_SUPPORTED(
      Category.USER_ERROR,
      "0012",
      "Validating a transaction is supported only in two-phase commit transaction mode",
      "",
      ""),
  PREVIOUS_TRANSACTION_STILL_IN_PROGRESS(
      Category.USER_ERROR,
      "0013",
      "The previous transaction is still in progress. Commit, roll back, or suspend the previous transaction first",
      "",
      ""),
  SQL_SESSION_ALREADY_CLOSED(
      Category.USER_ERROR, "0014", "This SQL session has already been closed", "", ""),
  TRANSACTION_NOT_BEGUN(Category.USER_ERROR, "0015", "A transaction has not begun", "", ""),
  UNSUPPORTED_TYPE(Category.USER_ERROR, "0016", "The type %s is not supported", "", ""),
  NO_CONNECTION_MODE_IMPLEMENTATIONS(
      Category.USER_ERROR,
      "0017",
      "No connection mode implementations are found. Please add a connection mode implementation to the classpath",
      "",
      ""),
  CONNECTION_MODE_NOT_SPECIFIED_BUT_MULTIPLE_IMPLEMENTATIONS_FOUND(
      Category.USER_ERROR,
      "0018",
      "The connection mode is not specified, but multiple connection mode implementations are found."
          + " Specify one of the following connection modes: %s",
      "",
      ""),
  CONNECTION_MODE_NOT_FOUND(
      Category.USER_ERROR,
      "0019",
      "The connection mode '%s' is not found. Specify one of the following connection modes: %s",
      "",
      ""),
  AUTHORIZATION_ERROR_FOR_NAMESPACE(
      Category.USER_ERROR,
      "0020",
      "Access denied: You need the %s privilege for the namespace %s to execute this operation",
      "",
      ""),
  AUTHORIZATION_ERROR_FOR_TABLE(
      Category.USER_ERROR,
      "0021",
      "Access denied: You need the %s privilege for the table %s to execute this operation",
      "",
      ""),
  AUTHORIZATION_ERROR_GRANT_DENIED_FOR_TABLE(
      Category.USER_ERROR,
      "0022",
      "Access denied: You can't grant the %s privilege because you don't have the same privilege for the table %s",
      "",
      ""),
  AUTHORIZATION_ERROR_GRANT_DENIED_FOR_NAMESPACE(
      Category.USER_ERROR,
      "0023",
      "Access denied: You can't grant the %s privilege because you don't have the same privilege for the namespace %s",
      "",
      ""),
  AUTHORIZATION_ERROR_REVOKE_DENIED_FOR_TABLE(
      Category.USER_ERROR,
      "0024",
      "Access denied: You can't revoke the %s privilege because you don't have the same privilege for the table %s",
      "",
      ""),
  AUTHORIZATION_ERROR_REVOKE_DENIED_FOR_NAMESPACE(
      Category.USER_ERROR,
      "0025",
      "Access denied: You can't revoke the %s privilege because you don't have the same privilege for the namespace %s",
      "",
      ""),
  SQL_SYNTAX_ERROR(Category.USER_ERROR, "0026", "Syntax error. Line %d:%d %s", "", ""),
  MULTIPLE_PRIMARY_KEYS_SPECIFIED(
      Category.USER_ERROR,
      "0027",
      "Syntax error. Multiple PRIMARY KEYs specified (exactly one required)",
      "",
      ""),
  GRANTING_INSERT_WITHOUT_SELECT_NOT_ALLOWED(
      Category.USER_ERROR,
      "0028",
      "Cannot grant the INSERT privilege if the user doesn't have the UPDATE privilege",
      "",
      ""),
  GRANTING_UPDATE_WITHOUT_INSERT_NOT_ALLOWED(
      Category.USER_ERROR,
      "0029",
      "Cannot grant the UPDATE privilege if the user doesn't have the INSERT privilege",
      "",
      ""),
  GRANTING_UPDATE_WITHOUT_SELECT_NOT_ALLOWED(
      Category.USER_ERROR,
      "0030",
      "Cannot grant the UPDATE privilege if the user doesn't have the SELECT privilege",
      "",
      ""),
  GRANTING_DELETE_WITHOUT_SELECT_NOT_ALLOWED(
      Category.USER_ERROR,
      "0031",
      "Cannot grant the DELETE privilege if the user doesn't have the SELECT privilege",
      "",
      ""),
  REVOKING_SELECT_BUT_NOT_UPDATE_NOT_ALLOWED(
      Category.USER_ERROR,
      "0032",
      "Cannot revoke the SELECT privilege if the user has the UPDATE privilege",
      "",
      ""),
  REVOKING_SELECT_BUT_NOT_DELETE_NOT_ALLOWED(
      Category.USER_ERROR,
      "0033",
      "Cannot revoke the SELECT privilege if the user has the DELETE privilege",
      "",
      ""),
  REVOKING_INSERT_BUT_NOT_UPDATE_NOT_ALLOWED(
      Category.USER_ERROR,
      "0034",
      "Cannot revoke the INSERT privilege if the user has the UPDATE privilege",
      "",
      ""),
  REVOKING_UPDATE_BUT_NOT_INSERT_NOT_ALLOWED(
      Category.USER_ERROR,
      "0035",
      "Cannot revoke the UPDATE privilege if the user has the INSERT privilege",
      "",
      ""),
  NON_CLUSTERING_KEY_COLUMN_SPECIFIED_IN_CLUSTERING_ORDER(
      Category.USER_ERROR,
      "0036",
      "A non-clustering-key column is specified in the CLUSTERING ORDER directive. Column: %s",
      "",
      ""),
  CLUSTERING_ORDER_COLUMN_ORDER_MISMATCH(
      Category.USER_ERROR,
      "0037",
      "The order of the columns in the CLUSTERING ORDER directive must match the order for the clustering key (%s must appear before %s)",
      "",
      ""),
  CLUSTERING_ORDER_COLUMN_MISSING(
      Category.USER_ERROR, "0038", "The CLUSTERING ORDER is missing for the column %s", "", ""),
  EMPTY_SQL_SPECIFIED(Category.USER_ERROR, "0039", "Empty SQL is specified", "", ""),
  MULTIPLE_SQLS_NOT_ALLOWED(Category.USER_ERROR, "0040", "Multiple SQLs are not allowed", "", ""),
  AMBIGUOUS_COLUMN_NAME(Category.USER_ERROR, "0041", "The column %s is ambiguous", "", ""),
  COLUMN_NOT_ALLOWED(
      Category.USER_ERROR,
      "0042",
      "The column %s cannot be specified in the %s clause. Only the columns in the table %s can be specified in the %s clause",
      "",
      ""),
  UNBOUND_BIND_MARKER_IN_LIKE_PREDICATE(
      Category.USER_ERROR,
      "0043",
      "An unbound bind marker is still in the escape character of the LIKE predicate for the column %s",
      "",
      ""),
  ESCAPE_CHARACTER_MUST_BE_TEXT(
      Category.USER_ERROR,
      "0044",
      "The escape character must be a TEXT value for the LIKE predicate for the column %s",
      "",
      ""),
  VALUE_OF_PREDICATE_MUST_NOT_BE_NULL_UNLESS_IS_NULL_OR_IS_NOT_NULL(
      Category.USER_ERROR,
      "0045",
      "The value of the predicate must not be null unless the operator is 'IS NULL' or 'IS NOT NULL'. Predicate: %s",
      "",
      ""),
  UNBOUND_BIND_MARKER_IN_LIMIT(
      Category.USER_ERROR, "0046", "An unbound bind marker is still in the LIMIT clause", "", ""),
  LIMIT_MUST_BE_INT(Category.USER_ERROR, "0047", "The LIMIT must be an INT value", "", ""),
  UNMATCHED_COLUMN_NAMES_VALUES(
      Category.USER_ERROR, "0048", "Unmatched column names or values", "", ""),
  DUPLICATE_COLUMN_SPECIFIED(
      Category.USER_ERROR, "0049", "The column %s is specified twice", "", ""),
  ALL_PRIMARY_KEY_COLUMNS_NOT_SPECIFIED(
      Category.USER_ERROR,
      "0050",
      "All primary key columns must be specified in the INSERT or UPSERT statement",
      "",
      ""),
  UNBOUND_BIND_MARKER_IN_COLUMN_VALUE(
      Category.USER_ERROR,
      "0051",
      "An unbound bind marker is still in the value of the column %s",
      "",
      ""),
  UNMATCHED_LITERAL_TYPE_BOOLEAN_SPECIFIED(
      Category.USER_ERROR,
      "0052",
      "Unmatched column type. The type of the column %s should be %s, but a boolean value (BOOLEAN) is specified",
      "",
      ""),
  UNMATCHED_LITERAL_TYPE_DECIMAL_SPECIFIED(
      Category.USER_ERROR,
      "0053",
      "Unmatched column type. The type of the column %s should be %s, but a decimal number (INT or BIGINT) is specified",
      "",
      ""),
  UNMATCHED_LITERAL_TYPE_FLOAT_SPECIFIED(
      Category.USER_ERROR,
      "0054",
      "Unmatched column type. The type of the column %s should be %s, but a floating point number (FLOAT or DOUBLE) is specified",
      "",
      ""),
  UNMATCHED_LITERAL_TYPE_STRING_SPECIFIED(
      Category.USER_ERROR,
      "0055",
      "Unmatched column type. The type of the column %s should be %s, but a string (TEXT) is specified",
      "",
      ""),
  UNMATCHED_VALUE_TYPE_BOOLEAN_SPECIFIED(
      Category.USER_ERROR,
      "0056",
      "Unmatched column type. The type of the column %s should be %s, but a BOOLEAN value is specified",
      "",
      ""),
  UNMATCHED_VALUE_TYPE_INT_SPECIFIED(
      Category.USER_ERROR,
      "0057",
      "Unmatched column type. The type of the column %s should be %s, but an INT value is specified",
      "",
      ""),
  UNMATCHED_VALUE_TYPE_BIGINT_SPECIFIED(
      Category.USER_ERROR,
      "0058",
      "Unmatched column type. The type of the column %s should be %s, but a BIGINT value is specified",
      "",
      ""),
  UNMATCHED_VALUE_TYPE_FLOAT_SPECIFIED(
      Category.USER_ERROR,
      "0059",
      "Unmatched column type. The type of the column %s should be %s, but a FLOAT value is specified",
      "",
      ""),
  UNMATCHED_VALUE_TYPE_DOUBLE_SPECIFIED(
      Category.USER_ERROR,
      "0060",
      "Unmatched column type. The type of the column %s should be %s, but a DOUBLE value is specified",
      "",
      ""),
  UNMATCHED_VALUE_TYPE_TEXT_SPECIFIED(
      Category.USER_ERROR,
      "0061",
      "Unmatched column type. The type of the column %s should be %s, but a TEXT value is specified",
      "",
      ""),
  UNMATCHED_VALUE_TYPE_BLOB_SPECIFIED(
      Category.USER_ERROR,
      "0062",
      "Unmatched column type. The type of the column %s should be %s, but a BLOB value is specified",
      "",
      ""),
  RIGHT_OUTER_JOIN_NOT_FIRST_JOIN(
      Category.USER_ERROR,
      "0063",
      "RIGHT OUTER JOIN can only be specified as the first join",
      "",
      ""),
  JOIN_PREDICATE_NOT_SPECIFIED_PROPERLY(
      Category.USER_ERROR,
      "0064",
      "The JOIN predicate is not specified properly. Predicate: %s",
      "",
      ""),
  UNMATCHED_COLUMN_TYPES_IN_JOIN_PREDICATE(
      Category.USER_ERROR,
      "0065",
      "The data types of the columns in the JOIN predicate do not match. Predicate: %s",
      "",
      ""),
  DUPLICATE_COLUMN_SPECIFIED_IN_JOIN_PREDICATES(
      Category.USER_ERROR,
      "0066",
      "The column %s is specified twice in the JOIN predicates. Predicates: %s",
      "",
      ""),
  PRIMARY_KEY_COLUMNS_OR_INDEX_COLUMN_NOT_SPECIFIED_IN_JOIN_PREDICATES(
      Category.USER_ERROR,
      "0067",
      "Either all primary key columns or an indexed column for the table %s must be specified in the JOIN predicates. Predicates: %s",
      "",
      ""),
  JDBC_CANNOT_ISSUE_MUTATION_SQL_WITH_EXECUTE_QUERY(
      Category.USER_ERROR,
      "0068",
      "Cannot issue mutation DML SQLs such as INSERT, UPDATE or DELETE with executeQuery()",
      "",
      ""),
  JDBC_CANNOT_ISSUE_SELECT_SQL_WITH_EXECUTE_UPDATE(
      Category.USER_ERROR, "0069", "Cannot issue SELECT SQLs with executeUpdate()", "", ""),
  TWO_PHASE_COMMIT_TRANSACTION_MODE_NOT_SUPPORTED(
      Category.USER_ERROR,
      "0070",
      "The TWO_PHASE_COMMIT_TRANSACTION mode is not supported in the current transaction manager",
      "",
      ""),
  ;

  private static final String COMPONENT_NAME = "SQL";

  private final Category category;
  private final String id;
  private final String message;
  private final String cause;
  private final String solution;

  SqlError(Category category, String id, String message, String cause, String solution) {
    validate(COMPONENT_NAME, category, id, message, cause, solution);

    this.category = category;
    this.id = id;
    this.message = message;
    this.cause = cause;
    this.solution = solution;
  }

  @Override
  public String getComponentName() {
    return COMPONENT_NAME;
  }

  @Override
  public Category getCategory() {
    return category;
  }

  @Override
  public String getId() {
    return id;
  }

  @Override
  public String getMessage() {
    return message;
  }

  @Override
  public String getCause() {
    return cause;
  }

  @Override
  public String getSolution() {
    return solution;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy