Package ch.inftec.ju.db

Examples of ch.inftec.ju.db.DbRow


    Assert.assertFalse(r1Builder.getRow().equals(this));
  }
 
  @Test
  public void testUpperAndLowerCase() {
    DbRow row = DbRowUtils.newDbRow()
        .addValue("lower", 1, "lower")
        .addValue("Mixed", 1, "Mixed")
        .addValue("UPPER", 1, "UPPER")
        .getRow();
   
    Assert.assertEquals("LOWER", row.getColumnName(0));
    Assert.assertEquals("MIXED", row.getColumnName(1));
    Assert.assertEquals("UPPER", row.getColumnName(2));
   
    Assert.assertEquals("lower", row.getValue("lower"));
    Assert.assertEquals("lower", row.getValue("Lower"));
    Assert.assertEquals("lower", row.getValue("LOWER"));
  }
View Full Code Here


    Assert.assertEquals("lower", row.getValue("LOWER"));
  }
 
  @Test
  public void testNull() {
    DbRow row = DbRowUtils.newDbRow()
        .addValue("lower", 1, null)
        .getRow();
   
    Assert.assertNull(row.getValue("lower"));
    Assert.assertNull(row.getValue("something"));
    Assert.assertNull(row.getValue(null));
   
    try {
      DbRowUtils.newDbRow()
        .addValue(null, 1, null);
      Assert.fail("Adding null column should throw NullPointerException");
View Full Code Here

   * @param primaryKeyValue Primary key value
   * @return AbstractActionBuilder instance to build the action
   * @throws IllegalArgumentException If the specified row cannot be found
   */
  public static AbstractActionBuilder newUpdateAction(DbConnection dbConn, String tableName, Object primaryKeyValue) {
    DbRow row = dbConn.getQueryRunner().primaryKeyQuery(tableName, primaryKeyValue);
    if (row == null) throw new IllegalArgumentException("No row found on table " + tableName + " with ID " + primaryKeyValue);
   
    return new UpdateActionBuilder(dbConn, row, tableName);
  }
View Full Code Here

   * @param primaryKeyValue Primary key value
   * @return DbAction instance to delete the row
   * @throws IllegalArgumentException If the specified row cannot be found
   */
  public static DbAction newDeleteAction(DbConnection dbConn, String tableName, Object primaryKeyValue) {
    DbRow row = dbConn.getQueryRunner().primaryKeyQuery(tableName, primaryKeyValue);
    if (row == null) throw new IllegalArgumentException("No row found on table " + tableName + " with ID " + primaryKeyValue);
   
    return DbActionUtils.newDeleteAction(dbConn, row, tableName);
  }
View Full Code Here

TOP

Related Classes of ch.inftec.ju.db.DbRow

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.