System functions

The driver supports the following data types and system functions.

Supported data types

  • exp – The expression can be a column name, the result of another scalar function, or a literal. The underlying data type must be one of the following:
    • SQL_NUMERIC, SQL_DECIMAL, SQL_TINYINT, SQL_SMALLINT, SQL_INTEGER, SQL_BIGINT, SQL_FLOAT, SQL_REAL, SQL_DOUBLE.
    • SQL_TYPE_DATE, SQL_TYPE_TIME, or SQL_TYPE_TIMESTAMP.
  • value – The value can be a literal constant with an underlying data type of SQL_NUMERIC, SQL_DECIMAL, SQL_TINYINT, SQL_SMALLINT, SQL_INTEGER, SQL_BIGINT, SQL_FLOAT, SQL_REAL, SQL_DOUBLE, SQL_TYPE_DATE, SQL_TYPE_TIME, or SQL_TYPE_TIMESTAMP.

System functions

Function ODBC Version Description
DATABASE() ODBC 1.0 Returns the database name for the connection handle.
Also available in SQLGetConnectOption with the SQL_CURRENT_QUALIFIER connection option.
IFNULL(exp, value) ODBC 1.0 Returns value if exp is NULL; otherwise, returns exp.
Both must have compatible data types.
USER() ODBC 1.0 Returns the current database user name, which may differ from the login name.
Also available in SQLGetInfo with the SQL_USER_NAME information type.