Пример #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 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;
    }
  }