Пример #1
0
  public void addPrimaryKeyColumn(String columnName) {
    boolean found = false;
    // first search base columns
    Iterator<IntrospectedColumn> iter = baseColumns.iterator();
    while (iter.hasNext()) {
      IntrospectedColumn introspectedColumn = iter.next();
      if (introspectedColumn.getActualColumnName().equals(columnName)) {
        primaryKeyColumns.add(introspectedColumn);
        iter.remove();
        found = true;
        break;
      }
    }

    // search blob columns in the weird event that a blob is the primary key
    if (!found) {
      iter = blobColumns.iterator();
      while (iter.hasNext()) {
        IntrospectedColumn introspectedColumn = iter.next();
        if (introspectedColumn.getActualColumnName().equals(columnName)) {
          primaryKeyColumns.add(introspectedColumn);
          iter.remove();
          found = true;
          break;
        }
      }
    }
  }
Пример #2
0
  public void addColumn(IntrospectedColumn introspectedColumn) {
    if (introspectedColumn.isBLOBColumn()) {
      blobColumns.add(introspectedColumn);
    } else {
      baseColumns.add(introspectedColumn);
    }

    introspectedColumn.setIntrospectedTable(this);
  }
Пример #3
0
  /**
   * Returns true if any of the columns in the table are JDBC Times (as opposed to timestamps).
   *
   * @return true if the table contains TIME columns
   */
  public boolean hasJDBCTimeColumns() {
    boolean rc = false;

    for (IntrospectedColumn introspectedColumn : primaryKeyColumns) {
      if (introspectedColumn.isJDBCTimeColumn()) {
        rc = true;
        break;
      }
    }

    if (!rc) {
      for (IntrospectedColumn introspectedColumn : baseColumns) {
        if (introspectedColumn.isJDBCTimeColumn()) {
          rc = true;
          break;
        }
      }
    }

    return rc;
  }
Пример #4
0
  public IntrospectedColumn getColumn(String columnName) {
    if (columnName == null) {
      return null;
    } else {
      // search primary key columns
      for (IntrospectedColumn introspectedColumn : primaryKeyColumns) {
        if (introspectedColumn.isColumnNameDelimited()) {
          if (introspectedColumn.getActualColumnName().equals(columnName)) {
            return introspectedColumn;
          }
        } else {
          if (introspectedColumn.getActualColumnName().equalsIgnoreCase(columnName)) {
            return introspectedColumn;
          }
        }
      }

      // search base columns
      for (IntrospectedColumn introspectedColumn : baseColumns) {
        if (introspectedColumn.isColumnNameDelimited()) {
          if (introspectedColumn.getActualColumnName().equals(columnName)) {
            return introspectedColumn;
          }
        } else {
          if (introspectedColumn.getActualColumnName().equalsIgnoreCase(columnName)) {
            return introspectedColumn;
          }
        }
      }

      // search blob columns
      for (IntrospectedColumn introspectedColumn : blobColumns) {
        if (introspectedColumn.isColumnNameDelimited()) {
          if (introspectedColumn.getActualColumnName().equals(columnName)) {
            return introspectedColumn;
          }
        } else {
          if (introspectedColumn.getActualColumnName().equalsIgnoreCase(columnName)) {
            return introspectedColumn;
          }
        }
      }

      return null;
    }
  }