Class RDBMSWeekdayOfDateFunction
java.lang.Object
com.kingsrook.qqq.backend.module.rdbms.fieldfunctions.RDBMSWeekdayOfDateFunction
- All Implemented Interfaces:
BackendFieldFunctionAdapterInterface,RDBMSFieldFunctionAdapterInterface,Serializable
public class RDBMSWeekdayOfDateFunction
extends Object
implements RDBMSFieldFunctionAdapterInterface
RDBMS adapter for the
WeekdayOfDateFunction that generates
MySQL-compatible WEEKDAY(col) + 1 SQL expressions.
MySQL's WEEKDAY() returns Monday=0 … Sunday=6, so adding 1 maps it to QQQ's ISO-8601 standard of Monday=1 … Sunday=7.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionwrapColumnName(String escapedColumnName, FieldFunction fieldFunction, Function<String, String> fieldNameToColumnReference) ReturnsWEEKDAY(col) + 1— shifting MySQL's 0-based Monday to ISO-8601's 1-based Monday.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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.kingsrook.qqq.backend.module.rdbms.fieldfunctions.RDBMSFieldFunctionAdapterInterface
getParams
-
Constructor Details
-
RDBMSWeekdayOfDateFunction
public RDBMSWeekdayOfDateFunction()
-
-
Method Details
-
wrapColumnName
public String wrapColumnName(String escapedColumnName, FieldFunction fieldFunction, Function<String, String> fieldNameToColumnReference) ReturnsWEEKDAY(col) + 1— shifting MySQL's 0-based Monday to ISO-8601's 1-based Monday.- 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.
-
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
-