Class RDBMSSubStringFunction

java.lang.Object
com.kingsrook.qqq.backend.module.rdbms.fieldfunctions.RDBMSSubStringFunction
All Implemented Interfaces:
BackendFieldFunctionAdapterInterface, RDBMSFieldFunctionAdapterInterface, Serializable

public class RDBMSSubStringFunction extends Object implements RDBMSFieldFunctionAdapterInterface
RDBMS adapter for the SubStringFunction that generates SQL SUBSTRING(col FROM ? [FOR ?]) expressions.

The fromIndex bind parameter is always supplied; the length bind parameter is included only when the length argument is provided.

See Also:
  • Constructor Details

    • RDBMSSubStringFunction

      public RDBMSSubStringFunction()
  • Method Details

    • wrapColumnName

      public String wrapColumnName(String escapedColumnName, FieldFunction fieldFunction, Function<String,String> fieldNameToColumnReference)
      Returns a SUBSTRING SQL expression, using FROM ? form without a length, or FROM ? FOR ? form when a length argument is present.
      Specified by:
      wrapColumnName in interface RDBMSFieldFunctionAdapterInterface
      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

      public List<Serializable> getParams(FieldFunction fieldFunction)
      Returns the SQL bind parameters for the SUBSTRING expression: [fromIndex] or [fromIndex, length] depending on whether length was specified.
      Specified by:
      getParams in interface RDBMSFieldFunctionAdapterInterface