Package org.mariadb.jdbc.util
Class NativeSql
java.lang.Object
org.mariadb.jdbc.util.NativeSql
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
private static String
replaceFunctionParameter
(String functionString, Context context) Helper function to replace function parameters in escaped string.private static String
resolveEscapes
(String escaped, Context context)
-
Constructor Details
-
NativeSql
public NativeSql()
-
-
Method Details
-
parse
- Throws:
SQLException
-
resolveEscapes
- Throws:
SQLException
-
replaceFunctionParameter
Helper function to replace function parameters in escaped string. 3 functions are handles :- CONVERT(value, type): replacing SQL_XXX types to convertible type, i.e SQL_BIGINT to INTEGER
- TIMESTAMPDIFF(type, ...): replacing type SQL_TSI_XXX in type with XXX, i.e SQL_TSI_HOUR with HOUR
- TIMESTAMPADD(type, ...): replacing type SQL_TSI_XXX in type with XXX, i.e SQL_TSI_HOUR with HOUR
caution: this use MariaDB server conversion: 'SELECT CONVERT('2147483648', INTEGER)' will return a BIGINT. MySQL will throw a syntax error.
- Parameters:
functionString
- input string- Returns:
- unescaped string
-