Package org.apache.ws.jaxme.sqls

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


  }
 
  protected Table getMainTable() {
    if (mainTable == null) {
      Table mt = getSchema().newTable("MAIN");
      Column mtId = mt.newColumn("ID", Column.Type.BIGINT);
      Column mtVer = mt.newColumn("VER", Column.Type.INTEGER);
      StringColumn mtName = (StringColumn) mt.newColumn("NAME", Column.Type.VARCHAR);
      mtName.setLength(60);
      BinaryColumn mtSig = (BinaryColumn) mt.newColumn("SIG", Column.Type.BINARY);
      mtSig.setLength(16);
      mt.newColumn("DATE", Column.Type.DATE);
View Full Code Here


    if (subTable == null) {
      Table st = getSchema().newTable("SUB");
      StringColumn stId = (StringColumn) st.newColumn("ID", Column.Type.VARCHAR);
      stId.setLength(32);
     
      Column stMtId = st.newColumn("MTID", Column.Type.BIGINT);
      Column stMtVer = st.newColumn("MTVER", Column.Type.INTEGER);
      StringColumn stAddress = (StringColumn) st.newColumn("ADDRESS", Column.Type.VARCHAR);
      stAddress.setLength(60);
      StringColumn stEmail = (StringColumn) st.newColumn("EMAIL", Column.Type.VARCHAR);
      stEmail.setLength(60);
      stEmail.setNullable(true);
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

  public void addColumnLink(Column pColumn, Column pReferencedColumn) {
    addColumnReference(new ColumnReferenceImpl(pColumn, pReferencedColumn));
  }

  public void addColumnReference(ForeignKey.ColumnLink pReference) {
    Column localColumn = pReference.getLocalColumn();
    if (!getTable().equals(localColumn.getTable())) {
      throw new IllegalStateException("The local column " + localColumn.getQName() +
                                       " is not from the local table " + getTable().getQName());
    }
    Column referencedColumn = pReference.getReferencedColumn();
    if (!getReferencedTable().equals(referencedColumn.getTable())) {
      throw new IllegalStateException("The referenced column " + referencedColumn.getQName() +
                                       " is not from the referenced table " + getReferencedTable().getQName());
    }
    references.add(pReference);
  }
View Full Code Here

    }
    references.add(pReference);
  }

  public void addColumnLink(Column.Name pName, Column.Name pReferencedName) {
      Column localColumn = getTable().getColumn(pName);
      if (localColumn == null) {
        throw new NullPointerException("The local table " + getTable().getQName() +
                                        " doesn't contain a column " + pName);
      }
      Column referencedColumn = getReferencedTable().getColumn(pReferencedName);
      if (referencedColumn == null) {
         throw new NullPointerException("The referenced table " + getReferencedTable().getName() +
                                         " doesn't contain a column " + pReferencedName);
      }
      addColumnLink(localColumn, referencedColumn);
View Full Code Here

    Index index = getTable().getPrimaryKey();
    if (index == null) {
      return false;
    }
    for (Iterator iter = index.getColumns();  iter.hasNext()) {
      Column column = (Column) iter.next();
      if (column.equals(this)) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

  public ColumnReference newColumnReference(String pName) {
      return newColumnReference(new ColumnImpl.NameImpl(pName));
  }

  public ColumnReference newColumnReference(Column.Name pName) {
      Column column = getTable().getColumn(pName);
      if (column == null) {
         throw new NullPointerException("Unknown column name in table " + getTable().getName() +
                                         ": " + pName);
      }
      return newColumnReference(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);
        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 (subsubTable == null) {
      Table sst = getSchema().newTable("SUBSUB");
      StringColumn sstId = (StringColumn) sst.newColumn("ID", Column.Type.VARCHAR);
      sstId.setLength(32);
     
      Column sstMtId = sst.newColumn("MTID", Column.Type.BIGINT);
      Column sstMtVer = sst.newColumn("MTVER", Column.Type.INTEGER);
      ForeignKey foreignKeySt = sst.newForeignKey(getMainTable());
      foreignKeySt.addColumnLink(sstMtId, getMainTable().getColumn("ID"));
      foreignKeySt.addColumnLink(sstMtVer, getMainTable().getColumn("VER"));
     
      StringColumn sstStId = (StringColumn) sst.newColumn("SSTID", Column.Type.VARCHAR);
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

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.