Class MySQLDatabaseAdapter

java.lang.Object
org.apache.nifi.processors.standard.db.impl.GenericDatabaseAdapter
org.apache.nifi.processors.standard.db.impl.MySQLDatabaseAdapter
All Implemented Interfaces:
DatabaseAdapter

public class MySQLDatabaseAdapter extends GenericDatabaseAdapter
A generic database adapter that generates MySQL compatible SQL.
  • Constructor Details

    • MySQLDatabaseAdapter

      public MySQLDatabaseAdapter()
  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in interface DatabaseAdapter
      Overrides:
      getName in class GenericDatabaseAdapter
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface DatabaseAdapter
      Overrides:
      getDescription in class GenericDatabaseAdapter
    • supportsUpsert

      public boolean supportsUpsert()
      Description copied from interface: DatabaseAdapter
      Tells whether this adapter supports UPSERT.
      Returns:
      true if UPSERT is supported, false otherwise
    • supportsInsertIgnore

      public boolean supportsInsertIgnore()
      Description copied from interface: DatabaseAdapter
      Tells whether this adapter supports INSERT_IGNORE.
      Returns:
      true if INSERT_IGNORE is supported, false otherwise
    • getUpsertStatement

      public String getUpsertStatement(String table, List<String> columnNames, Collection<String> uniqueKeyColumnNames)
      Description copied from interface: DatabaseAdapter
      Returns an SQL UPSERT statement - i.e. UPDATE record or INSERT if id doesn't exist.

      There is no standard way of doing this so not all adapters support it - use together with DatabaseAdapter.supportsUpsert()!
      Parameters:
      table - The name of the table in which to update/insert a record into.
      columnNames - The name of the columns in the table to add values to.
      uniqueKeyColumnNames - The name of the columns that form a unique key.
      Returns:
      A String containing the parameterized jdbc SQL statement. The order and number of parameters are the same as that of the provided column list.
    • getInsertIgnoreStatement

      public String getInsertIgnoreStatement(String table, List<String> columnNames, Collection<String> uniqueKeyColumnNames)
      Description copied from interface: DatabaseAdapter
      Returns an SQL INSERT_IGNORE statement - i.e. Ignore record or INSERT if id doesn't exist.

      There is no standard way of doing this so not all adapters support it - use together with DatabaseAdapter.supportsInsertIgnore()!
      Parameters:
      table - The name of the table in which to ignore/insert a record into.
      columnNames - The name of the columns in the table to add values to.
      uniqueKeyColumnNames - The name of the columns that form a unique key.
      Returns:
      A String containing the parameterized jdbc SQL statement. The order and number of parameters are the same as that of the provided column list.
    • supportsCreateTableIfNotExists

      public boolean supportsCreateTableIfNotExists()
    • getAlterTableStatement

      public String getAlterTableStatement(String tableName, List<ColumnDescription> columnsToAdd)
    • getSQLForDataType

      public String getSQLForDataType(int sqlType)