DbResult res = sta.executeQuery(prop); exists = res.next(); res.close(); sta.close(); if (exists) { DbStatement sta = con.createStatement("UPDATE " + prefix + "_engine_ SET content_=$content$,modified_=$modified$ WHERE id_=$id$"); sta.executeUpdate(prop); sta.close(); sta.executeUpdate(prop); sta.close();
/** * <p>deleteObject.</p> * * @param con a {@link de.mhus.lib.sql.DbConnection} object. * @param object a {@link java.lang.Object} object. * @throws java.lang.Exception if any. */ public void deleteObject(DbConnection con, Object object) throws Exception { for (Feature f : features) f.deleteObject(con,object); HashMap<String, Object> attributes = new HashMap<String, Object>(); for (Field f : pk) { attributes.put(f.name, f.getFromTarget(object)); } schema.internalDeleteObject(con, name, object, attributes); sqlDelete.getStatement(con).execute(attributes); }
public DbConnection getConnection() { return sth.getConnection(); }
public void dumpNodes() { try { DbConnection con = pool.getConnection(); MProperties prop = new MProperties(); DbStatement sta = con.createStatement("SELECT * FROM " + prefix + "_node_"); DbResult res = sta.executeQuery(prop); while(res.next()) { System.out.println("NODE:"); for (String name : res.getColumnNames()) if (!name.toLowerCase().equals("content_")) System.out.println(" " + name + ": " + res.getString(name)); } } catch (Exception e) { throw new RuntimeException(e); } }
try { DbStatement sth = con.createStatement(query); DbResult res = sth.executeQuery(map); LinkedList<T> out = new LinkedList<>(); while (res.next()) { sth.close(); } catch (Throwable t) { log().w(query,alias,t);
sta.executeUpdate(prop); sta.close();
int c = query.getStatement(con).executeUpdate(attributes); if ( c != 1) throw new MException("update failed, updated objects " + c);
@Override protected void finalize() throws Throwable { close(); };
DbStatement.addBinary(attributes,value); return;
public void dumpCases() { try { DbConnection con = pool.getConnection(); MProperties prop = new MProperties(); DbStatement sta = con.createStatement("SELECT * FROM " + prefix + "_case_"); DbResult res = sta.executeQuery(prop); while(res.next()) { System.out.println("CASE:"); for (String name : res.getColumnNames()) if (!name.toLowerCase().equals("content_")) System.out.println(" " + name + ": " + res.getString(name)); } } catch (Exception e) { throw new RuntimeException(e); } }
try { sth = con.createStatement(query); res = sth.executeQuery(map); long count = -1; while(res.next()) try { if (res != null) res.close(); if (sth != null) sth.close(); if (myCon != null) schema.closeConnection(pool, myCon); } catch (Throwable t) {
sta.executeUpdate(prop); sta.close();
@Override public boolean setNodeScope(UUID nodeId, int scope) throws IOException { try { DbConnection con = pool.getConnection(); MProperties prop = new MProperties(); DbStatement sta = null; prop.put("id", nodeId); prop.put("value", scope); sta = con.createStatement("UPDATE " + prefix + "_node_ SET scope_=$value$ WHERE id_=$id$"); int res = sta.executeUpdate(prop); con.close(); return res == 1; } catch (Exception e) { throw new IOException(e); } }
DbResult res = sta.executeQuery(prop); exists = res.next(); res.close(); sta.close(); sta.executeUpdate(prop); sta.close(); } else { + "$index9$" + ")"); sta.executeUpdate(prop); sta.close();
/** * <p>existsObject.</p> * * @param con a {@link de.mhus.lib.sql.DbConnection} object. * @param keys an array of {@link java.lang.Object} objects. * @return a boolean. * @throws java.lang.Exception if any. */ public boolean existsObject(DbConnection con, Object[] keys) throws Exception { HashMap<String, Object> attributes = new HashMap<String, Object>(); int nr = 0; for (Object key : keys) { attributes.put(String.valueOf(nr), key); nr++; } DbResult ret = sqlPrimary.getStatement(con).executeQuery(attributes); if (!ret.next()) { ret.close(); return false; } ret.close(); return true; }
@Override public boolean setCasePriority(UUID caseId, int priority) throws IOException { try { DbConnection con = pool.getConnection(); MProperties prop = new MProperties(); DbStatement sta = null; prop.put("id", caseId); prop.put("value", priority); sta = con.createStatement("UPDATE " + prefix + "_case_ SET priority_=$value$ WHERE id_=$id$"); int res = sta.executeUpdate(prop); con.close(); return res == 1; } catch (Exception e) { throw new IOException(e); } }
@Override public void deleteCaseAndFlowNodes(UUID id) throws IOException { try { DbConnection con = pool.getConnection(); MProperties prop = new MProperties(); prop.put("id", id); { DbStatement sta = con.createStatement("DELETE FROM " + prefix + "_case_ WHERE id_=$id$"); sta.execute(prop); } { DbStatement sta = con.createStatement("DELETE FROM " + prefix + "_node_ WHERE case_=$id$"); sta.execute(prop); } con.commit(); con.close(); } catch (Exception e) { throw new IOException(e); } }
DbResult res = sta.executeQuery(prop); exists = res.next(); res.close(); sta.close(); sta.executeUpdate(prop); sta.close(); } else { + "$actor$" + ")"); sta.executeUpdate(prop); sta.close();
DbResult res = sta.executeQuery(prop); return new SqlResultNode(con,res); } catch (Exception e) {
@Override public boolean setNodePriority(UUID nodeId, int priority) throws IOException { try { DbConnection con = pool.getConnection(); MProperties prop = new MProperties(); DbStatement sta = null; prop.put("id", nodeId); prop.put("value", priority); sta = con.createStatement("UPDATE " + prefix + "_node_ SET priority_=$value$ WHERE id_=$id$"); int res = sta.executeUpdate(prop); con.close(); return res == 1; } catch (Exception e) { throw new IOException(e); } }