Package org.h2.fulltext
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 java.lang.Object implements Trigger
Trigger updates the index when a inserting, updating, or deleting a row.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String[]
columns
private int[]
columnTypes
private org.apache.lucene.document.FieldType
DOC_ID_FIELD_TYPE
private FullTextLucene.IndexAccess
indexAccess
private int[]
indexColumns
private java.lang.String
indexPath
private int[]
keys
private java.lang.String
schema
private java.lang.String
table
-
Constructor Summary
Constructors Constructor Description FullTextTrigger()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
INTERNAL(package private) void
commitIndex()
Commit all changes to the Lucene index.private void
delete(java.lang.Object[] row, boolean commitIndex)
Delete a row from the index.void
fire(java.sql.Connection conn, java.lang.Object[] oldRow, java.lang.Object[] newRow)
INTERNALprivate java.lang.String
getQuery(java.lang.Object[] row)
void
init(java.sql.Connection conn, java.lang.String schemaName, java.lang.String triggerName, java.lang.String tableName, boolean before, int type)
INTERNAL(package private) void
insert(java.lang.Object[] row, boolean commitIndex)
Add a row to the index.
-
-
-
Field Detail
-
schema
private java.lang.String schema
-
table
private java.lang.String table
-
keys
private int[] keys
-
indexColumns
private int[] indexColumns
-
columns
private java.lang.String[] columns
-
columnTypes
private int[] columnTypes
-
indexPath
private java.lang.String indexPath
-
indexAccess
private FullTextLucene.IndexAccess indexAccess
-
DOC_ID_FIELD_TYPE
private final org.apache.lucene.document.FieldType DOC_ID_FIELD_TYPE
-
-
Method Detail
-
init
public void init(java.sql.Connection conn, java.lang.String schemaName, java.lang.String triggerName, java.lang.String tableName, boolean before, int type) throws java.sql.SQLException
INTERNAL- Specified by:
init
in interfaceTrigger
- Parameters:
conn
- a connection to the database (a system connection)schemaName
- the name of the schematriggerName
- the name of the trigger used in the CREATE TRIGGER statementtableName
- the name of the tablebefore
- whether the fire method is called before or after the operation is performedtype
- the operation type: INSERT, UPDATE, DELETE, SELECT, or a combination (this parameter is a bit field)- Throws:
java.sql.SQLException
- on SQL exception- See Also:
Trigger.init(Connection, String, String, String, boolean, int)
-
fire
public void fire(java.sql.Connection conn, java.lang.Object[] oldRow, java.lang.Object[] newRow) throws java.sql.SQLException
INTERNAL- Specified by:
fire
in interfaceTrigger
- Parameters:
conn
- a connection to the databaseoldRow
- 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:
java.sql.SQLException
- if the operation must be undone- See Also:
Trigger.fire(Connection, Object[], Object[])
-
close
public void close() throws java.sql.SQLException
INTERNAL
-
commitIndex
void commitIndex() throws java.sql.SQLException
Commit all changes to the Lucene index.- Throws:
java.sql.SQLException
- on failure
-
insert
void insert(java.lang.Object[] row, boolean commitIndex) throws java.sql.SQLException
Add a row to the index.- Parameters:
row
- the rowcommitIndex
- whether to commit the changes to the Lucene index- Throws:
java.sql.SQLException
- on failure
-
delete
private void delete(java.lang.Object[] row, boolean commitIndex) throws java.sql.SQLException
Delete a row from the index.- Parameters:
row
- the rowcommitIndex
- whether to commit the changes to the Lucene index- Throws:
java.sql.SQLException
- on failure
-
getQuery
private java.lang.String getQuery(java.lang.Object[] row) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
-