Class FullTextLucene.FullTextTrigger

java.lang.Object
org.h2.fulltext.FullTextLucene.FullTextTrigger
All Implemented Interfaces:
Trigger
Enclosing class:
FullTextLucene

public static final class FullTextLucene.FullTextTrigger extends Object implements Trigger
Trigger updates the index when a inserting, updating, or deleting a row.
  • Field Details

    • schema

      private String schema
    • table

      private String table
    • keys

      private int[] keys
    • indexColumns

      private int[] indexColumns
    • columns

      private String[] columns
    • columnTypes

      private int[] columnTypes
    • indexPath

      private String indexPath
    • indexAccess

      private FullTextLucene.IndexAccess indexAccess
    • DOC_ID_FIELD_TYPE

      private final org.apache.lucene.document.FieldType DOC_ID_FIELD_TYPE
  • Constructor Details

    • FullTextTrigger

      public FullTextTrigger()
  • Method Details

    • init

      public void init(Connection conn, String schemaName, String triggerName, String tableName, boolean before, int type) throws SQLException
      INTERNAL
      Specified by:
      init in interface Trigger
      Parameters:
      conn - a connection to the database (a system connection)
      schemaName - the name of the schema
      triggerName - the name of the trigger used in the CREATE TRIGGER statement
      tableName - the name of the table
      before - whether the fire method is called before or after the operation is performed
      type - the operation type: INSERT, UPDATE, DELETE, SELECT, or a combination (this parameter is a bit field)
      Throws:
      SQLException - on SQL exception
      See Also:
    • fire

      public void fire(Connection conn, Object[] oldRow, Object[] newRow) throws SQLException
      INTERNAL
      Specified by:
      fire in interface Trigger
      Parameters:
      conn - a connection to the database
      oldRow - the old row, or null if no old row is available (for INSERT)
      newRow - the new row, or null if no new row is available (for DELETE)
      Throws:
      SQLException - if the operation must be undone
      See Also:
    • close

      public void close() throws SQLException
      INTERNAL
      Specified by:
      close in interface Trigger
      Throws:
      SQLException - on SQL exception
    • commitIndex

      void commitIndex() throws SQLException
      Commit all changes to the Lucene index.
      Throws:
      SQLException - on failure
    • insert

      void insert(Object[] row, boolean commitIndex) throws SQLException
      Add a row to the index.
      Parameters:
      row - the row
      commitIndex - whether to commit the changes to the Lucene index
      Throws:
      SQLException - on failure
    • delete

      private void delete(Object[] row, boolean commitIndex) throws SQLException
      Delete a row from the index.
      Parameters:
      row - the row
      commitIndex - whether to commit the changes to the Lucene index
      Throws:
      SQLException - on failure
    • getQuery

      private String getQuery(Object[] row) throws SQLException
      Throws:
      SQLException