/** * Create a qualified sequence, given its sequence name. * <p> * This constructs a sequence reference given the sequence's qualified name. * jOOQ will render the sequence name according to your * {@link Settings#getRenderNameStyle()} settings. Choose * {@link RenderNameStyle#QUOTED} to prevent syntax errors and/or SQL * injection. * <p> * Example: <code><pre> * // This sequence... * sequence(name("MY_SCHEMA", "MY_SEQUENCE")); * * // ... will render this SQL on SQL Server with RenderNameStyle.QUOTED set * [MY_SCHEMA].[MY_SEQUENCE] * </pre></code> */ @Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, POSTGRES }) public static <T extends Number> Sequence<T> sequence(Name name, DataType<T> type) { if (name == null) throw new NullPointerException(); if (name.getName().length < 1 || name.getName().length > 2) throw new IllegalArgumentException("Must provide a qualified name of length 1 or 2 : " + name); String n = name.getName()[name.getName().length - 1]; Schema s = name.getName().length == 2 ? schema(name(name.getName()[0])) : null; return new SequenceImpl<T>(n, s, type); }
@Override public final boolean equalsIgnoreCase(Name that) { if (this == that) return true; String[] thisName = getName(); String[] thatName = that.getName(); if (thisName.length != thatName.length) return false; for (int i = 0; i < thisName.length; i++) { if (thisName[i] == null && thatName[i] == null) continue; if (thisName[i] == null || thatName[i] == null) return false; if (!thisName[i].equalsIgnoreCase(thatName[i])) return false; } return true; } }
Function(Name name, boolean distinct, DataType<T> type, QueryPart... arguments) { super(last(name.getName()), type); this.term = null; this.name = name; this.distinct = distinct; this.arguments = new QueryPartList<QueryPart>(arguments); this.keepDenseRankOrderBy = new SortFieldList(); this.withinGroupOrderBy = new SortFieldList(); }
String[] name = u.getName(); name[name.length - 1] = name[name.length - 1].substring(1); return name(name);