Package org.hibernate.dialect.function
Class CommonFunctionFactory
- java.lang.Object
-
- org.hibernate.dialect.function.CommonFunctionFactory
-
public class CommonFunctionFactory extends Object
Enumeratoes common function template definitions. Centralized for easier use from dialects.
-
-
Constructor Summary
Constructors Constructor Description CommonFunctionFactory(QueryEngine queryEngine)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadddateSubdateAddtimeSubtime()MySQL stylevoidaddMonths()voidaddYearsMonthsDaysHoursMinutesSeconds()voidaggregates(Dialect dialect, SqlAstNodeRenderingMode inferenceArgumentRenderingMode)voidascii()voidatan2_atn2()Transact-SQL atan2 is misspelledvoidavg_castingNonDoubleArguments(Dialect dialect, SqlAstNodeRenderingMode inferenceArgumentRenderingMode)voidbitand()voidbitAndOr()These are aggregate functions taking one argument!voidbitandorxornot_binAndOrXorNot()Bitwise operators, not aggregate functions!voidbitandorxornot_bitAndOrXorNot()Binary bitwise operators, not aggregate functions!voidbitandorxornot_operator()Binary bitwise operators, not aggregate functions!voidbitLength()voidbitLength_pattern(String pattern)voidbitLength_pattern(String pattern, String clobPattern)voidbitnot()voidbitor()voidbitxor()voidcbrt()voidceiling_ceil()voidchar_chr()voidcharacterLength_len()Transact SQL-stylevoidcharacterLength_length(String clobPattern)voidcharacterLength_length(SqlAstNodeRenderingMode argumentRenderingMode)Oracle-stylevoidchr_char()voidcoalesce()voidcoalesce_value()SAP DBvoidcollate()Use the 'collate' operator which exists on at least Postgres, MySQL, Oracle, and SQL Servervoidcollate_quoted()HSQL requires quotes around certain collationsvoidconcat()voidconcat_pipeOperator()Almost every databasevoidconcat_pipeOperator(String clobPattern)voidcorr()voidcosh()voidcot()voidcovarPopSamp()voidcrc32()voidcurrentUtcdatetimetimestamp()voiddate()voiddatediff()MySQL style, returns the number of days between two datesvoiddatepartDatename()Transact SQL-stylevoiddateTimeTimestamp()voiddateTrunc()voiddaynameMonthname()voiddayofweekmonthyear()voiddayOfWeekMonthYear()voiddaysBetween()voiddegrees()voideveryAny()These are aggregate functions taking one argument!voideveryAny_boolAndOr()These are aggregate functions taking one argument, for databases that can directly aggregate both boolean columns and predicates!voideveryAny_minMaxCase()These are aggregate functions taking one argument, for Oracle and Sybase.voideveryAny_minMaxIif()These are aggregate functions taking one argument, for SQL Server.voideveryAny_sumCase()These are aggregate functions taking one argument, for databases that have to emulate the boolean aggregation functions using sum() and case.voidformat_dateFormat()MySQL-style (also Ingres)voidformat_formatdatetime()H2-style (uses Java's SimpleDateFormat directly so no need to translate format)voidformat_toChar()Usually Oracle-style (except for Informix which quite close to MySQL-style)voidformat_toVarchar()HANA's name for to_char() is still Oracle-stylevoidhourMinuteSecond()Note that we include these for completeness, but since their names collide with the HQL abbreviations for extract(), they can't actually be called from HQL.voidhypotheticalOrderedSetAggregates()voidhypotheticalOrderedSetAggregates_windowEmulation()voidinitcap()voidinsert()voidinsert_overlay()Postgresvoidinstr()voidinverseDistributionOrderedSetAggregates()voidinverseDistributionOrderedSetAggregates_windowEmulation()voidlastDay()voidlastDay_eomonth()voidleastGreatest()voidleastGreatest_minMax()voidleastGreatest_minMaxValue()voidleftRight()voidleftRight_substr()voidleftRight_substrLength()voidlength_characterLength()ANSI SQL-stylevoidlength_characterLength_pattern(String clobPattern)voidlistagg(String emptyWithinReplacement)voidlistagg_groupConcat()voidlistagg_list(String stringType)voidlistagg_stringAgg(String stringType)voidlistagg_stringAggWithinGroup(String stringType)voidln_log()voidlocaltimeLocaltimestamp()voidlocate()voidlocate_charindex()Transact SQL-stylevoidlocate_positionSubstring()locate() in terms of ANSI position() and substring()voidlog()voidlog10()voidlog10_log()For Oracle and HANAvoidlog2()voidlowerUpper()voidmakedateMaketime()MySQL/CUBRIDvoidmakeDateTimeTimestamp()Postgresvoidmath()voidmd5()voidmedian()voidmedian_percentileCont(boolean over)voidmedian_percentileCont_castDouble()CockroachDB lacks implicit casting: https://github.com/cockroachdb/cockroach/issues/89965voidmod_operator()voidmonthsBetween()voidmoreHyperbolic()voidnowCurdateCurtime()voidnullif()voidoctetLength()voidoctetLength_pattern(String pattern)voidoctetLength_pattern(String pattern, String clobPattern)voidoverlay()ANSI SQL form, supported by Postgres, HSQLvoidoverlayCharacterLength_overlay()For DB2 which has a broken implementation of overlay()voidpad()voidpad_fill()SAP DBvoidpad_repeat()voidpad_replicate()Transact-SQLvoidpad_space()In MySQL the third argument is requiredvoidpi()voidposition()ANSI-stylevoidpower_expLn()voidradians()voidrand()Returns double between 0.0 and 1.0.voidregrLinearRegressionAggregates()voidrepeat()voidrepeat_replicate()voidreplace()voidreplace_strReplace()Sybasevoidreverse()voidround_floor()voidrownum()H2/HSQL-stylevoidrownumInstOrderbyGroupbyNum()CUBRIDvoidrownumRowid()Oracle-stylevoidsecondsBetween()voidsha()voidsha1()voidsha2()voidsinh()voidsoundex()voidspace()voidsquare()voidstddev()Warning: the semantics of this function are inconsistent between DBs.voidstddevPopSamp()voidstddevPopSamp_stdevp()SQL Server-stylevoidstdevVarianceSamp()DB2voidsubstr()voidsubstring()Not the same as ANSI-style substring!voidsubstring_substr()Oracle, and many othersvoidsubstring_substringLen()Transact SQL-style (3 required args)voidsubstringFromFor()ANSI-style substringvoidsysdate()voidsysdateExplicitMicros()MySQL 5.7 precision defaults to seconds, but microseconds is bettervoidsysdateParens()MySQL requires the parens in sysdate()voidsystimestamp()voidtanh()voidtime()voidtimestamp()voidtoCharNumberDateTimestamp()voidtranslate()voidtrigonometry()voidtrim1()voidtrim2()voidtrunc()voidtruncate()voidtruncate_round()SQL ServervoidutcDateTimeTimestamp()voidvariance()Warning: the semantics of this function are inconsistent between DBs.voidvarPopSamp()voidvarPopSamp_varp()SQL Server-stylevoidweek_weekofyear()voidweekQuarter()voidwindowFunctions()voidyearMonthDay()Note that we include these for completeness, but since their names collide with the HQL abbreviations for extract(), they can't actually be called from HQL.voidyearsMonthsDaysHoursMinutesSecondsBetween()
-
-
-
Constructor Detail
-
CommonFunctionFactory
public CommonFunctionFactory(QueryEngine queryEngine)
-
-
Method Detail
-
cosh
public void cosh()
-
cot
public void cot()
-
degrees
public void degrees()
-
log
public void log()
-
ln_log
public void ln_log()
-
log10
public void log10()
-
log10_log
public void log10_log()
For Oracle and HANA
-
log2
public void log2()
-
radians
public void radians()
-
sinh
public void sinh()
-
tanh
public void tanh()
-
moreHyperbolic
public void moreHyperbolic()
-
trunc
public void trunc()
-
truncate
public void truncate()
-
truncate_round
public void truncate_round()
SQL Server
-
rand
public void rand()
Returns double between 0.0 and 1.0. First call may specify a seed value.
-
median
public void median()
-
median_percentileCont
public void median_percentileCont(boolean over)
-
median_percentileCont_castDouble
public void median_percentileCont_castDouble()
CockroachDB lacks implicit casting: https://github.com/cockroachdb/cockroach/issues/89965
-
stddev
public void stddev()
Warning: the semantics of this function are inconsistent between DBs. - On Postgres it means stdev_samp() - On Oracle, DB2, MySQL it means stdev_pop()
-
variance
public void variance()
Warning: the semantics of this function are inconsistent between DBs. - On Postgres it means var_samp() - On Oracle, DB2, MySQL it means var_pop()
-
stddevPopSamp
public void stddevPopSamp()
-
varPopSamp
public void varPopSamp()
-
covarPopSamp
public void covarPopSamp()
-
corr
public void corr()
-
regrLinearRegressionAggregates
public void regrLinearRegressionAggregates()
-
stdevVarianceSamp
public void stdevVarianceSamp()
DB2
-
stddevPopSamp_stdevp
public void stddevPopSamp_stdevp()
SQL Server-style
-
varPopSamp_varp
public void varPopSamp_varp()
SQL Server-style
-
pi
public void pi()
-
soundex
public void soundex()
-
trim2
public void trim2()
-
trim1
public void trim1()
-
pad
public void pad()
-
pad_space
public void pad_space()
In MySQL the third argument is required
-
pad_replicate
public void pad_replicate()
Transact-SQL
-
pad_repeat
public void pad_repeat()
-
pad_fill
public void pad_fill()
SAP DB
-
reverse
public void reverse()
-
space
public void space()
-
repeat
public void repeat()
-
leftRight
public void leftRight()
-
leftRight_substr
public void leftRight_substr()
-
leftRight_substrLength
public void leftRight_substrLength()
-
repeat_replicate
public void repeat_replicate()
-
md5
public void md5()
-
initcap
public void initcap()
-
instr
public void instr()
-
substr
public void substr()
-
translate
public void translate()
-
bitand
public void bitand()
-
bitor
public void bitor()
-
bitxor
public void bitxor()
-
bitnot
public void bitnot()
-
bitandorxornot_bitAndOrXorNot
public void bitandorxornot_bitAndOrXorNot()
Binary bitwise operators, not aggregate functions!
-
bitandorxornot_binAndOrXorNot
public void bitandorxornot_binAndOrXorNot()
Bitwise operators, not aggregate functions!
-
bitandorxornot_operator
public void bitandorxornot_operator()
Binary bitwise operators, not aggregate functions!
-
bitAndOr
public void bitAndOr()
These are aggregate functions taking one argument!
-
everyAny
public void everyAny()
These are aggregate functions taking one argument!
-
everyAny_boolAndOr
public void everyAny_boolAndOr()
These are aggregate functions taking one argument, for databases that can directly aggregate both boolean columns and predicates!
-
everyAny_sumCase
public void everyAny_sumCase()
These are aggregate functions taking one argument, for databases that have to emulate the boolean aggregation functions using sum() and case.
-
everyAny_minMaxIif
public void everyAny_minMaxIif()
These are aggregate functions taking one argument, for SQL Server.
-
everyAny_minMaxCase
public void everyAny_minMaxCase()
These are aggregate functions taking one argument, for Oracle and Sybase.
-
yearMonthDay
public void yearMonthDay()
Note that we include these for completeness, but since their names collide with the HQL abbreviations for extract(), they can't actually be called from HQL.
-
hourMinuteSecond
public void hourMinuteSecond()
Note that we include these for completeness, but since their names collide with the HQL abbreviations for extract(), they can't actually be called from HQL.
-
dayofweekmonthyear
public void dayofweekmonthyear()
-
dayOfWeekMonthYear
public void dayOfWeekMonthYear()
-
daynameMonthname
public void daynameMonthname()
-
weekQuarter
public void weekQuarter()
-
lastDay
public void lastDay()
-
lastDay_eomonth
public void lastDay_eomonth()
-
ceiling_ceil
public void ceiling_ceil()
-
toCharNumberDateTimestamp
public void toCharNumberDateTimestamp()
-
dateTimeTimestamp
public void dateTimeTimestamp()
-
timestamp
public void timestamp()
-
time
public void time()
-
date
public void date()
-
utcDateTimeTimestamp
public void utcDateTimeTimestamp()
-
currentUtcdatetimetimestamp
public void currentUtcdatetimetimestamp()
-
week_weekofyear
public void week_weekofyear()
-
concat_pipeOperator
public void concat_pipeOperator()
Almost every database
-
concat_pipeOperator
public void concat_pipeOperator(String clobPattern)
-
rownumRowid
public void rownumRowid()
Oracle-style
-
rownum
public void rownum()
H2/HSQL-style
-
rownumInstOrderbyGroupbyNum
public void rownumInstOrderbyGroupbyNum()
CUBRID
-
makedateMaketime
public void makedateMaketime()
MySQL/CUBRID
-
makeDateTimeTimestamp
public void makeDateTimeTimestamp()
Postgres
-
sysdate
public void sysdate()
-
sysdateParens
public void sysdateParens()
MySQL requires the parens in sysdate()
-
sysdateExplicitMicros
public void sysdateExplicitMicros()
MySQL 5.7 precision defaults to seconds, but microseconds is better
-
systimestamp
public void systimestamp()
-
localtimeLocaltimestamp
public void localtimeLocaltimestamp()
-
trigonometry
public void trigonometry()
-
atan2_atn2
public void atan2_atn2()
Transact-SQL atan2 is misspelled
-
coalesce
public void coalesce()
-
coalesce_value
public void coalesce_value()
SAP DB
-
nullif
public void nullif()
-
length_characterLength
public void length_characterLength()
ANSI SQL-style
-
length_characterLength_pattern
public void length_characterLength_pattern(String clobPattern)
-
characterLength_len
public void characterLength_len()
Transact SQL-style
-
characterLength_length
public void characterLength_length(SqlAstNodeRenderingMode argumentRenderingMode)
Oracle-style
-
characterLength_length
public void characterLength_length(String clobPattern)
-
octetLength
public void octetLength()
-
octetLength_pattern
public void octetLength_pattern(String pattern)
-
bitLength
public void bitLength()
-
bitLength_pattern
public void bitLength_pattern(String pattern)
-
position
public void position()
ANSI-style
-
locate
public void locate()
-
locate_charindex
public void locate_charindex()
Transact SQL-style
-
locate_positionSubstring
public void locate_positionSubstring()
locate() in terms of ANSI position() and substring()
-
substringFromFor
public void substringFromFor()
ANSI-style substring
-
substring
public void substring()
Not the same as ANSI-style substring!
-
substring_substringLen
public void substring_substringLen()
Transact SQL-style (3 required args)
-
substring_substr
public void substring_substr()
Oracle, and many others
-
insert
public void insert()
-
insert_overlay
public void insert_overlay()
Postgres
-
overlay
public void overlay()
ANSI SQL form, supported by Postgres, HSQL
-
overlayCharacterLength_overlay
public void overlayCharacterLength_overlay()
For DB2 which has a broken implementation of overlay()
-
replace
public void replace()
-
replace_strReplace
public void replace_strReplace()
Sybase
-
concat
public void concat()
-
lowerUpper
public void lowerUpper()
-
ascii
public void ascii()
-
char_chr
public void char_chr()
-
chr_char
public void chr_char()
-
datepartDatename
public void datepartDatename()
Transact SQL-style
-
nowCurdateCurtime
public void nowCurdateCurtime()
-
leastGreatest
public void leastGreatest()
-
leastGreatest_minMax
public void leastGreatest_minMax()
-
leastGreatest_minMaxValue
public void leastGreatest_minMaxValue()
-
aggregates
public void aggregates(Dialect dialect, SqlAstNodeRenderingMode inferenceArgumentRenderingMode)
-
avg_castingNonDoubleArguments
public void avg_castingNonDoubleArguments(Dialect dialect, SqlAstNodeRenderingMode inferenceArgumentRenderingMode)
-
listagg
public void listagg(String emptyWithinReplacement)
-
listagg_groupConcat
public void listagg_groupConcat()
-
listagg_list
public void listagg_list(String stringType)
-
listagg_stringAgg
public void listagg_stringAgg(String stringType)
-
listagg_stringAggWithinGroup
public void listagg_stringAggWithinGroup(String stringType)
-
inverseDistributionOrderedSetAggregates
public void inverseDistributionOrderedSetAggregates()
-
inverseDistributionOrderedSetAggregates_windowEmulation
public void inverseDistributionOrderedSetAggregates_windowEmulation()
-
hypotheticalOrderedSetAggregates
public void hypotheticalOrderedSetAggregates()
-
hypotheticalOrderedSetAggregates_windowEmulation
public void hypotheticalOrderedSetAggregates_windowEmulation()
-
windowFunctions
public void windowFunctions()
-
math
public void math()
-
mod_operator
public void mod_operator()
-
power_expLn
public void power_expLn()
-
round_floor
public void round_floor()
-
square
public void square()
-
cbrt
public void cbrt()
-
crc32
public void crc32()
-
sha1
public void sha1()
-
sha2
public void sha2()
-
sha
public void sha()
-
datediff
public void datediff()
MySQL style, returns the number of days between two dates
-
adddateSubdateAddtimeSubtime
public void adddateSubdateAddtimeSubtime()
MySQL style
-
addMonths
public void addMonths()
-
monthsBetween
public void monthsBetween()
-
daysBetween
public void daysBetween()
-
secondsBetween
public void secondsBetween()
-
yearsMonthsDaysHoursMinutesSecondsBetween
public void yearsMonthsDaysHoursMinutesSecondsBetween()
-
addYearsMonthsDaysHoursMinutesSeconds
public void addYearsMonthsDaysHoursMinutesSeconds()
-
format_formatdatetime
public void format_formatdatetime()
H2-style (uses Java's SimpleDateFormat directly so no need to translate format)
-
format_toChar
public void format_toChar()
Usually Oracle-style (except for Informix which quite close to MySQL-style)
-
format_dateFormat
public void format_dateFormat()
MySQL-style (also Ingres)
-
format_toVarchar
public void format_toVarchar()
HANA's name for to_char() is still Oracle-style
-
collate
public void collate()
Use the 'collate' operator which exists on at least Postgres, MySQL, Oracle, and SQL Server
-
collate_quoted
public void collate_quoted()
HSQL requires quotes around certain collations
-
dateTrunc
public void dateTrunc()
-
-