Class RDBMSWeekdayOfDateTimeFunction
java.lang.Object
com.kingsrook.qqq.backend.module.rdbms.fieldfunctions.RDBMSWeekdayOfDateTimeFunction
- All Implemented Interfaces:
BackendFieldFunctionAdapterInterface,RDBMSFieldFunctionAdapterInterface,Serializable
public class RDBMSWeekdayOfDateTimeFunction
extends Object
implements RDBMSFieldFunctionAdapterInterface
RDBMS adapter for the
WeekdayOfDateTimeFunction
that generates MySQL-compatible WEEKDAY(CONVERT_TZ(col, ?, ?)) + 1 SQL expressions.
Converts from UTC to the resolved target time zone before extracting the weekday, applying ISO-8601 numbering (Monday=1 … Sunday=7) by adding 1 to MySQL's result.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetParams(FieldFunction fieldFunction) Returns the two CONVERT_TZ bind parameters: the source timezone (always "UTC") and the resolved target timezone (session, instance default, or explicit override).wrapColumnName(String escapedColumnName, FieldFunction fieldFunction, Function<String, String> fieldNameToColumnReference) Returns aWEEKDAY(CONVERT_TZ(col, ?, ?)) + 1expression; the two bind parameters (UTC source zone and target zone) are supplied bygetParams(com.kingsrook.qqq.backend.core.model.metadata.fields.functions.FieldFunction).wrapColumnNameForOrderBy(String escapedColumnName, FieldFunction fieldFunction, Function<String, String> fieldNameToColumnReference) Returns the ORDER BY expression; when sortSundayFirst is true, applies% 7so Sunday (value 7) sorts as 0 before Monday.
-
Constructor Details
-
RDBMSWeekdayOfDateTimeFunction
public RDBMSWeekdayOfDateTimeFunction()
-
-
Method Details
-
wrapColumnName
public String wrapColumnName(String escapedColumnName, FieldFunction fieldFunction, Function<String, String> fieldNameToColumnReference) Returns aWEEKDAY(CONVERT_TZ(col, ?, ?)) + 1expression; the two bind parameters (UTC source zone and target zone) are supplied bygetParams(com.kingsrook.qqq.backend.core.model.metadata.fields.functions.FieldFunction).- Specified by:
wrapColumnNamein interfaceRDBMSFieldFunctionAdapterInterface- Parameters:
escapedColumnName- a fully qualified and escaped SQL column name for the 'main' field that this function works with (e.g.,FieldFunction#withFieldName(String). Looks like:`my_table`.`my_field`.fieldFunction- the function with arguments, being used.fieldNameToColumnReference- resolves a QQQ field name to its fully- qualified escaped SQL column reference (e.g.,"timeZone"→`t1`.`time_zone`). Useful when the function expression needs to reference additional columns on the same row.
-
getParams
Returns the two CONVERT_TZ bind parameters: the source timezone (always "UTC") and the resolved target timezone (session, instance default, or explicit override).- Specified by:
getParamsin interfaceRDBMSFieldFunctionAdapterInterface
-
wrapColumnNameForOrderBy
public String wrapColumnNameForOrderBy(String escapedColumnName, FieldFunction fieldFunction, Function<String, String> fieldNameToColumnReference) Returns the ORDER BY expression; when sortSundayFirst is true, applies% 7so Sunday (value 7) sorts as 0 before Monday.- Specified by:
wrapColumnNameForOrderByin interfaceRDBMSFieldFunctionAdapterInterface
-