Package org.jugile.util

Examples of org.jugile.util.DBConnection.prepare()


  public void refresh() {
    DBPool db = DBPool.getPool();
    DBConnection c = db.getConnection();
    DomainData dd = DomainCore.cd();
    try {
      c.prepare("select "+_getSelectFlds()+" from "+table() +" where id_f=?");
      c.param(id());
      List<List> rows = c.select();
      if (rows.size() == 1) {
        List row = rows.get(0);
        // set state
View Full Code Here


    long nid = 0;
    DBPool pool = DBPool.getPool();
    DBConnection c = pool.getConnection();
    try {
      c.writeTx();
      c.prepare("select nextid from idpool where obj=?");
      c.param(obj);
      List<List> res = c.select();
      nid = (Integer)res.get(0).get(0);
      c.prepare("update idpool set nextid=? where obj=?");
      c.param(nid+idIncrement);
View Full Code Here

      c.writeTx();
      c.prepare("select nextid from idpool where obj=?");
      c.param(obj);
      List<List> res = c.select();
      nid = (Integer)res.get(0).get(0);
      c.prepare("update idpool set nextid=? where obj=?");
      c.param(nid+idIncrement);
      c.param(obj);
      c.execute();
      c.commit();
    } catch (Exception e) {
View Full Code Here

    List<E> res = new ArrayList<E>();
    DBPool db = DBPool.getPool();
    DBConnection c = db.getConnection();
    try {
      c.prepare(sql);
      for (List<Object> row : c.select()) {
        long id = (Integer)row.get(0);
        E o = (E)bo.createOld(bo.getClass(), id);
        o._setState(null,bo.bi(),row);
        res.add(o);
View Full Code Here

    List<Msg> msgs = new ArrayList<Msg>();
    try {
      String sql ="";
      sql += "select msg_id, nodeid, status, ts from dbmq_queue_t ";
      sql += "where nodeid=? AND status=? ORDER BY ts LIMIT ?";
      c.prepare(sql);
      c.param(node);
      c.param(NEW);
      c.param(max);
      List<Long> ids = new ArrayList<Long>();
      for (List row : c.select()) {
View Full Code Here

      if (ids.size() == 0) return msgs;
     
      // get messages
      sql = "select msg, nodeid, id_f, ts from dbmq_messages_t ";
      sql += "where id_f IN ("+qmarks(ids.size())+")";
      c.prepare(sql);
      for (Long id : ids) { c.param(id); }
      for (List<Object> row : c.select()) {
        String msg = (String)row.get(0);
        String nodeid = (String)row.get(1);
        long id = (Integer)row.get(2);
View Full Code Here

      c.rollback();
     
      // mark all status in progress     
      sql = "update dbmq_queue_t set status=? ";
      sql += "where nodeid=? AND status=? AND msg_id IN ("+qmarks(ids.size())+")";
      c.prepare(sql);
      c.param(INPROGRESS);
      c.param(node);
      c.param(NEW);
      for (Long id : ids) { c.param(id); }
      int count = c.execute();
View Full Code Here

  public static int flush(String name) {
    DBPool pool = DBPool.getPool();
    DBConnection c = pool.getConnection();
    try {
      String sql = "delete from dbmq_queue_t where nodeid=?";
      c.prepare(sql);
      c.param(name);
      int res = c.execute();
      c.commit();
      return res;
    } catch (java.sql.SQLNonTransientConnectionException se) {
View Full Code Here

  public static int flushNotNew(String name) {
    DBPool pool = DBPool.getPool();
    DBConnection c = pool.getConnection();
    try {
      String sql = "delete from dbmq_queue_t where nodeid=? and status!=0";
      c.prepare(sql);
      c.param(name);
      int res = c.execute();
      c.commit();
      return res;
    } catch (java.sql.SQLNonTransientConnectionException se) {
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.