org.h2.mode

## Class FunctionsMySQL

- java.lang.Object
- - org.h2.expression.Expression
  - - org.h2.expression.function.Function
    - - org.h2.mode.FunctionsMySQL

All Implemented Interfaces:
  FunctionCall

    public class FunctionsMySQL
    extends Function

This class implements some MySQL-specific functions.

### Field Summary

### Fields inherited from class org.h2.expression.function.Function

`ABS, ACOS, ADD_MONTHS, args, ARRAY_APPEND, ARRAY_CONCAT, ARRAY_CONTAINS, ARRAY_GET, ARRAY_LENGTH, ARRAY_SLICE, ASCII, ASIN, ATAN, ATAN2, AUTOCOMMIT, BIT_LENGTH, BITAND, BITGET, BITOR, BITXOR, CANCEL_SESSION, CASE, CASEWHEN, CAST, CEILING, CENTURY, CHAR, CHAR_LENGTH, COALESCE, COMPRESS, CONCAT, CONCAT_WS, CONVERT, COS, COSH, COT, CSVREAD, CSVWRITE, CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP, CURRENT_USER, CURRVAL, DATABASE, DATABASE_PATH, DATE_ADD, DATE_DIFF, DATE_TRUNC, DAY_NAME, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_YEAR, DECADE, DECODE, DECRYPT, DEGREES, DIFFERENCE, DISK_SPACE_USED, DOW, ENCRYPT, EPOCH, ESTIMATED_ENVELOPE, EXP, EXPAND, EXTRACT, FILE_READ, FILE_WRITE, FLOOR, FORMATDATETIME, GREATEST, H2VERSION, HASH, HEXTORAW, HOUR, IDENTITY, IFNULL, info, INSERT, INSTR, ISO_DAY_OF_WEEK, ISO_WEEK, ISO_YEAR, LCASE, LEAST, LEFT, LENGTH, LINK_SCHEMA, LN, LOCALTIME, LOCALTIMESTAMP, LOCATE, LOCK_MODE, LOCK_TIMEOUT, LOG, LOG10, LOWER, LPAD, LTRIM, MEMORY_FREE, MEMORY_USED, MICROSECOND, MILLENNIUM, MILLISECOND, MINUTE, MOD, MONTH, MONTH_NAME, NANOSECOND, NEXTVAL, NULLIF, NVL2, OCTET_LENGTH, ORA_HASH, PARSEDATETIME, PI, POSITION, POWER, QUARTER, RADIANS, RAND, RANDOM_UUID, RAWTOHEX, READONLY, REGEXP_LIKE, REGEXP_REPLACE, REPEAT, REPLACE, RIGHT, ROUND, ROUNDMAGIC, RPAD, RTRIM, SCHEMA, SCOPE_IDENTITY, SECOND, SECURE_RAND, SESSION_ID, SET, SIGN, SIGNAL, SIN, SINH, SOUNDEX, SPACE, SQRT, STRINGDECODE, STRINGENCODE, STRINGTOUTF8, SUBSTR, SUBSTRING, TABLE, TABLE_DISTINCT, TAN, TANH, TIMEZONE_HOUR, TIMEZONE_MINUTE, TO_CHAR, TO_DATE, TO_TIMESTAMP, TO_TIMESTAMP_TZ, TRANSACTION_ID, TRANSLATE, TRIM, TRUNCATE, TRUNCATE_VALUE, type, UCASE, UNNEST, UPPER, USER, UTF8TOSTRING, VALUES, VAR_ARGS, WEEK, XMLATTR, XMLCDATA, XMLCOMMENT, XMLNODE, XMLSTARTDOC, XMLTEXT, YEAR, ZERO`

### Fields inherited from class org.h2.expression.Expression

`MAP_IN_AGGREGATE, MAP_IN_WINDOW, MAP_INITIAL`

### Method Summary

Methods
`protected void` `checkParameterCount(int len)` Check if the parameter count is correct.
`static java.lang.String` `fromUnixTime(int seconds)` See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_from-unixtime
`static java.lang.String` `fromUnixTime(int seconds, java.lang.String format)` See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_from-unixtime
`static Function` `getFunction(Database database, java.lang.String upperName)` Returns mode-specific function for a given name, or `null`.
`protected Value` `getValueWithArgs(Session session, Expression[] args)` Return the resulting value for the given expression arguments.
`Expression` `optimize(Session session)` Try to optimize the expression.
`static int` `unixTimestamp()` Get the seconds since 1970-01-01 00:00:00 UTC.
`static int` `unixTimestamp(java.sql.Timestamp timestamp)` Get the seconds since 1970-01-01 00:00:00 UTC of the given timestamp.

### Methods inherited from class org.h2.expression.function.Function

`doneWithParameters, getArgs, getCost, getFunctionInfo, getFunctionType, getName, getNullOrValue, getSQL, getSubexpression, getSubexpressionCount, getType, getValue, getValueForColumnList, getValueType, isBufferResultSetToLocalTemp, isDeterministic, isEverything, isGeneratedKey, mapColumns, setDataType, setEvaluatable, setParameter, updateAggregate`

### Methods inherited from class org.h2.expression.Expression

`addFilterConditions, createIndexConditions, getAlias, getBooleanValue, getColumnName, getExpressionColumns, getExpressionColumns, getExpressionColumns, getNonAliasExpression, getNotIfPossible, getNullable, getSchemaName, getSQL, getTableAlias, getTableName, getUnenclosedSQL, isAutoIncrement, isConstant, isValueSet, toString, writeExpressions, writeExpressions`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.h2.expression.function.FunctionCall

`getSQL`

### Method Detail

#### unixTimestamp

    public static int unixTimestamp()

Get the seconds since 1970-01-01 00:00:00 UTC. See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_unix-timestamp

Returns:
  the current timestamp in seconds (not milliseconds).

#### unixTimestamp

    public static int unixTimestamp(java.sql.Timestamp timestamp)

Get the seconds since 1970-01-01 00:00:00 UTC of the given timestamp. See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_unix-timestamp

Parameters:
  `timestamp` - the timestamp
Returns:
  the current timestamp in seconds (not milliseconds).

#### fromUnixTime

    public static java.lang.String fromUnixTime(int seconds)

See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_from-unixtime

Parameters:
  `seconds` - The current timestamp in seconds.
Returns:
  a formatted date/time String in the format "yyyy-MM-dd HH:mm:ss".

#### fromUnixTime

    public static java.lang.String fromUnixTime(int seconds,
                                java.lang.String format)

See http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_from-unixtime

Parameters:
  `seconds` - The current timestamp in seconds.
  `format` - The format of the date/time String to return.
Returns:
  a formatted date/time String in the given format.

#### getFunction

    public static Function getFunction(Database database,
                       java.lang.String upperName)

Returns mode-specific function for a given name, or `null`.

Parameters:
  `database` - the database
  `upperName` - the upper-case name of a function
Returns:
  the function with specified name or `null`

#### checkParameterCount

    protected void checkParameterCount(int len)

Description copied from class: `Function`
Check if the parameter count is correct.

Overrides:
  `checkParameterCount` in class `Function`
Parameters:
  `len` - the number of parameters set

#### optimize

    public Expression optimize(Session session)

Description copied from class: `Expression`
Try to optimize the expression.

Specified by:
  `optimize` in interface `FunctionCall`
Overrides:
  `optimize` in class `Function`
Parameters:
  `session` - the session
Returns:
  the optimized expression

#### getValueWithArgs

    protected Value getValueWithArgs(Session session,
                         Expression[] args)

Description copied from class: `Function`
Return the resulting value for the given expression arguments.

Overrides:
  `getValueWithArgs` in class `Function`
Parameters:
  `session` - the session
  `args` - argument expressions
Returns:
  the result