public void rollback() { try { _cnx.rollback(); transac_open = false; rollbackOnly = false; } catch (SQLException e) { throw new DatabaseException(e); } }
public void rollback() { try { _cnx.rollback(); transac_open = false; rollbackOnly = false; } catch (SQLException e) { throw new DatabaseException(e); } }
public void commit() { if (rollbackOnly) { throw new IllegalStateException("cannot commit a rollback only session. Use rollback first."); } try { _cnx.commit(); transac_open = false; } catch (SQLException e) { throw new DatabaseException(e); } }
public static JobInstance select_id(DbConn cnx, int id) { List<JobInstance> res = select(cnx, "ji_select_by_id", id); if (res.isEmpty()) { throw new DatabaseException("no result for query by ID for ID " + id); } if (res.size() > 1) { throw new DatabaseException("Inconsistent database! Multiple results for query by ID for ID " + id); } return res.get(0); }
public static RUser select_id(DbConn cnx, Integer id) { List<RUser> res = select(cnx, "user_select_by_id", id); if (res.isEmpty()) { throw new DatabaseException("no result for query by key for key " + id); } if (res.size() > 1) { throw new DatabaseException("Inconsistent database! Multiple results for query by key for key " + id); } return res.get(0); }
public static JobInstance select_id(DbConn cnx, int id) { List<JobInstance> res = select(cnx, "ji_select_by_id", id); if (res.isEmpty()) { throw new DatabaseException("no result for query by ID for ID " + id); } if (res.size() > 1) { throw new DatabaseException("Inconsistent database! Multiple results for query by ID for ID " + id); } return res.get(0); }
public static RUser select_id(DbConn cnx, Integer id) { List<RUser> res = select(cnx, "user_select_by_id", id); if (res.isEmpty()) { throw new DatabaseException("no result for query by key for key " + id); } if (res.size() > 1) { throw new DatabaseException("Inconsistent database! Multiple results for query by key for key " + id); } return res.get(0); }
public static void delete_id(DbConn cnx, int id) { QueryResult res = cnx.runUpdate("ji_delete_by_id", id); if (res.nbUpdated != 1) { throw new DatabaseException("Delete failed: row does not exist"); } }
public static void delete_id(DbConn cnx, int id) { QueryResult res = cnx.runUpdate("ji_delete_by_id", id); if (res.nbUpdated != 1) { throw new DatabaseException("Delete failed: row does not exist"); } }
/** * Gets the interpolated text of a query from cache. If key does not exist, an exception is thrown. * * @param key * name of the query * @return the query text */ String getQuery(String key) { String res = this.adapter.getSqlText(key); if (res == null) { throw new DatabaseException("Query " + key + " does not exist"); } return res; }
/** * Gets the interpolated text of a query from cache. If key does not exist, an exception is thrown. * * @param key * name of the query * @return the query text */ String getQuery(String key) { String res = this.adapter.getSqlText(key); if (res == null) { throw new DatabaseException("Query " + key + " does not exist"); } return res; }
public static JobDef select_key(DbConn cnx, String name) { List<JobDef> res = select(cnx, "jd_select_by_key", name); if (res.isEmpty()) { throw new NoResultException("no result for query by key for key " + name); } if (res.size() > 1) { throw new DatabaseException("Inconsistent database! Multiple results for query by key for key " + name); } return res.get(0); }
public static JobDef select_key(DbConn cnx, String name) { List<JobDef> res = select(cnx, "jd_select_by_key", name); if (res.isEmpty()) { throw new NoResultException("no result for query by key for key " + name); } if (res.size() > 1) { throw new DatabaseException("Inconsistent database! Multiple results for query by key for key " + name); } return res.get(0); }
public static Cl select_key(DbConn cnx, String name) { List<Cl> res = select(cnx, "cl_select_by_key", name); if (res.isEmpty()) { throw new NoResultException("no result for query by key for key " + name); } if (res.size() > 1) { throw new DatabaseException("Inconsistent database! Multiple results for query by key for key " + name); } return res.get(0); }
public static Queue select_key(DbConn cnx, String name) { List<Queue> res = select(cnx, "q_select_by_key", name); if (res.isEmpty()) { throw new NoResultException("no result for query by key for key " + name); } if (res.size() > 1) { throw new DatabaseException("Inconsistent database! Multiple results for query by key for key " + name); } return res.get(0); }
public static Queue select_key(DbConn cnx, String name) { List<Queue> res = select(cnx, "q_select_by_key", name); if (res.isEmpty()) { throw new NoResultException("no result for query by key for key " + name); } if (res.size() > 1) { throw new DatabaseException("Inconsistent database! Multiple results for query by key for key " + name); } return res.get(0); }
public static Cl select_key(DbConn cnx, String name) { List<Cl> res = select(cnx, "cl_select_by_key", name); if (res.isEmpty()) { throw new NoResultException("no result for query by key for key " + name); } if (res.size() > 1) { throw new DatabaseException("Inconsistent database! Multiple results for query by key for key " + name); } return res.get(0); }
public static List<Node> select(DbConn cnx, String query_key, Object... args) { List<Node> res = new ArrayList<Node>(); try { ResultSet rs = cnx.runSelect(query_key, args); while (rs.next()) { res.add(map(cnx, rs, 0)); } } catch (SQLException e) { throw new DatabaseException(e); } return res; }
public static NodeDto getNode(DbConn cnx, String nodeName) { ResultSet rs = null; try { rs = cnx.runSelect("node_select_by_key", nodeName); if (!rs.next()) { throw new JqmAdminApiUserException("no result"); } return mapNode(rs, 0); } catch (SQLException e) { throw new DatabaseException(e); } }
public static QueueDto getQueue(DbConn cnx, int id) { ResultSet rs = null; try { rs = cnx.runSelect("q_select_by_id", id); if (!rs.next()) { throw new JqmAdminApiUserException("no result"); } return mapQueue(rs, 0); } catch (SQLException e) { throw new DatabaseException(e); } }