public String getCatalog() throws SQLException { return database.getName(); }
public String getSchemaName(final int column) throws SQLException { final OResult currentRecord = getCurrentRecord(); if (currentRecord == null) return ""; else return currentRecord.toElement().getDatabase().getName(); }
@Override public void startup() { ODatabaseDocument db = ODatabaseRecordThreadLocal.instance().get(); profilerPrefix = "db." + db.getName() + ".cache.level1."; profilerMetadataPrefix = "db.*.cache.level1."; CACHE_HIT = profilerPrefix + "cache.found"; CACHE_MISS = profilerPrefix + "cache.notFound"; super.startup(); }
protected final OPartitionedObjectPool.PoolEntry<ScriptEngine> acquireGremlinEngine(final OrientGraph graph) { final OPartitionedObjectPool.PoolEntry<ScriptEngine> entry = scriptManager .acquireDatabaseEngine(graph.getRawDatabase().getName(), GREMLIN_GROOVY); final ScriptEngine engine = entry.object; Bindings bindings = engine.getBindings(ScriptContext.ENGINE_SCOPE); bindGraph(graph, bindings); return entry; }
@Override public ResultSet getSchemas() throws SQLException { database.activateOnCurrentThread(); OInternalResultSet resultSet = new OInternalResultSet(); final OResultInternal field = new OResultInternal(); field.setProperty("TABLE_SCHEM", database.getName()); field.setProperty("TABLE_CATALOG", database.getName()); resultSet.add(field); return new OrientJdbcResultSet(new OrientJdbcStatement(connection), resultSet, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT); }
@Override public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException { database.activateOnCurrentThread(); final Collection<OClass> classes = database.getMetadata().getSchema().getClasses(); OInternalResultSet resultSet = new OInternalResultSet(); final List tableTypes = types != null ? Arrays.asList(types) : TABLE_TYPES; for (OClass cls : classes) { final String className = cls.getName(); final String type; if (OMetadataInternal.SYSTEM_CLUSTER.contains(cls.getName().toLowerCase(Locale.ENGLISH))) type = "SYSTEM TABLE"; else type = "TABLE"; if (tableTypes.contains(type) && (tableNamePattern == null || tableNamePattern.equals("%") || tableNamePattern .equalsIgnoreCase(className))) { OResultInternal doc = new OResultInternal(); doc.setProperty("TABLE_CAT", database.getName()); doc.setProperty("TABLE_SCHEM", database.getName()); doc.setProperty("TABLE_NAME", className); doc.setProperty("TABLE_TYPE", type); doc.setProperty("REMARKS", (Object) null); doc.setProperty("TYPE_NAME", (Object) null); doc.setProperty("REF_GENERATION", (Object) null); resultSet.add(doc); } } return new OrientJdbcResultSet(new OrientJdbcStatement(connection), resultSet, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT); }
public ResultSet getCatalogs() throws SQLException { database.activateOnCurrentThread(); OInternalResultSet resultSet = new OInternalResultSet(); final OResultInternal field = new OResultInternal(); field.setProperty("TABLE_CAT", database.getName()); resultSet.add(field); return new OrientJdbcResultSet(new OrientJdbcStatement(connection), resultSet, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT); }
ODatabaseDocument db = OrienteerWebSession.get().getDatabase(); final OPartitionedObjectPool.PoolEntry<ScriptEngine> entry = scriptManager.acquireDatabaseEngine(db.getName(), "javascript"); final ScriptEngine scriptEngine = entry.object; Bindings binding = null; if (scriptManager != null && binding != null) { scriptManager.unbind(binding, null, null); scriptManager.releaseDatabaseEngine("javascript", db.getName(), entry);
if (profiler.isRecording()) { profiler .updateCounter(profiler.getDatabaseMetric(database.getName(), "query.indexUsed"), "Used index in query", +1);
doc.setProperty("PROCEDURE_CAT", database.getName()); doc.setProperty("PROCEDURE_SCHEM", database.getName()); doc.setProperty("PROCEDURE_NAME", f.getName()); doc.setProperty("COLUMN_NAME", p); doc.setProperty("PROCEDURE_CAT", database.getName()); doc.setProperty("PROCEDURE_SCHEM", database.getName()); doc.setProperty("PROCEDURE_NAME", f.getName()); doc.setProperty("COLUMN_NAME", "return");
private OResultInternal getPropertyAsDocument(final OClass clazz, final OProperty prop) { database.activateOnCurrentThread(); final OType type = prop.getType(); OResultInternal res = new OResultInternal(); res.setProperty("TABLE_CAT", database.getName()); res.setProperty("TABLE_SCHEM", database.getName()); res.setProperty("TABLE_NAME", clazz.getName()); res.setProperty("COLUMN_NAME", prop.getName()); res.setProperty("DATA_TYPE", OrientJdbcResultSetMetaData.getSqlType(type)); res.setProperty("TYPE_NAME", type.name()); res.setProperty("COLUMN_SIZE", 1); res.setProperty("BUFFER_LENGTH", null); res.setProperty("DECIMAL_DIGITS", null); res.setProperty("NUM_PREC_RADIX", 10); res.setProperty("NULLABLE", !prop.isNotNull() ? columnNoNulls : columnNullable); res.setProperty("REMARKS", prop.getDescription()); res.setProperty("COLUMN_DEF", prop.getDefaultValue()); res.setProperty("SQL_DATA_TYPE", null); res.setProperty("SQL_DATETIME_SUB", null); res.setProperty("CHAR_OCTET_LENGTH", null); res.setProperty("ORDINAL_POSITION", prop.getId()); res.setProperty("IS_NULLABLE", prop.isNotNull() ? "NO" : "YES"); return res; }