private static final Name[] nonEmpty(Name[] names) { Name[] result; int nulls = 0; for (int i = 0; i < names.length; i++) if (names[i] == null || names[i].equals(NO_NAME)) nulls++; if (nulls > 0) { result = new Name[names.length - nulls]; for (int i = names.length - 1; i >= 0; i--) if (names[i] == null || names[i].equals(NO_NAME)) nulls--; else result[i - nulls] = names[i]; } else { result = names; } return result; }
protected static final <D extends Definition> D getDefinition(List<D> definitions, Name name, boolean ignoreCase) { for (D definition : definitions) { if ((ignoreCase && definition.getQualifiedNamePart().equalsIgnoreCase(name)) || (!ignoreCase && definition.getQualifiedNamePart().equals(name))) { return definition; } } return null; }
@Override public boolean equals(Object that) { if (this == that) return true; if (that == null) return false; // [#2144] Non-equality can be decided early, without executing the // rather expensive implementation of AbstractQueryPart.equals() if (that instanceof AbstractNamed) if (!name.equals(((AbstractNamed) that).name)) return false; return super.equals(that); }
@SuppressWarnings("unchecked") final QueryPart window(Context<?> ctx) { if (windowSpecification != null) return DSL.sql("({0})", windowSpecification); // [#3727] Referenced WindowDefinitions that contain a frame clause // shouldn't be referenced from within parentheses (in PostgreSQL) if (windowDefinition != null) if ( POSTGRES == ctx.family()) return windowDefinition; else return DSL.sql("({0})", windowDefinition); // [#531] Inline window specifications if the WINDOW clause is not supported if (windowName != null) { if (SUPPORT_WINDOW_CLAUSE.contains(ctx.family())) return windowName; QueryPartList<WindowDefinition> windows = (QueryPartList<WindowDefinition>) ctx.data(DATA_WINDOW_DEFINITIONS); if (windows != null) { for (WindowDefinition window : windows) if (((WindowDefinitionImpl) window).getName().equals(windowName)) return DSL.sql("({0})", window); } // [#3162] If a window specification is missing from the query's WINDOW clause, // jOOQ should just render the window name regardless of the SQL dialect else { return windowName; } } return null; }
private static String overload(InformationSchema info, Routine routine) { Name routineName = name( routine.getRoutineCatalog(), routine.getRoutineSchema(), routine.getRoutinePackage(), routine.getRoutineName() ); String result = null; int count = 0; // TODO: Better algorithm by pre-calculating for (Routine r : info.getRoutines()) { Name rName = name( r.getRoutineCatalog(), r.getRoutineSchema(), r.getRoutinePackage(), r.getRoutineName() ); if (routineName.equals(rName)) { count++; if (routine == r) { result = "" + count; } if (count > 1 && result != null) break; } } return count > 1 ? result : null; }
); if (getQualifiedNamePart().equals(parameterRoutineName)) { DataTypeDefinition type = new DefaultDataTypeDefinition( getDatabase(),