Package org.conserve.tools.generators

Examples of org.conserve.tools.generators.IdStatementGenerator


   
   
    //create a new field of the right type in toTable
    ensureColumnExists(toTable, colName, nuObjectStack.getRepresentation(toLevel).getReturnType(colName), cw);
   
    IdStatementGenerator idGen = new IdStatementGenerator(adapter, nuObjectStack, true);
    int minLevel = Math.min(fromLevel, toLevel);
    String idStatement = idGen.generate(minLevel);
    StringBuilder sb = new StringBuilder("UPDATE ");
    sb.append(toTable);
    sb.append(" AS ");
    sb.append(toTableAs);
    sb.append(" SET ");
    sb.append(toTableAs);
    sb.append(".");
    sb.append(colName);
    sb.append("= ( SELECT ");
    sb.append(fromTableAs);
    sb.append(".");
    sb.append(colName);
    sb.append(" FROM ");
    sb.append(idGen.generateAsStatement(new String[]{toTable}));
    sb.append(" WHERE ");
    sb.append(idStatement);   
    sb.append(")");
    PreparedStatement ps = cw.prepareStatement(sb.toString());
    int index = 0;
    for (RelationDescriptor o : idGen.getRelationDescriptors())
    {
      if(o.isRequiresvalue())
      {
        index++;
        Tools.setParameter(ps, o.getValue().getClass(), index,o.getValue());
View Full Code Here


  public StatementPrototype(AdapterBase adapter, ObjectStack oStack, Class<?> resultClass, boolean addJoins)
  {
    this.adapter = adapter;
    this.queryClass = resultClass;

    idGen = new IdStatementGenerator(adapter,oStack,addJoins);
    // initialise the statement stack
    push("AND");
    statementStack = statementStackPointer;
  }
View Full Code Here

TOP

Related Classes of org.conserve.tools.generators.IdStatementGenerator

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.