@Override public boolean matchesJdbcUrl(String jdbcConnectionURL) { return StringUtils.startsWithIgnoreCase(jdbcConnectionURL, "jdbc:oracle:"); }
@Override public boolean matchesJdbcUrl(String jdbcConnectionURL) { return StringUtils.startsWithIgnoreCase(jdbcConnectionURL, "jdbc:sqlserver:"); }
@Override public boolean matchesJdbcUrl(String jdbcConnectionURL) { return StringUtils.startsWithIgnoreCase(jdbcConnectionURL, "jdbc:h2:"); }
@Override public boolean matchesJdbcUrl(String jdbcConnectionURL) { return StringUtils.startsWithIgnoreCase(jdbcConnectionURL, "jdbc:mysql:"); }
@Override public boolean matchesJdbcUrl(String jdbcConnectionURL) { return StringUtils.startsWithIgnoreCase(jdbcConnectionURL, "jdbc:postgresql:"); }
private static boolean startsWithImpl(String str, String prefix, boolean ignoreCase) { return ignoreCase ? StringUtils.startsWithIgnoreCase(str, prefix) : str.startsWith(prefix); } }
public void clearTableMetaWithSchemaName(String schema) { if (tableMetaTSDB != null) { // tsdb不需要做,会基于ddl sql自动清理 } else { for (String name : tableMetaDB.asMap().keySet()) { if (StringUtils.startsWithIgnoreCase(name, schema + ".")) { // removeNames.add(name); tableMetaDB.invalidate(name); } } } }
public boolean apply(EntryPosition position, String schema, String ddl, String extra) { tableMetas.clear(); synchronized (this) { if (StringUtils.isNotEmpty(schema)) { repository.setDefaultSchema(schema); } try { // druid暂时flush privileges语法解析有问题 if (!StringUtils.startsWithIgnoreCase(StringUtils.trim(ddl), "flush") && !StringUtils.startsWithIgnoreCase(StringUtils.trim(ddl), "grant") && !StringUtils.startsWithIgnoreCase(StringUtils.trim(ddl), "create user") && !StringUtils.startsWithIgnoreCase(StringUtils.trim(ddl), "drop user") && !StringUtils.startsWithIgnoreCase(StringUtils.trim(ddl), "create database") && !StringUtils.startsWithIgnoreCase(StringUtils.trim(ddl), "drop database")) { repository.console(ddl); } } catch (Throwable e) { logger.warn("parse faield : " + ddl, e); } } // TableMeta meta = find("tddl5_00", "ab"); // if (meta != null) { // repository.setDefaultSchema("tddl5_00"); // System.out.println(repository.console("show create table tddl5_00.ab")); // System.out.println(repository.console("show columns from tddl5_00.ab")); // } return true; }
@Override public Object resolveEntity(String arg0, String arg1, String fileName, String undeclaredEntity) throws XMLStreamException { // avoid problems with XML docs containing undeclared entities.. return the entity under its raw form if not an unicode expression if (StringUtils.startsWithIgnoreCase(undeclaredEntity, "u") && undeclaredEntity.length() == 5) { int unicodeCharHexValue = Integer.parseInt(undeclaredEntity.substring(1), 16); if (Character.isDefined(unicodeCharHexValue)) { undeclaredEntity = new String(new char[] {(char) unicodeCharHexValue}); } } return undeclaredEntity; } }
return str; if (startsWithIgnoreCase(str, remove)) { return str.substring(remove.length());
public Object doInConnection(Connection c) throws SQLException, DataAccessException { DatabaseMetaData meta = c.getMetaData(); String databaseName = meta.getDatabaseProductName(); String version = meta.getDatabaseProductVersion(); if (StringUtils.startsWithIgnoreCase(databaseName, "oracle")) { return DbType.ORACLE; } else if (StringUtils.startsWithIgnoreCase(databaseName, "mysql")) { if (StringUtils.contains(version, "-TDDL-")) { return DbType.DRDS; } else { return DbType.MYSQL; } } else { throw new YuGongException("unknow database type " + databaseName); } } });
private static int convertSqlType(int columnType, String typeName) { String[] typeSplit = typeName.split(" "); if (typeSplit.length > 1) { if (columnType == Types.INTEGER && StringUtils.equalsIgnoreCase(typeSplit[1], "UNSIGNED")) { columnType = Types.BIGINT; } } if (columnType == Types.OTHER) { if (StringUtils.equalsIgnoreCase(typeName, "NVARCHAR") || StringUtils.equalsIgnoreCase(typeName, "NVARCHAR2")) { columnType = Types.VARCHAR; } if (StringUtils.equalsIgnoreCase(typeName, "NCLOB")) { columnType = Types.CLOB; } if (StringUtils.startsWithIgnoreCase(typeName, "TIMESTAMP")) { columnType = Types.TIMESTAMP; } } return columnType; }
if (clusterIdentifier == null || StringUtils.startsWithIgnoreCase(clusterIdentifier, "localhost") || StringUtils.startsWithIgnoreCase(clusterIdentifier, "0.0.0.0")) { try { clusterIdentifier = InetAddress.getLocalHost().getHostName();
ResultSet rs = null; Table table = null; if (StringUtils.startsWithIgnoreCase(databaseName, "oracle") && StringUtils.isEmpty(schemaName) && StringUtils.isEmpty(tableName)) { String schema = rs.getString(1); String name = rs.getString(2); if (!StringUtils.startsWithIgnoreCase(name, "MLOG$_") && !StringUtils.startsWithIgnoreCase(name, "RUPD$_")) { table = new Table("TABLE", schema, name); result.add(table); String type = rs.getString(4); if (!StringUtils.startsWithIgnoreCase(name, "MLOG$_") && !StringUtils.startsWithIgnoreCase(name, "RUPD$_")) { table = new Table(type, StringUtils.isEmpty(catlog) ? schema : catlog, name); result.add(table);
@Override public void start() { if (providers.length == 0) { return; } String publicRootUrl = server.getPublicRootUrl(); if (StringUtils.startsWithIgnoreCase(publicRootUrl, "http:")) { Loggers.get(getClass()).warn( "For security reasons, OAuth authentication should use HTTPS. You should set the property 'Administration > Configuration > Server base URL' to a HTTPS URL."); } }
public static PathPattern create(String s) { String trimmed = StringUtils.trim(s); if (StringUtils.startsWithIgnoreCase(trimmed, ABSOLUTE_PATH_PATTERN_PREFIX)) { LOG.warn("Using absolute path pattern is deprecated. Please use relative path instead of '" + trimmed + "'"); return new AbsolutePathPattern(StringUtils.substring(trimmed, ABSOLUTE_PATH_PATTERN_PREFIX.length())); } return new RelativePathPattern(trimmed); }
if (StringUtils.startsWithIgnoreCase(detectingSQL.trim(), "select") || StringUtils.startsWithIgnoreCase(detectingSQL.trim(), "show") || StringUtils.startsWithIgnoreCase(detectingSQL.trim(), "explain") || StringUtils.startsWithIgnoreCase(detectingSQL.trim(), "desc")) { mysqlConnection.query(detectingSQL); } else {
String authorization = req.getHeader("Authorization"); if (StringUtils.startsWithIgnoreCase(authorization,"Basic ")) {
public static Optional<Credentials> extractCredentialsFromHeader(HttpServletRequest request) { String authorizationHeader = request.getHeader("Authorization"); if (authorizationHeader == null || !startsWithIgnoreCase(authorizationHeader, "BASIC")) { return Optional.empty(); } String basicAuthEncoded = authorizationHeader.substring(6); String basicAuthDecoded = getDecodedBasicAuth(basicAuthEncoded); int semiColonPos = basicAuthDecoded.indexOf(':'); if (semiColonPos <= 0) { throw AuthenticationException.newBuilder() .setSource(Source.local(Method.BASIC)) .setMessage("Decoded basic auth does not contain ':'") .build(); } String login = basicAuthDecoded.substring(0, semiColonPos); String password = basicAuthDecoded.substring(semiColonPos + 1); return Optional.of(new Credentials(login, password)); }
private Entry parseQueryEvent(QueryLogEvent event, boolean isSeek) { String queryString = event.getQuery(); if (StringUtils.startsWithIgnoreCase(queryString, XA_START)) { Header header = createHeader(event.getHeader(), "", "", null); return createEntry(header, EntryType.TRANSACTIONBEGIN, transactionBegin.toByteString()); } else if (StringUtils.startsWithIgnoreCase(queryString, XA_END)) { Header header = createHeader(event.getHeader(), "", "", null); return createEntry(header, EntryType.TRANSACTIONEND, transactionEnd.toByteString()); } else if (StringUtils.startsWithIgnoreCase(queryString, XA_COMMIT)) { rowChangeBuider.setEventType(EventType.XACOMMIT); return createEntry(header, EntryType.ROWDATA, rowChangeBuider.build().toByteString()); } else if (StringUtils.startsWithIgnoreCase(queryString, XA_ROLLBACK)) {