Package org.postgresql.jdbc
Class EscapedFunctions2
java.lang.Object
org.postgresql.jdbc.EscapedFunctions2
This class stores supported escaped function.
Note: this is a pgjdbc-internal class, so it is not supposed to be used outside of the driver.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ConcurrentMap<String, Method> storage for functions implementationsprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidappendCall(StringBuilder sb, String begin, String separator, String end, List<? extends CharSequence> args) Appendsbegin arg0 separator arg1 separator endsequence to the inputStringBuilderprivate static voidappendInterval(StringBuilder buf, String type, String value) private static booleanappendSingleIntervalCast(StringBuilder buf, String cmp, String type, String value, String pgType) private static booleanareSameTsi(String a, String b) Compares two TSI intervals.private static StringconstantToDatePart(String type) private static ConcurrentMap<String, Method> createFunctionMap(String prefix) static MethodgetFunction(String functionName) get Method object implementing the given functionprivate static booleanChecks if given input starts withSQL_TSI_ROOTprivate static voidsingleArgumentFunctionCall(StringBuilder buf, String call, String functionName, List<? extends CharSequence> parsedArgs) static voidsqlceiling(StringBuilder buf, List<? extends CharSequence> parsedArgs) ceiling to ceil translationstatic voidsqlchar(StringBuilder buf, List<? extends CharSequence> parsedArgs) char to chr translationstatic voidsqlconcat(StringBuilder buf, List<? extends CharSequence> parsedArgs) concat translationstatic voidsqlcurdate(StringBuilder buf, List<? extends CharSequence> parsedArgs) curdate to current_date translationstatic voidsqlcurtime(StringBuilder buf, List<? extends CharSequence> parsedArgs) curtime to current_time translationstatic voidsqldatabase(StringBuilder buf, List<? extends CharSequence> parsedArgs) database translationstatic voidsqldayname(StringBuilder buf, List<? extends CharSequence> parsedArgs) dayname translationstatic voidsqldayofmonth(StringBuilder buf, List<? extends CharSequence> parsedArgs) dayofmonth translationstatic voidsqldayofweek(StringBuilder buf, List<? extends CharSequence> parsedArgs) dayofweek translation adding 1 to postgresql function since we expect values from 1 to 7static voidsqldayofyear(StringBuilder buf, List<? extends CharSequence> parsedArgs) dayofyear translationstatic voidsqlhour(StringBuilder buf, List<? extends CharSequence> parsedArgs) hour translationstatic voidsqlifnull(StringBuilder buf, List<? extends CharSequence> parsedArgs) ifnull translationstatic voidsqlinsert(StringBuilder buf, List<? extends CharSequence> parsedArgs) insert to overlay translationstatic voidsqllcase(StringBuilder buf, List<? extends CharSequence> parsedArgs) lcase to lower translationstatic voidsqlleft(StringBuilder buf, List<? extends CharSequence> parsedArgs) left to substring translationstatic voidsqllength(StringBuilder buf, List<? extends CharSequence> parsedArgs) length translationstatic voidsqllocate(StringBuilder buf, List<? extends CharSequence> parsedArgs) locate translationstatic voidsqllog(StringBuilder buf, List<? extends CharSequence> parsedArgs) log to ln translationstatic voidsqllog10(StringBuilder buf, List<? extends CharSequence> parsedArgs) log10 to log translationstatic voidsqlltrim(StringBuilder buf, List<? extends CharSequence> parsedArgs) ltrim translationstatic voidsqlminute(StringBuilder buf, List<? extends CharSequence> parsedArgs) minute translationstatic voidsqlmonth(StringBuilder buf, List<? extends CharSequence> parsedArgs) month translationstatic voidsqlmonthname(StringBuilder buf, List<? extends CharSequence> parsedArgs) monthname translationstatic voidsqlpower(StringBuilder buf, List<? extends CharSequence> parsedArgs) power to pow translationstatic voidsqlquarter(StringBuilder buf, List<? extends CharSequence> parsedArgs) quarter translationstatic voidsqlright(StringBuilder buf, List<? extends CharSequence> parsedArgs) right to substring translationstatic voidsqlrtrim(StringBuilder buf, List<? extends CharSequence> parsedArgs) rtrim translationstatic voidsqlsecond(StringBuilder buf, List<? extends CharSequence> parsedArgs) second translationstatic voidsqlspace(StringBuilder buf, List<? extends CharSequence> parsedArgs) space translationstatic voidsqlsubstring(StringBuilder buf, List<? extends CharSequence> parsedArgs) substring to substr translationstatic voidsqltimestampadd(StringBuilder buf, List<? extends CharSequence> parsedArgs) time stamp addstatic voidsqltimestampdiff(StringBuilder buf, List<? extends CharSequence> parsedArgs) time stamp diffstatic voidsqltruncate(StringBuilder buf, List<? extends CharSequence> parsedArgs) truncate to trunc translationstatic voidsqlucase(StringBuilder buf, List<? extends CharSequence> parsedArgs) ucase to upper translationstatic voidsqluser(StringBuilder buf, List<? extends CharSequence> parsedArgs) user translationstatic voidsqlweek(StringBuilder buf, List<? extends CharSequence> parsedArgs) week translationstatic voidsqlyear(StringBuilder buf, List<? extends CharSequence> parsedArgs) year translationprivate static voidtwoArgumentsFunctionCall(StringBuilder buf, String call, String functionName, List<? extends CharSequence> parsedArgs) private static voidzeroArgumentFunctionCall(StringBuilder buf, String call, String functionName, List<? extends CharSequence> parsedArgs)
-
Field Details
-
SQL_TSI_ROOT
- See Also:
-
SQL_TSI_DAY
- See Also:
-
SQL_TSI_FRAC_SECOND
- See Also:
-
SQL_TSI_HOUR
- See Also:
-
SQL_TSI_MINUTE
- See Also:
-
SQL_TSI_MONTH
- See Also:
-
SQL_TSI_QUARTER
- See Also:
-
SQL_TSI_SECOND
- See Also:
-
SQL_TSI_WEEK
- See Also:
-
SQL_TSI_YEAR
- See Also:
-
FUNCTION_MAP
storage for functions implementations
-
-
Constructor Details
-
EscapedFunctions2
public EscapedFunctions2()
-
-
Method Details
-
createFunctionMap
-
getFunction
get Method object implementing the given function- Parameters:
functionName- name of the searched function- Returns:
- a Method object or null if not found
-
sqlceiling
public static void sqlceiling(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException ceiling to ceil translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqllog
public static void sqllog(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException log to ln translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqllog10
public static void sqllog10(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException log10 to log translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqlpower
public static void sqlpower(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException power to pow translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqltruncate
public static void sqltruncate(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException truncate to trunc translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqlchar
public static void sqlchar(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException char to chr translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqlconcat
concat translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments
-
sqlinsert
public static void sqlinsert(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException insert to overlay translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqllcase
public static void sqllcase(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException lcase to lower translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqlleft
public static void sqlleft(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException left to substring translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqllength
public static void sqllength(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException length translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqllocate
public static void sqllocate(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException locate translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqlltrim
public static void sqlltrim(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException ltrim translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqlright
public static void sqlright(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException right to substring translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqlrtrim
public static void sqlrtrim(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException rtrim translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqlspace
public static void sqlspace(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException space translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqlsubstring
public static void sqlsubstring(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException substring to substr translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqlucase
public static void sqlucase(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException ucase to upper translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqlcurdate
public static void sqlcurdate(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException curdate to current_date translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqlcurtime
public static void sqlcurtime(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException curtime to current_time translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqldayname
public static void sqldayname(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException dayname translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqldayofmonth
public static void sqldayofmonth(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException dayofmonth translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqldayofweek
public static void sqldayofweek(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException dayofweek translation adding 1 to postgresql function since we expect values from 1 to 7- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqldayofyear
public static void sqldayofyear(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException dayofyear translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqlhour
public static void sqlhour(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException hour translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqlminute
public static void sqlminute(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException minute translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqlmonth
public static void sqlmonth(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException month translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqlmonthname
public static void sqlmonthname(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException monthname translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqlquarter
public static void sqlquarter(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException quarter translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqlsecond
public static void sqlsecond(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException second translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqlweek
public static void sqlweek(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException week translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqlyear
public static void sqlyear(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException year translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqltimestampadd
public static void sqltimestampadd(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException time stamp add- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
appendInterval
private static void appendInterval(StringBuilder buf, String type, String value) throws SQLException - Throws:
SQLException
-
appendSingleIntervalCast
private static boolean appendSingleIntervalCast(StringBuilder buf, String cmp, String type, String value, String pgType) -
areSameTsi
Compares two TSI intervals. It is- Parameters:
a- first interval to compareb- second interval to compare- Returns:
- true when both intervals are equal (case insensitive)
-
isTsi
Checks if given input starts withSQL_TSI_ROOT- Parameters:
interval- input string- Returns:
- true if interval.startsWithIgnoreCase(SQL_TSI_ROOT)
-
sqltimestampdiff
public static void sqltimestampdiff(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException time stamp diff- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
constantToDatePart
- Throws:
SQLException
-
sqldatabase
public static void sqldatabase(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException database translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqlifnull
public static void sqlifnull(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException ifnull translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
sqluser
public static void sqluser(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException user translation- Parameters:
buf- The buffer to append intoparsedArgs- arguments- Throws:
SQLException- if something wrong happens
-
zeroArgumentFunctionCall
private static void zeroArgumentFunctionCall(StringBuilder buf, String call, String functionName, List<? extends CharSequence> parsedArgs) throws PSQLException - Throws:
PSQLException
-
singleArgumentFunctionCall
private static void singleArgumentFunctionCall(StringBuilder buf, String call, String functionName, List<? extends CharSequence> parsedArgs) throws PSQLException - Throws:
PSQLException
-
twoArgumentsFunctionCall
private static void twoArgumentsFunctionCall(StringBuilder buf, String call, String functionName, List<? extends CharSequence> parsedArgs) throws PSQLException - Throws:
PSQLException
-
appendCall
public static void appendCall(StringBuilder sb, String begin, String separator, String end, List<? extends CharSequence> args) Appendsbegin arg0 separator arg1 separator endsequence to the inputStringBuilder- Parameters:
sb- destination StringBuilderbegin- begin stringseparator- separator stringend- end stringargs- arguments
-