public OSQLFunction getFunction(String iFunctionName) { iFunctionName = iFunctionName.toLowerCase(Locale.ENGLISH); if (iFunctionName.equalsIgnoreCase("any") || iFunctionName.equalsIgnoreCase("all")) // SPECIAL FUNCTIONS return null; final Iterator<OSQLFunctionFactory> ite = getFunctionFactories(); while (ite.hasNext()) { final OSQLFunctionFactory factory = ite.next(); if (factory.hasFunction(iFunctionName)) { return factory.createFunction(iFunctionName); } } throw new OCommandSQLParsingException( "No function with name '" + iFunctionName + "', available names are : " + OCollections.toString(getFunctionNames())); }
private List<OIndex<?>> relatedIndexes(final String fieldName, ODatabase database) { final List<OIndex<?>> result = new ArrayList<OIndex<?>>(); for (final OIndex<?> oIndex : database.getMetadata().getIndexManager().getClassIndexes(className.getStringValue())) { if (OCollections.indexOf(oIndex.getDefinition().getFields(), fieldName, new OCaseInsentiveComparator()) > -1) { result.add(oIndex); } } return result; }
private List<OIndex<?>> relatedIndexes(final String fieldName) { final List<OIndex<?>> result = new ArrayList<OIndex<?>>(); final ODatabaseDocument database = getDatabase(); for (final OIndex<?> oIndex : database.getMetadata().getIndexManager().getClassIndexes(className)) { if (OCollections.indexOf(oIndex.getDefinition().getFields(), fieldName, new OCaseInsentiveComparator()) > -1) { result.add(oIndex); } } return result; }
/** * Remove the index on property * * @deprecated Use {@link OIndexManager#dropIndex(String)} instead. */ @Deprecated public OPropertyImpl dropIndexes() { getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_DELETE); acquireSchemaReadLock(); try { final OIndexManager indexManager = getDatabase().getMetadata().getIndexManager(); final ArrayList<OIndex<?>> relatedIndexes = new ArrayList<OIndex<?>>(); for (final OIndex<?> index : indexManager.getClassIndexes(owner.getName())) { final OIndexDefinition definition = index.getDefinition(); if (OCollections.indexOf(definition.getFields(), globalRef.getName(), new OCaseInsentiveComparator()) > -1) { if (definition instanceof OPropertyIndexDefinition) { relatedIndexes.add(index); } else { throw new IllegalArgumentException( "This operation applicable only for property indexes. " + index.getName() + " is " + index.getDefinition()); } } } for (final OIndex<?> index : relatedIndexes) getDatabase().getMetadata().getIndexManager().dropIndex(index.getName()); return this; } finally { releaseSchemaReadLock(); } }
private static OIndexFactory findFactoryByAlgorithmAndType(String algorithm, String indexType) { for (OIndexFactory factory : getFactories()) { if (indexType == null || indexType.isEmpty() || (factory.getTypes().contains(indexType)) && factory.getAlgorithms() .contains(algorithm)) { return factory; } } throw new OIndexException( "Index type " + indexType + " with engine " + algorithm + " is not supported. Types are " + OCollections .toString(getIndexTypes())); }
throw new ODatabaseException("Invalid sorting. " + OCollections.toString(pairs));