/** * Overwrite the user name. The user name is case-insensitive and stored in * uppercase. English conversion is used. * * @param name the user name */ public void setUserName(String name) { this.user = StringUtils.toUpperEnglish(name); }
/** * Check if a given string is a valid date part string. * * @param part * the string * @return true if it is */ public static boolean isDatePart(String part) { return DATE_PART.containsKey(StringUtils.toUpperEnglish(part)); }
/** * Set the query string. * * @param query the query string */ public void setQuery(String query) { if (!Objects.equals(this.query, query)) { this.query = query; this.queryUpper = StringUtils.toUpperEnglish(query); } }
/** * Get the mode with the given name. * * @param name the name of the mode * @return the mode object */ public static Mode getInstance(String name) { return MODES.get(StringUtils.toUpperEnglish(name)); }
private static void add(Mode mode) { MODES.put(StringUtils.toUpperEnglish(mode.name), mode); }
private static String toUpper(Object key) { return key == null ? null : StringUtils.toUpperEnglish(key.toString()); }
private static String toUpper(Object key) { return key == null ? NULL : StringUtils.toUpperEnglish(key.toString()); }
private String convertColumnName(String columnName) { if ((storesMixedCase || storesLowerCase) && columnName.equals(StringUtils.toLowerEnglish(columnName))) { columnName = StringUtils.toUpperEnglish(columnName); } else if (storesMixedCase && !supportsMixedCaseIdentifiers) { // TeraData columnName = StringUtils.toUpperEnglish(columnName); } else if (storesMixedCase && storesMixedCaseQuoted) { // MS SQL Server (identifiers are case insensitive even if quoted) columnName = StringUtils.toUpperEnglish(columnName); } return columnName; }
private String parseDatabaseShortName() { String n = databaseName; if (n.endsWith(":")) { n = null; } if (n != null) { StringTokenizer tokenizer = new StringTokenizer(n, "/\\:,;"); while (tokenizer.hasMoreTokens()) { n = tokenizer.nextToken(); } } if (n == null || n.length() == 0) { n = "unnamed"; } return dbSettings.databaseToUpper ? StringUtils.toUpperEnglish(n) : n; }
public RuleElement(String name, String topic) { this.name = name; this.keyword = name.length() == 1 || name.equals(StringUtils.toUpperEnglish(name)); topic = StringUtils.toLowerEnglish(topic); this.type = topic.startsWith("function") ? Sentence.FUNCTION : Sentence.KEYWORD; }
private AggregateType getAggregateType(String name) { if (!identifiersToUpper) { // if not yet converted to uppercase, do it now name = StringUtils.toUpperEnglish(name); } return Aggregate.getAggregateType(name); }
private static int getDatePart(String part) { Integer p = DATE_PART.get(StringUtils.toUpperEnglish(part)); if (p == null) { throw DbException.getInvalidValueException("date part", part); } return p.intValue(); }
private boolean isKeyword(String s) { if (!identifiersToUpper) { // if not yet converted to uppercase, do it now s = StringUtils.toUpperEnglish(s); } return ParserUtil.isKeyword(s); }
/** * Get the collation name. * * @param l the locale * @return the name of the collation */ public static String getName(Locale l) { Locale english = Locale.ENGLISH; String name = l.getDisplayLanguage(english) + ' ' + l.getDisplayCountry(english) + ' ' + l.getVariant(); name = StringUtils.toUpperEnglish(name.trim().replace(' ', '_')); return name; }
/** * INTERNAL */ public static int getCompressAlgorithm(String algorithm) { algorithm = StringUtils.toUpperEnglish(algorithm); if ("NO".equals(algorithm)) { return Compressor.NO; } else if ("LZF".equals(algorithm)) { return Compressor.LZF; } else if ("DEFLATE".equals(algorithm)) { return Compressor.DEFLATE; } else { throw DbException.get( ErrorCode.UNSUPPORTED_COMPRESSION_ALGORITHM_1, algorithm); } }
/** * Add double quotes around an identifier if required. * For the H2 database, all identifiers are quoted. * * @param identifier the identifier * @return the quoted identifier */ public String quoteIdentifier(String identifier) { if (identifier == null) { return null; } if (isH2 && !isH2ModeMySQL) { return Parser.quoteIdentifier(identifier); } return StringUtils.toUpperEnglish(identifier); }
private int getTokenType(String s) { int len = s.length(); if (len == 0) { throw getSyntaxError(); } if (!identifiersToUpper) { // if not yet converted to uppercase, do it now s = StringUtils.toUpperEnglish(s); } return getSaveTokenType(s, false); }
DbSchema(DbContents contents, String name, boolean isDefault) { this.contents = contents; this.name = name; this.quotedName = contents.quoteIdentifier(name); this.isDefault = isDefault; if (name == null) { // firebird isSystem = true; } else if ("INFORMATION_SCHEMA".equals(name)) { isSystem = true; } else if (!contents.isH2() && StringUtils.toUpperEnglish(name).startsWith("INFO")) { isSystem = true; } else if (contents.isPostgreSQL() && StringUtils.toUpperEnglish(name).startsWith("PG_")) { isSystem = true; } else if (contents.isDerby() && name.startsWith("SYS")) { isSystem = true; } else { isSystem = false; } }
private void readProperties(Properties info) { Object[] list = info.keySet().toArray(); DbSettings s = null; for (Object k : list) { String key = StringUtils.toUpperEnglish(k.toString()); if (prop.containsKey(key)) { throw DbException.get(ErrorCode.DUPLICATE_PROPERTY_1, key); } Object value = info.get(k); if (isKnownSetting(key)) { prop.put(key, value); } else { if (s == null) { s = getDbSettings(); } if (s.containsKey(key)) { prop.put(key, value); } } } }
private ArrayList<Table> getTablesByName(Session session, String tableName) { if (database.getMode().lowerCaseIdentifiers) { tableName = StringUtils.toUpperEnglish(tableName); } ArrayList<Table> tables = database.getTableOrViewByName(tableName); for (Table temp : session.getLocalTempTables()) { if (temp.getName().equals(tableName)) { tables.add(temp); } } return tables; }