public DBIdentifier makeIdentifierValid(DBIdentifier sname, NameSet set, int maxLen, boolean checkForUniqueness) { DBIdentifier validName = sname; String rule = sname.getType().name();
public DBIdentifier makeIdentifierValid(DBIdentifier sname, NameSet set, int maxLen, boolean checkForUniqueness) { DBIdentifier validName = sname; String rule = sname.getType().name();
public DBIdentifier makeIdentifierValid(DBIdentifier sname, NameSet set, int maxLen, boolean checkForUniqueness) { DBIdentifier validName = sname; String rule = sname.getType().name();
public DBIdentifier makeIdentifierValid(DBIdentifier sname, NameSet set, int maxLen, boolean checkForUniqueness) { DBIdentifier validName = sname; String rule = sname.getType().name();
/** * Constructs a new identifier (potentially a compound QualifiedDBIdentifier) with the provided * name an type. Optionally, converting the name to upper case and delimiting it. */ protected static DBIdentifier newIdentifier(String name, DBIdentifierType id, boolean toUpper, boolean delimit, boolean ignoreCase) { if (name == null) { return DBIdentifier.NULL; } DBIdentifier dbId = DBIdentifier.NULL; // Create a DBIDentifier for single component names. Otherwise, create a QualifiedDBIdentifier. if (!_compoundIdentifier[id.ordinal()] || delimit) { dbId = new DBIdentifier(name, id, delimit); dbId.setIgnoreCase(ignoreCase); if (toUpper) { return toUpper(dbId); } } else { // Name can be split. Break it up into components and return a path DBIdentifier[] sNames = DBIdentifier.split(id, name); dbId = new QualifiedDBIdentifier(sNames); dbId.setIgnoreCase(ignoreCase); } return dbId; }
public String delimit(DBIdentifier name, boolean force) { String rule = name.getType().name(); // If this is a compound path, each item must be delimited // separately if (name instanceof QualifiedDBIdentifier) { QualifiedDBIdentifier path = (QualifiedDBIdentifier)name; // Make sure this is a qualified path before delimiting // separately if (!((path.getType() == DBIdentifierType.COLUMN && path.isUnqualifiedColumn()) || (path.getType() != DBIdentifierType.COLUMN && path.isUnqualifiedObject()))) { DBIdentifier[] names = QualifiedDBIdentifier.splitPath(name); for (int i = 0; i < names.length; i++) { DBIdentifier sName = names[i].getUnqualifiedName(); if (!sName.isDelimited()) { String pRule = sName.getType().name(); names[i].setName(delimit(pRule, sName.getName(), force)); } } return QualifiedDBIdentifier.newPath(names).getName(); } } return delimit(rule, name.getName(), force); }
/** * Constructs a new identifier (potentially a compound QualifiedDBIdentifier) with the provided * name an type. Optionally, converting the name to upper case and delimiting it. */ protected static DBIdentifier newIdentifier(String name, DBIdentifierType id, boolean toUpper, boolean delimit, boolean ignoreCase) { if (name == null) { return DBIdentifier.NULL; } DBIdentifier dbId = DBIdentifier.NULL; // Create a DBIDentifier for single component names. Otherwise, create a QualifiedDBIdentifier. if (!_compoundIdentifier[id.ordinal()] || delimit) { dbId = new DBIdentifier(name, id, delimit); dbId.setIgnoreCase(ignoreCase); if (toUpper) { return toUpper(dbId); } } else { // Name can be split. Break it up into components and return a path DBIdentifier[] sNames = DBIdentifier.split(id, name); dbId = new QualifiedDBIdentifier(sNames); dbId.setIgnoreCase(ignoreCase); } return dbId; }
/** * Constructs a new identifier (potentially a compound QualifiedDBIdentifier) with the provided * name an type. Optionally, converting the name to upper case and delimiting it. */ protected static DBIdentifier newIdentifier(String name, DBIdentifierType id, boolean toUpper, boolean delimit, boolean ignoreCase) { if (name == null) { return DBIdentifier.NULL; } DBIdentifier dbId = DBIdentifier.NULL; // Create a DBIDentifier for single component names. Otherwise, create a QualifiedDBIdentifier. if (!_compoundIdentifier[id.ordinal()] || delimit) { dbId = new DBIdentifier(name, id, delimit); dbId.setIgnoreCase(ignoreCase); if (toUpper) { return toUpper(dbId); } } else { // Name can be split. Break it up into components and return a path DBIdentifier[] sNames = DBIdentifier.split(id, name); dbId = new QualifiedDBIdentifier(sNames); dbId.setIgnoreCase(ignoreCase); } return dbId; }
public String delimit(DBIdentifier name, boolean force) { String rule = name.getType().name(); // If this is a compound path, each item must be delimited // separately if (name instanceof QualifiedDBIdentifier) { QualifiedDBIdentifier path = (QualifiedDBIdentifier)name; // Make sure this is a qualified path before delimiting // separately if (!((path.getType() == DBIdentifierType.COLUMN && path.isUnqualifiedColumn()) || (path.getType() != DBIdentifierType.COLUMN && path.isUnqualifiedObject()))) { DBIdentifier[] names = QualifiedDBIdentifier.splitPath(name); for (int i = 0; i < names.length; i++) { DBIdentifier sName = names[i].getUnqualifiedName(); if (!sName.isDelimited()) { String pRule = sName.getType().name(); names[i].setName(delimit(pRule, sName.getName(), force)); } } return QualifiedDBIdentifier.newPath(names).getName(); } } return delimit(rule, name.getName(), force); }
public String delimit(DBIdentifier name, boolean force) { String rule = name.getType().name(); // If this is a compound path, each item must be delimited // separately if (name instanceof QualifiedDBIdentifier) { QualifiedDBIdentifier path = (QualifiedDBIdentifier)name; // Make sure this is a qualified path before delimiting // separately if (!((path.getType() == DBIdentifierType.COLUMN && path.isUnqualifiedColumn()) || (path.getType() != DBIdentifierType.COLUMN && path.isUnqualifiedObject()))) { DBIdentifier[] names = QualifiedDBIdentifier.splitPath(name); for (int i = 0; i < names.length; i++) { DBIdentifier sName = names[i].getUnqualifiedName(); if (!sName.isDelimited()) { String pRule = sName.getType().name(); names[i].setName(delimit(pRule, sName.getName(), force)); } } return QualifiedDBIdentifier.newPath(names).getName(); } } return delimit(rule, name.getName(), force); }
/** * Converts the name to a name which can be used within a SQL statement. Uses * the appropriate delimiters and separators. * @parm name a DBIdentifier * @param delimit If true, allows the name to be delimited, if necessary. * Otherwise, the identifier is not delimited. */ public String toDBName(DBIdentifier name, boolean delimit) { if (DBIdentifier.isNull(name)) { return null; } if (getIdentifierConfiguration().getSupportsDelimitedIdentifiers() && delimit && getIdentifierConfiguration().delimitAll() && !name.isDelimited()) { return delimit(name, true); } String rule = name.getType().name(); if (name instanceof QualifiedDBIdentifier) { QualifiedDBIdentifier path = (QualifiedDBIdentifier)name; return convertFull(Normalizer.getNamingConfiguration(), rule, path.getName()); } return convert(Normalizer.getNamingConfiguration(), rule, name.getName()); }
public String delimit(DBIdentifier name, boolean force) { String rule = name.getType().name(); // If this is a compound path, each item must be delimited // separately if (name instanceof QualifiedDBIdentifier) { QualifiedDBIdentifier path = (QualifiedDBIdentifier)name; // Make sure this is a qualified path before delimiting // separately if (!((path.getType() == DBIdentifierType.COLUMN && path.isUnqualifiedColumn()) || (path.getType() != DBIdentifierType.COLUMN && path.isUnqualifiedObject()))) { DBIdentifier[] names = QualifiedDBIdentifier.splitPath(name); for (int i = 0; i < names.length; i++) { DBIdentifier sName = names[i].getUnqualifiedName(); if (!sName.isDelimited()) { String pRule = sName.getType().name(); names[i].setName(delimit(pRule, sName.getName(), force)); } } return QualifiedDBIdentifier.newPath(names).getName(); } } return delimit(rule, name.getName(), force); }
/** * Converts the name to a name which can be used within a SQL statement. Uses * the appropriate delimiters and separators. * @parm name a DBIdentifier * @param delimit If true, allows the name to be delimited, if necessary. * Otherwise, the identifier is not delimited. */ public String toDBName(DBIdentifier name, boolean delimit) { if (DBIdentifier.isNull(name)) { return null; } if (getIdentifierConfiguration().getSupportsDelimitedIdentifiers() && delimit && getIdentifierConfiguration().delimitAll() && !name.isDelimited()) { return delimit(name, true); } String rule = name.getType().name(); if (name instanceof QualifiedDBIdentifier) { QualifiedDBIdentifier path = (QualifiedDBIdentifier)name; return convertFull(Normalizer.getNamingConfiguration(), rule, path.getName()); } return convert(Normalizer.getNamingConfiguration(), rule, name.getName()); }
/** * Constructs a new identifier (potentially a compound QualifiedDBIdentifier) with the provided * name an type. Optionally, converting the name to upper case and delimiting it. */ protected static DBIdentifier newIdentifier(String name, DBIdentifierType id, boolean toUpper, boolean delimit, boolean ignoreCase) { if (name == null) { return DBIdentifier.NULL; } DBIdentifier dbId = DBIdentifier.NULL; // Create a DBIDentifier for single component names. Otherwise, create a QualifiedDBIdentifier. if (!_compoundIdentifier[id.ordinal()] || delimit) { dbId = new DBIdentifier(name, id, delimit); dbId.setIgnoreCase(ignoreCase); if (toUpper) { return toUpper(dbId); } } else { // Name can be split. Break it up into components and return a path DBIdentifier[] sNames = DBIdentifier.split(id, name); dbId = new QualifiedDBIdentifier(sNames); dbId.setIgnoreCase(ignoreCase); } return dbId; }
/** * Converts the name to a name which can be used within a SQL statement. Uses * the appropriate delimiters and separators. * @parm name a DBIdentifier * @param delimit If true, allows the name to be delimited, if necessary. * Otherwise, the identifier is not delimited. */ public String toDBName(DBIdentifier name, boolean delimit) { if (DBIdentifier.isNull(name)) { return null; } if (getIdentifierConfiguration().getSupportsDelimitedIdentifiers() && delimit && getIdentifierConfiguration().delimitAll() && !name.isDelimited()) { return delimit(name, true); } String rule = name.getType().name(); if (name instanceof QualifiedDBIdentifier) { QualifiedDBIdentifier path = (QualifiedDBIdentifier)name; return convertFull(Normalizer.getNamingConfiguration(), rule, path.getName()); } return convert(Normalizer.getNamingConfiguration(), rule, name.getName()); }
/** * Converts the name to a name which can be used within a SQL statement. Uses * the appropriate delimiters and separators. * @parm name a DBIdentifier * @param delimit If true, allows the name to be delimited, if necessary. * Otherwise, the identifier is not delimited. */ public String toDBName(DBIdentifier name, boolean delimit) { if (DBIdentifier.isNull(name)) { return null; } if (getIdentifierConfiguration().getSupportsDelimitedIdentifiers() && delimit && getIdentifierConfiguration().delimitAll() && !name.isDelimited()) { return delimit(name, true); } String rule = name.getType().name(); if (name instanceof QualifiedDBIdentifier) { QualifiedDBIdentifier path = (QualifiedDBIdentifier)name; return convertFull(Normalizer.getNamingConfiguration(), rule, path.getName()); } return convert(Normalizer.getNamingConfiguration(), rule, name.getName()); }
public IdentifierRule getDefaultIdentifierRule() { if (defaultNamingRule == null) { defaultNamingRule = namingRules.get(DBIdentifierType.DEFAULT.name()); } return defaultNamingRule; }
public DBIdentifier getValidTableIdentifier(DBIdentifier name, Schema schema, int maxLen) { if (DBIdentifier.isNull(name)) { return name; } String rule = name.getType().name(); maxLen = getMaxLen(rule, name, maxLen); DBIdentifier sName = makeName(rule, name, null); return makeIdentifierValid(sName, schema.getSchemaGroup(), maxLen, true); }
public DBIdentifier getValidColumnIdentifier(DBIdentifier name, Table table, int maxLen, boolean checkForUniqueness) { if (DBIdentifier.isNull(name)) { return name; } String rule = name.getType().name(); maxLen = getMaxLen(rule, name, maxLen); DBIdentifier sName = DBIdentifier.removeLeading(name, IdentifierUtil.UNDERSCORE); return makeIdentifierValid(sName, table, maxLen, checkForUniqueness); }
public DBIdentifier getValidSequenceIdentifier(DBIdentifier name, Schema schema, int maxLen) { if (DBIdentifier.isNull(name)) { return name; } String rule = name.getType().name(); maxLen = getMaxLen(rule, name, maxLen); DBIdentifier sName = makeName(rule, name, "S"); return makeIdentifierValid(sName, schema.getSchemaGroup(), maxLen, true); }