Package java.sql

Examples of java.sql.SQLException$InternalIterator


      if (retVal == 1) {
        // assign the key returned by the database to the object's id field after it was inserted
        Number key = keyHolder.getKey();
        if (key == null) {
          // may never happen but let's be careful out there
          throw new SQLException("generated-id key was not set by the update call");
        }
        if (key.longValue() == 0L) {
          // sanity check because the generated-key returned is 0 by default, may never happen
          throw new SQLException("generated-id key must not be 0 value");
        }
        assignIdValue(data, key, "keyholder");
      }
      return retVal;
    } catch (SQLException e) {
View Full Code Here


    public void addKey(Number key) throws SQLException {
      if (this.key == null) {
        this.key = key;
      } else {
        throw new SQLException("generated key has already been set to " + this.key + ", now set to " + key);
      }
    }
View Full Code Here

    if (result == null) {
      logger.debug("{} using '{}' and {} args, got no results", label, statement, args.length);
    } else if (result == DatabaseConnection.MORE_THAN_ONE) {
      logger.error("{} using '{}' and {} args, got >1 results", label, statement, args.length);
      logArgs(args);
      throw new SQLException(label + " got more than 1 result: " + statement);
    } else {
      logger.debug("{} using '{}' and {} args, got 1 result", label, statement, args.length);
    }
    logArgs(args);
    @SuppressWarnings("unchecked")
View Full Code Here

  protected static <T, ID> String buildStatement(DatabaseType databaseType, TableInfo<T, ID> tableInfo)
      throws SQLException {
    FieldType idField = tableInfo.getIdField();
    if (idField == null) {
      throw new SQLException("Cannot query-for-id with " + tableInfo.getDataClass()
          + " because it doesn't have an id field");
    }
    // build the select statement by hand
    StringBuilder sb = new StringBuilder(64);
    appendTableName(databaseType, sb, "SELECT * FROM ", tableInfo.getTableName());
View Full Code Here

    super(SqlType.SERIALIZABLE, new Class<?>[0]);
  }

  @Override
  public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException {
    throw new SQLException("Default values for serializable types are not supported");
  }
View Full Code Here

  @Override
  public Object makeConfigObject(FieldType fieldType) throws SQLException {
    Map<Integer, Enum<?>> enumIntMap = new HashMap<Integer, Enum<?>>();
    Enum<?>[] constants = (Enum<?>[]) fieldType.getFieldType().getEnumConstants();
    if (constants == null) {
      throw new SQLException("Field " + fieldType + " improperly configured as type " + this);
    }
    for (Enum<?> enumVal : constants) {
      enumIntMap.put(enumVal.ordinal(), enumVal);
    }
    return enumIntMap;
View Full Code Here

  }

  @Override
  public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException {
    if (defaultStr.length() != 1) {
      throw new SQLException("Problems with field " + fieldType + ", default string to long for Character: '"
          + defaultStr + "'");
    }
    return (Character) defaultStr.charAt(0);
  }
View Full Code Here

    super(SqlType.BYTE_ARRAY, new Class<?>[0]);
  }

  @Override
  public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException {
    throw new SQLException("byte[] type cannot have default values");
  }
View Full Code Here

    if (offset == null) {
      return;
    }
    if (databaseType.isOffsetLimitArgument()) {
      if (limit == null) {
        throw new SQLException("If the offset is specified, limit must also be specified with this database");
      }
    } else {
      databaseType.appendOffsetValue(sb, offset);
    }
  }
View Full Code Here

  /**
   * Return the field types associated with this configuration.
   */
  public FieldType[] getFieldTypes(DatabaseType databaseType) throws SQLException {
    if (fieldTypes == null) {
      throw new SQLException("Field types have not been extracted in table config");
    }
    return fieldTypes;
  }
View Full Code Here

TOP

Related Classes of java.sql.SQLException$InternalIterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.