public ODatabase<ORecord> commit() { return database.commit(); }
@Override public ODatabase<ORecord> commit() throws OTransactionException { checkOpenness(); internal.commit(); return this; }
@Override public ODatabase<ORecord> commit(boolean force) throws OTransactionException { checkOpenness(); internal.commit(force); return this; }
@Override public void end() { ODatabaseDocumentInternal db = getDatabase(); if (!txAlreadyBegun) { db.commit(); } }
@Override protected Boolean execute(ODatabaseDocument db) { document.save(); if (document.getDatabase().getTransaction().isActive()){ document.getDatabase().commit(); } return true; } }.execute();
/** * Commits the current active transaction. */ public void commit() { makeActive(); if (getDatabase() == null) return; getDatabase().commit(); if (isAutoStartTx()) ensureTransaction(); }
/** * Delete the current vertex. */ public boolean result(final Object iRecord) { final OIdentifiable id = (OIdentifiable) iRecord; if (id.getIdentity().isValid()) { final ODocument record = id.getRecord(); ODatabaseDocumentInternal db = getDatabase(); final OVertex v = toVertex(record); if (v != null) { v.delete(); if (!txAlreadyBegun && batch > 0 && removed % batch == 0) { db.commit(); db.begin(); } if (returning.equalsIgnoreCase("BEFORE")) allDeletedRecords.add(record); removed++; } } return true; }
@ConsoleCommand(description = "Commits transaction changes to the database") public void commit() throws IOException { checkForDatabase(); if (!currentDatabase.getTransaction().isActive()) { message("\nError: no active transaction is currently open."); return; } if (currentDatabase.getStorage().isRemote()) { message( "\nWARNING - Transactions are not supported from console in remote, please use an sql script: \neg.\n\nscript sql\nbegin;\n<your commands here>\ncommit;\nend\n\n"); return; } final long begin = System.currentTimeMillis(); final int txId = currentDatabase.getTransaction().getId(); currentDatabase.commit(); message("\nTransaction " + txId + " has been committed in " + (System.currentTimeMillis() - begin) + "ms"); }
/** * Delete the current edge. */ public boolean result(final Object iRecord) { final OIdentifiable id = (OIdentifiable) iRecord; if (compiledFilter != null) { // ADDITIONAL FILTERING if (!(Boolean) compiledFilter.evaluate(id.getRecord(), null, context)) return true; } if (id.getIdentity().isValid()) { final OEdge e = toEdge(id); if (e != null) { e.delete(); if (!txAlreadyBegun && batch > 0 && (removed + 1) % batch == 0) { getDatabase().commit(); getDatabase().begin(); } removed++; } } return true; }
@Override public boolean authenticate(String username, String password) { ODatabaseDocumentInternal currentDB = getDatabase(); try { boolean inTransaction = currentDB.getTransaction().isActive(); IOrientDbSettings settings = OrientDbWebApplication.get().getOrientDbSettings(); ODatabaseDocumentInternal newDB = settings.getDatabasePoolFactory().get(settings.getDBUrl(), username, password).acquire(); if(newDB!=currentDB) { currentDB.activateOnCurrentThread(); currentDB.commit(); currentDB.close(); newDB.activateOnCurrentThread(); } setUser(username, password); userModel.setObject(newDB.getUser().getDocument()); // user = newDB.getMetadata().getSecurity().getUser(username); // newDB.setUser(user); if(inTransaction && !newDB.getTransaction().isActive()) newDB.begin(); return true; } catch (OSecurityAccessException e) { currentDB.activateOnCurrentThread(); return false; } }
@Override public boolean authenticate(String username, String password) { ODatabaseDocumentInternal currentDB = getDatabase(); try { boolean inTransaction = currentDB.getTransaction().isActive(); IOrientDbSettings settings = OrientDbWebApplication.get().getOrientDbSettings(); ODatabaseDocumentInternal newDB = settings.getDatabasePoolFactory().get(settings.getDBUrl(), username, password).acquire(); if(newDB!=currentDB) { currentDB.activateOnCurrentThread(); currentDB.commit(); currentDB.close(); newDB.activateOnCurrentThread(); } setUser(username, password); userModel.setObject(newDB.getUser().getDocument()); // user = newDB.getMetadata().getSecurity().getUser(username); // newDB.setUser(user); if(inTransaction && !newDB.getTransaction().isActive()) newDB.begin(); return true; } catch (OSecurityAccessException e) { currentDB.activateOnCurrentThread(); return false; } }