Package jodd.db

Examples of jodd.db.DbQuery


    }

    protected void close() {
      DbSession session = new DbSession();

      DbQuery query = new DbQuery(session, "drop table " + getTableName());
      query.executeUpdate();

      session.closeSession();
      assertTrue(query.isClosed());

      connectionPool.close();
    }
View Full Code Here


    assertTrue(q2.isClosed());

    assertEquals(1, DbEntitySql.insert(new BadBoy(Integer.valueOf(1), "Johny", Integer.valueOf(3))).query().autoClose().executeUpdate());
    assertEquals(0, session.getTotalQueries());

    DbQuery dq = new DbQuery("select count(*) from GIRL where id>:id");
    dq.setInteger("id", 1);
    assertEquals(2, dq.executeCount());

    //dq.reset();
    dq.setInteger("id", 10);
    assertEquals(1, session.getTotalQueries());
    assertEquals(0, dq.autoClose().executeCount());

    assertEquals(0, session.getTotalQueries());


    // ---------------------------------------------------------------- girl
View Full Code Here

        "SPECIALITY  varchar(20)  null," +
        "TIME timestamp not null default CURRENT_TIMESTAMP, " +
        "primary key (ID)" +
        ')';

    DbQuery query = new DbQuery(sql);
    query.autoClose().executeUpdate();
    assertTrue(query.isClosed());

    executeUpdate(session, "insert into GIRL(ID, NAME, SPECIALITY) values(1, 'Anna', 'swim')");
    executeUpdate(session, "insert into GIRL(ID, NAME, SPECIALITY) values(2, 'Sandra', 'piano')");
    executeUpdate(session, "insert into GIRL(NAME) values('Monica')");
View Full Code Here

  public void testEnums() {
    DbSession session = new DbThreadSession(cp);

    String sql = "create table ENUMERATOR(ID int, NAME varchar(20), STATUS int)";

    DbQuery query = new DbQuery(sql);
    query.executeUpdate();

    Enumerator e = new Enumerator();
    e.id = 2;
    e.name = "Ikigami";
    e.status = Enumerator.STATUS.ONE;

    DbSqlGenerator gen = insert(e);
    query = new DbOomQuery(gen);
    query.executeUpdate();

    session.closeSession();
  }
View Full Code Here

TOP

Related Classes of jodd.db.DbQuery

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.