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 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 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 Map<String, String> select_map(DbConn cnx, String query_key, Object... args) { Map<String, String> res = new HashMap<String, String>(); try { ResultSet rs = cnx.runSelect(query_key, args); while (rs.next()) { res.put(rs.getString(2), rs.getString(3)); } } catch (SQLException e) { throw new DatabaseException(e); } return res; }
public static Map<String, String> select_map(DbConn cnx, String query_key, Object... args) { Map<String, String> res = new HashMap<String, String>(); try { ResultSet rs = cnx.runSelect(query_key, args); while (rs.next()) { res.put(rs.getString(3), rs.getString(4)); } } catch (SQLException e) { throw new DatabaseException(e); } return res; }
public static Map<String, String> select_map(DbConn cnx, String query_key, Object... args) { Map<String, String> res = new HashMap<>(); try { ResultSet rs = cnx.runSelect(query_key, args); while (rs.next()) { res.put(rs.getString(3), rs.getString(4)); } } catch (SQLException e) { throw new DatabaseException(e); } return res; }
public static Map<String, String> select_map(DbConn cnx, String query_key, Object... args) { Map<String, String> res = new HashMap<>(); try { ResultSet rs = cnx.runSelect(query_key, args); while (rs.next()) { res.put(rs.getString(2), rs.getString(3)); } } catch (SQLException e) { throw new DatabaseException(e); } return res; }
public static Map<String, String> select_map(DbConn cnx, String query_key, Object... args) { Map<String, String> res = new HashMap<String, String>(); try { ResultSet rs = cnx.runSelect(query_key, args); while (rs.next()) { res.put(rs.getString(2), rs.getString(3)); } } catch (SQLException e) { throw new DatabaseException(e); } return res; } }
static Queue map(ResultSet rs, int colShift) { try { Queue tmp = new Queue(); tmp.id = rs.getInt(1 + colShift); if (tmp.id == 0) { return null; } tmp.defaultQueue = rs.getBoolean(2 + colShift); tmp.description = rs.getString(3 + colShift); tmp.name = rs.getString(4 + colShift); return tmp; } catch (SQLException e) { throw new DatabaseException(e); } }
public static Map<String, String> select_map(DbConn cnx, String query_key, Object... args) { Map<String, String> res = new HashMap<>(); try { ResultSet rs = cnx.runSelect(query_key, args); while (rs.next()) { res.put(rs.getString(2), rs.getString(3)); } } catch (SQLException e) { throw new DatabaseException(e); } 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); }