Package org.apache.ws.jaxme.sqls

Examples of org.apache.ws.jaxme.sqls.Column


      }
      columns.add(pColumn);
  }

   public void addColumn(Column.Name pName) {
      Column column = getTable().getColumn(pName);
      if (column == null) {
         throw new NullPointerException("The table " + getTable().getName() + " doesn't contain a column " + pName);
      }
      addColumn(column);
   }
View Full Code Here


      default: throw new IllegalArgumentException("Column " + pColumnName +
                                                    " in table " + pTable.getQName() +
                                                    " has unknown JDBC data type " +
                                                    pDataType);
    }
    Column column = pTable.newColumn(pColumnName, type);
    logger.finest(mName, "Found column " + pColumnName);
    if (column instanceof StringColumn) {
      ((StringColumn) column).setLength(pColumnSize);
    } else if (column instanceof BinaryColumn) {
      ((BinaryColumn) column).setLength(pColumnSize);
    }
    if (pNullable == DatabaseMetaData.columnNullable) {
      column.setNullable(true);
    }
    return column;
  }
View Full Code Here

    }
    if (!pTableReference.getStatement().equals(getConstrainedStatement())) {
      throw new IllegalStateException("The statement of the table reference is not the same as this constraints statement.");
    }
    for (Iterator iter = pSet.getColumns();  iter.hasNext()) {
      Column column = (Column) iter.next();
      BooleanConstraint eq = createEQ();
      eq.addPart(new ColumnReferenceImpl(pTableReference, column));
      eq.addPlaceholder();
    }
  }
View Full Code Here

                                        pReferencedTable.getTable().getQName());
     }

     Iterator referencedIter = pReferencedColumnSet.getColumns();
     for (Iterator iter = pReferencingColumnSet.getColumns();  iter.hasNext()) {
        Column referencingColumn = (Column) iter.next();
        if (!referencedIter.hasNext()) {
           throw new IllegalStateException("The size of the referencing and referenced column sets doesn't match.");
        }
        Column referencedColumn = (Column) referencedIter.next();
        BooleanConstraint eq = createEQ();
        eq.addPart(pReferencingTable.newColumnReference(referencingColumn));
        eq.addPart(pReferencedTable.newColumnReference(referencedColumn));
     }
  }
View Full Code Here

      }

      if (pType == null) {
         throw new NullPointerException("The column type must not be null.");
      }
      Column column = getColumn(pName);
      if (column != null) {
         throw new IllegalStateException("A column named " + column.getName() +
                                          " already exists in the table " + getQName());
      }
      column = ((SQLFactoryImpl) getSchema().getSQLFactory()).newColumnImpl(this, pName, pType);
      columns.add(column);
      return column;
View Full Code Here

   public Column getColumn(Column.Name pName) {
      if (pName == null) {
         throw new NullPointerException("Column names must not be null.");
      }
      for (Iterator iter = getColumns();  iter.hasNext()) {
         Column column = (Column) iter.next();
         if (getSchema().getSQLFactory().isColumnNameCaseSensitive()) {
            if (pName.getName().equalsIgnoreCase(column.getName().getName())) {
               return column;
            }
         } else {
            if (pName.equals(column.getName())) {
               return column;
            }
         }
      }
      return null;
View Full Code Here

   public SelectStatement getSelectStatement() {
      SelectStatement result = getSchema().getSQLFactory().newSelectStatement();
      result.setTable(this);
      TableReference ref = result.getTableReference();
      for (Iterator iter = getColumns();  iter.hasNext()) {
         Column column = (Column) iter.next();
         result.addResultColumn(new ColumnReferenceImpl(ref, column));
      }
      return result;
   }
View Full Code Here

    UpdateStatement result = getSchema().getSQLFactory().newUpdateStatement();
    result.setTable(this);
    TableReference ref = result.getTableReference();
    boolean hasPrimaryKey = false;
    for (Iterator iter = getColumns();  iter.hasNext()) {
      Column column = (Column) iter.next();
      if (column.isPrimaryKeyPart()) {
        hasPrimaryKey = true;
      } else {
        result.addSet(column);
      }
    }
View Full Code Here

  /** <p>Creates a basic table</p>
   */
  protected Table getBasicTable() {
    Table table = schema.newTable("MyTable");
    Column myIndex = table.newColumn("MyIndex", Column.Type.INTEGER);
    assertTrue(!myIndex.isStringColumn());
    assertTrue(!myIndex.isBinaryColumn());
    Column myName = table.newColumn("MyName", Column.Type.VARCHAR);
    assertTrue(myName.isStringColumn()); // myName may be casted to a StringColumn
    assertTrue(!myName.isBinaryColumn());
    ((StringColumn) myName).setLength(60);
    Column myDate = table.newColumn("MyDate", Column.Type.DATE);
    assertTrue(!myDate.isStringColumn());
    assertTrue(!myDate.isBinaryColumn());
    myDate.setNullable(true);
    return table;
  }
View Full Code Here

    return table;
  }

  protected Table getForeignKeyTable(Table pTable) {
     Table otherTable = pTable.getSchema().newTable("OtherTable");
     Column otherIndex = otherTable.newColumn("MyIndex", Column.Type.INTEGER);
     Column referenceColumn = otherTable.newColumn("RefIndex", Column.Type.INTEGER);
     Column companyColumn = otherTable.newColumn("Company", Column.Type.VARCHAR);
     ((StringColumn) companyColumn).setLength(60);
     otherTable.newPrimaryKey().addColumn(otherIndex);

     ForeignKey reference = otherTable.newForeignKey(pTable);
     reference.addColumnLink(referenceColumn, pTable.getColumn("MyIndex"));
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.sqls.Column

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.