All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.databricks.jdbc.commons.util.StringUtil Maven / Gradle / Ivy

There is a newer version: 2.6.40-patch-1
Show newest version
package com.databricks.jdbc.commons.util;

public class StringUtil {
  public static String getProcessedEscapeSequence(String sql) {
    // Replace JDBC escape sequences;
    // TODO : Check if some other escape sequence is required by us.
    sql =
        sql.replaceAll("\\{d '([0-9]{4}-[0-9]{2}-[0-9]{2})'\\}", "DATE '$1'") // DATE
            .replaceAll("\\{t '([0-9]{2}:[0-9]{2}:[0-9]{2})'\\}", "TIME '$1'") // TIME
            .replaceAll(
                "\\{ts '([0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?)'\\}",
                "TIMESTAMP '$1'") // TIMESTAMP
            .replaceAll("\\{fn ([^}]*)\\}", "$1"); // JDBC function escape sequence
    return sql;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy