Package com.pv.mf.db.mock.lang

Examples of com.pv.mf.db.mock.lang.IQuery


     
      builder.columns(user.getId(), user.getUserName());
     
      builder.and(user.getId(),new Long(1L));
     
      IQuery statment = builder.build();
      Assert.assertEquals(
            "SELECT user.id,user.userName FROM user_mx_14.user WHERE user.id = ?",
            statment.getSql());
      Assert.assertArrayEquals(new Object[] {1L}, statment.getParameterValues());
     
   }
View Full Code Here


     
      builder.columns(user.getId(), user.getUserName());
     
      builder.andNotEqual(user.getId(), 1L);
     
      IQuery statment = builder.build();
      Assert.assertEquals(
            "SELECT user.id,user.userName FROM user_mx_14.user WHERE user.id != ?",
            statment.getSql());
      Assert.assertArrayEquals(new Object[] {1L}, statment.getParameterValues());
     
   }
View Full Code Here

     
      builder.and(user.getId(), 1L);
     
      builder.orderBy(user.getUserName());
     
      IQuery statment = builder.build();
      Assert.assertEquals(
            "SELECT user.id,user.userName"
            + " FROM user_mx_14.user"
            + " WHERE user.id = ?"
            + " ORDER BY user.userName",
            statment.getSql());
      Assert.assertArrayEquals(new Object[] {1L}, statment.getParameterValues());
     
   }
View Full Code Here

      DeleteBuilder builder = (DeleteBuilder)_annotationFactory.delete();
      User user = builder.mock(User.class);
     
      builder.and(user.getId(),new Long(1L));
     
      IQuery statment = builder.build();
      Assert.assertEquals(
            "DELETE FROM user_mx_14.user WHERE user.id = ?",
            statment.getSql());
      Assert.assertArrayEquals(new Object[] {1L}, statment.getParameterValues());
     
   }
View Full Code Here

      return this;
   };
  
  
   public int execute() {
      IQuery query = buildQuery();
      return _builder.getEntityHandler().executeQuery(_builder.getController(), query, SqlMode.INSERT);
   }
View Full Code Here

      User user = builder.mock(User.class);
     
      builder.columns(user.getId(), user.getUserName());
      user.setId(1L);
     
      IQuery statment = builder.build();
      Assert.assertEquals(
            "SELECT user.id,user.userName FROM user_mx_14.user WHERE user.id = ?",
            statment.getSql());
      Assert.assertArrayEquals(new Object[] {1L}, statment.getParameterValues());
     
   }
View Full Code Here

   public void delete() {
      DeleteBuilder builder = (DeleteBuilder)_annotationFactory.delete();
      User user = builder.mock(User.class);
      user.setId(1L);
     
      IQuery statment = builder.build();
      Assert.assertEquals(
            "DELETE FROM user_mx_14.user WHERE user.id = ?",
            statment.getSql());
      Assert.assertArrayEquals(new Object[] {1L}, statment.getParameterValues());
     
   }
View Full Code Here

      return this;
   }
  
   @SuppressWarnings("unchecked")
   public <M> M queryForObject(){
      IQuery q = buildQuery();
      _builder.getEntityHandler().executeQuery(_builder.getController(), q, SqlMode.SELECT);
      return (M)_builder.mock();
   }
View Full Code Here

      if ( _builder.getQuery().getColumns().isEmpty() ){
         columns();
      }     
      _builder.getQuery().addTable(_builder.getLastInvokedTable());
      _builder.cleanInvokedColumn();
      IQuery q = _builder.getEntityHandler().generateQuery(_builder.getQuery(), SqlMode.SELECT);
      _builder.reset();
      return q;
   }
View Full Code Here

      }
     
   }
  
   public int execute() {
      IQuery query = buildQuery();
      return _builder.getEntityHandler().executeQuery(_builder.getController(), query, SqlMode.DELETE);
   }
View Full Code Here

TOP

Related Classes of com.pv.mf.db.mock.lang.IQuery

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.