Package org.jugile.util

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


    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
        Bo o = origin;
View Full Code Here


    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);
      c.param(obj);
View Full Code Here

      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) {
      try { c.rollback(); } catch (Exception e2) { } fail(e);
View Full Code Here

      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) {
      try { c.rollback(); } catch (Exception e2) { } fail(e);
    } finally {
View Full Code Here

    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()) {
        long msg_id = (Integer)row.get(0);
View Full Code Here

      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()) {
        long msg_id = (Integer)row.get(0);
        ids.add(msg_id);
View Full Code Here

      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()) {
        long msg_id = (Integer)row.get(0);
        ids.add(msg_id);
      }
View Full Code Here

     
      // 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);
        Time ts = new Time((java.util.Date)row.get(3));
View Full Code Here

     
      // 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();
      if (count != ids.size()) fail("inconsistent status write: " + count + "/"+ ids.size());
View Full Code Here

      // 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();
      if (count != ids.size()) fail("inconsistent status write: " + count + "/"+ ids.size());
      c.commit();
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.