Package com.bleujin.framework.db.procedure

Examples of com.bleujin.framework.db.procedure.IUserCommand.addParam()


  }

  public void testNamedParameterConflict() throws Exception {
    try {
      IUserCommand cmd = dc.createUserCommand("select ':abc' from copy_sample where no1 >= :no1 and no1 <= :no1") ;
      cmd.addParam("no1", 20) ;
      cmd.execQuery() ;
      fail() ;
    } catch (IllegalArgumentException ignore){}

    IUserCommand cmd = dc.createUserCommand("select 'a:1' from copy_sample where no1 >= :no1 and no1 <= :no1") ;
View Full Code Here


      cmd.execQuery() ;
      fail() ;
    } catch (IllegalArgumentException ignore){}

    IUserCommand cmd = dc.createUserCommand("select 'a:1' from copy_sample where no1 >= :no1 and no1 <= :no1") ;
    cmd.addParam("no1", 20) ;

    Rows rows = cmd.execQuery() ;
    assertEquals(1, rows.getRowCount()) ;
  }
View Full Code Here

    assertEquals(1, rows.getRowCount()) ;
  }

  public void testNamedParameter2() throws Exception {
    IUserCommand cmd = dc.createUserCommand("select * from copy_sample where no1 >= ? and no1 <= :no1") ;
    cmd.addParam(0, 19) ;
    cmd.addParam("no1", 20) ;
   
    Rows rows = cmd.execQuery() ;
    assertEquals(2, rows.getRowCount()) ;
  }
View Full Code Here

  }

  public void testNamedParameter2() throws Exception {
    IUserCommand cmd = dc.createUserCommand("select * from copy_sample where no1 >= ? and no1 <= :no1") ;
    cmd.addParam(0, 19) ;
    cmd.addParam("no1", 20) ;
   
    Rows rows = cmd.execQuery() ;
    assertEquals(2, rows.getRowCount()) ;
  }
 
View Full Code Here

   */
 
 
  public void testUpdate() throws Exception {
    IUserCommand cmd1 = dc.createUserCommand("insert into update_sample values(?, ?)") ;
    cmd1.addParam(1).addParam("abc") ;
    IUserCommand cmd2 = dc.createUserCommand("delete from update_sample where a = ?") ;
    cmd2.addParam(1);
   
    UserProcedures upts = dc.createUserProcedures("Multi MDL") ;
    upts.add(cmd1).add(cmd2) ;
View Full Code Here

 
  public void testUpdate() throws Exception {
    IUserCommand cmd1 = dc.createUserCommand("insert into update_sample values(?, ?)") ;
    cmd1.addParam(1).addParam("abc") ;
    IUserCommand cmd2 = dc.createUserCommand("delete from update_sample where a = ?") ;
    cmd2.addParam(1);
   
    UserProcedures upts = dc.createUserProcedures("Multi MDL") ;
    upts.add(cmd1).add(cmd2) ;
    int result = upts.execUpdate() ;
    assertEquals(2, result) ;
View Full Code Here

public class TestUserCommand extends DBTestCase{

  public void testProcSQL() throws Exception {
    IUserCommand query = dc.createUserCommand("select * from copy_tblc where rownum < ?") ;
    query.addParam(10) ;
   
    Debug.debug(query.getProcFullSQL());
  }
}
View Full Code Here

  }
 
 
  public void testParameter() throws Exception {
    IUserCommand cmd = dc.createUserCommand("select ? from copy_sample") ;
    cmd.addParam(0, "abc") ; // start index of param is 0 (zero)
    Rows rows = cmd.execQuery() ;
   
    rows.next() ;
    assertEquals("abc", rows.getString(1)) ;
  }
View Full Code Here

    assertEquals(1, count) ;
  }

  public void testParameter() throws Exception {
    IUserCommand cmd = dc.createUserCommand("insert into update_sample values(?, ?)") ;
    cmd.addParam(1).addParam("abc") ;
   
    int count = cmd.execUpdate() ;
    assertEquals(1, count) ;
   
   
View Full Code Here

    int count = cmd.execUpdate() ;
    assertEquals(1, count) ;
   
   
    IUserCommand cmd2 = dc.createUserCommand("insert into update_sample values(?, ?)") ;
    cmd2.addParam(0, 2) // start index is 0...
    cmd2.addParam(1, "bcd") ;
    count = cmd2.execUpdate() ;
    assertEquals(1, count) ;
  }
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.