Package org.apache.ws.jaxme.sqls

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


      }
      return result;
   }

  public UpdateStatement getUpdateStatement() {
    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);
      }
    }
    if (hasPrimaryKey) {
      result.getWhere().addColumnSetQuery(getPrimaryKey(), ref);
    } else {
      throw new IllegalStateException("Cannot create a default update statement without a primary key.");
    }
    return result;
  }
View Full Code Here


  /** <p>Basic test for creating an <code>UPDATE</code> statement.</p>
   */
  public void testBasicUpdate() {
    Table table = getPrimaryKeyTable();
    UpdateStatement updateStatement = table.getUpdateStatement();
    SQLGenerator generator = sqlFactory.newSQLGenerator();
    generator.setLineTerminator("\n");
    String s = generator.getQuery(updateStatement);
    assertEquals("UPDATE MySchema.MyTable SET MyName=?, MyDate=? WHERE MyIndex=?", s);
  }
View Full Code Here

   
    /** <p>Basic test for creating an <code>UPDATE</code> statement.</p>
     */
    public void testBasicUpdate() {
        Table table = getPrimaryKeyTable();
        UpdateStatement updateStatement = table.getUpdateStatement();
        SQLGenerator generator = getSQLGenerator();
        generator.setLineTerminator("\n");
        String s = generator.getQuery(updateStatement);
        assertEquals("UPDATE MySchema.MyTable SET MyName=?, MyDate=? WHERE MyIndex=?", s);
    }
View Full Code Here

      }
      return result;
   }

  public UpdateStatement getUpdateStatement() {
    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);
      }
    }
    if (hasPrimaryKey) {
      result.getWhere().addColumnSetQuery(getPrimaryKey(), ref);
    } else {
      throw new IllegalStateException("Cannot create a default update statement without a primary key.");
    }
    return result;
  }
View Full Code Here

   
    /** <p>Basic test for creating an <code>UPDATE</code> statement.</p>
     */
    public void testBasicUpdate() {
        Table table = getPrimaryKeyTable();
        UpdateStatement updateStatement = table.getUpdateStatement();
        SQLGenerator generator = getSQLGenerator();
        generator.setLineTerminator("\n");
        String s = generator.getQuery(updateStatement);
        assertEquals("UPDATE MySchema.MyTable SET MyName=?, MyDate=? WHERE MyIndex=?", s);
    }
View Full Code Here

      }
      return result;
   }

  public UpdateStatement getUpdateStatement() {
    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);
      }
    }
    if (hasPrimaryKey) {
      result.getWhere().addColumnSetQuery(getPrimaryKey(), ref);
    } else {
      throw new IllegalStateException("Cannot create a default update statement without a primary key.");
    }
    return result;
  }
View Full Code Here

  /** <p>Basic test for creating an <code>UPDATE</code> statement.</p>
   */
  public void testBasicUpdate() {
    Table table = getPrimaryKeyTable();
    UpdateStatement updateStatement = table.getUpdateStatement();
    SQLGenerator generator = getSQLGenerator();
    generator.setLineTerminator("\n");
    String s = generator.getQuery(updateStatement);
    assertEquals("UPDATE MySchema.MyTable SET MyName=?, MyDate=? WHERE MyIndex=?", s);
  }
View Full Code Here

TOP

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

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.