Examples of newColumn()


Examples of org.apache.ws.jaxme.sqls.Table.newColumn()

    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());
View Full Code Here

Examples of org.apache.ws.jaxme.sqls.Table.newColumn()

        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

Examples of org.apache.ws.jaxme.sqls.Table.newColumn()

        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);
       
View Full Code Here

Examples of org.apache.ws.jaxme.sqls.Table.newColumn()

    }
   
    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);
View Full Code Here

Examples of org.apache.ws.jaxme.sqls.Table.newColumn()

   
    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

Examples of org.apache.ws.jaxme.sqls.Table.newColumn()

   
    /** <p>Creates a table with a composed primary key.</p>
     */
    protected Table getComposedKeyTable() {
        Table table = getPrimaryKeyTable();
        Column verNumColumn = table.newColumn("VerNum", Column.Type.INTEGER);
        assertTrue(!verNumColumn.isStringColumn());
        assertTrue(!verNumColumn.isBinaryColumn());
        Index index = table.getPrimaryKey();
        index.addColumn("VerNum");
        return table;
View Full Code Here

Examples of org.apache.ws.jaxme.sqls.Table.newColumn()

    public void testSubSelect() {
        SQLGenerator gen = getSQLGenerator();
        Table table = getComposedKeyTable();
       
        Table otherTable = table.getSchema().newTable("OtherTable");
        Column otherIndex = otherTable.newColumn("MyIndex", Column.Type.INTEGER);
        otherTable.newPrimaryKey().addColumn(otherIndex);
        ForeignKey foreignKey = otherTable.newForeignKey(table);
        SelectStatement selectStatement = sqlFactory.newSelectStatement();
        selectStatement.setTable(otherTable);
        DeleteStatement deleteStatement = sqlFactory.newDeleteStatement();
View Full Code Here

Examples of org.apache.ws.jaxme.sqls.Table.newColumn()

        DeleteStatement deleteStatement = sqlFactory.newDeleteStatement();
        deleteStatement.setTable(table);
        List columns = new ArrayList();
        for (Iterator iter = table.getColumns();  iter.hasNext()) {
            Column column = (Column) iter.next();
            Column refColumn = otherTable.newColumn("Ref" + column.getName(), column.getType());
            foreignKey.addColumnLink(refColumn, column);
            if (column.isPrimaryKeyPart()) {
                selectStatement.addResultColumn(selectStatement.getTableReference().newColumnReference(refColumn));
                columns.add(deleteStatement.getTableReference().newColumnReference(column));
            }
View Full Code Here

Examples of org.apache.ws.jaxme.sqls.Table.newColumn()

  }
 
  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);
View Full Code Here

Examples of org.apache.ws.jaxme.sqls.Table.newColumn()

 
  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
TOP
Copyright © 2018 www.massapi.com. 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.