SQLFire 1.1

com.vmware.sqlfire.callbacks
Interface Event


public interface Event

Encapsulates information about an event captured by a callback object.


Nested Class Summary
static class Event.Type
          Enumeration of the types of callback events.
 
Method Summary
 String getDMLString()
          Get the DML string for a Event.Type.BULK_DML or Event.Type.BULK_INSERT operation.
 int[] getModifiedColumns()
          Deprecated. Will be removed in a future release. Use returned TableMetaData by ResultSet.getMetaData() instead on the getNewRowsAsResultSet() to get the meta-data of the updated columns.
 List<Object> getNewRow()
          Deprecated. Will be removed in a future release. Use getNewRowsAsResultSet() instead which will return a valid ResultSet for all operation types and provide more flexible ways to extract the column values, avoiding having to create java objects for all the columns.
 ResultSet getNewRowsAsResultSet()
          Get the new rows being inserted/updated as a ResultSet.TYPE_FORWARD_ONLY ResultSet.
 List<Object> getOldRow()
          Deprecated. Will be removed in a future release. Use getOldRowAsResultSet() instead which will return a valid ResultSet for all operation types and provide more flexible ways to extract the column values, avoiding having to create java objects for all the columns.
 ResultSet getOldRowAsResultSet()
          Get the old row being updated as a ResultSet.TYPE_FORWARD_ONLY ResultSet of the column values.
 Object[] getPrimaryKey()
          Deprecated. use getPrimaryKeysAsResultSet() instead which will provide more flexible ways to extract the column values and avoid having to create java objects for all the columns
 ResultSet getPrimaryKeysAsResultSet()
          Get the primary key of the changed rows as a ResultSet having ResultSet.TYPE_FORWARD_ONLY cursor.
 TableMetaData getResultSetMetaData()
          Gets the metadata information of the table being updated.
 String getSchemaName()
          The schema for the current operation.
 String getTableName()
          The fully qualified table name for the current operation.
 Event.Type getType()
          Get the Type of the event.
 boolean hasParameters()
          Returns true if this is a Event.Type.BULK_INSERT operation or a Event.Type.BULK_DML operation having parameters for the prepared statement and false otherwise.
 boolean isEviction()
          Returns whether the event is generated due to eviction of a row.
 boolean isExpiration()
          Returns whether the event is generated due to expiration of a row.
 boolean isLoad()
          Returns whether the event is generated due to a RowLoader invocation
 boolean isOriginRemote()
          Indicates whether this event originated in a VM other than this one.
 boolean isPossibleDuplicate()
          Indicates whether the event received is possibly a duplicate.
 boolean isTransactional()
          Indicates whether the event received is from commit of a transaction.
 boolean tableHasAutogeneratedColumns()
          Returns true if the table for current operation has auto-generated columns.
 

Method Detail

getType

Event.Type getType()
Get the Type of the event.

Returns:
the Type of the event.

getOldRow

@Deprecated
List<Object> getOldRow()
                       throws UnsupportedOperationException
Deprecated. Will be removed in a future release. Use getOldRowAsResultSet() instead which will return a valid ResultSet for all operation types and provide more flexible ways to extract the column values, avoiding having to create java objects for all the columns.

Get the old row being updated as a List of the column values. For a Event.Type.BULK_DML or Event.Type.BULK_INSERT operation, this throws an UnsupportedOperationException.

Returns:
the old row values or null if the old row is not available
Throws:
UnsupportedOperationException - for Event.Type.BULK_DML and Event.Type.BULK_INSERT operations

getOldRowAsResultSet

ResultSet getOldRowAsResultSet()
                               throws UnsupportedOperationException
Get the old row being updated as a ResultSet.TYPE_FORWARD_ONLY ResultSet of the column values. The returned ResultSet is already positioned at the returned single row with ResultSet.next() always returning false, whose column values can be retrieved using the ResultSet getter methods. For a Event.Type.BULK_DML or Event.Type.BULK_INSERT operation, this throws an UnsupportedOperationException.

Returns:
the old row values as a ResultSet or null if the old row is not available
Throws:
UnsupportedOperationException - for Event.Type.BULK_DML and Event.Type.BULK_INSERT operations

getNewRow

@Deprecated
List<Object> getNewRow()
                       throws UnsupportedOperationException
Deprecated. Will be removed in a future release. Use getNewRowsAsResultSet() instead which will return a valid ResultSet for all operation types and provide more flexible ways to extract the column values, avoiding having to create java objects for all the columns.

Get the new or updated row as a List of the column values. For a delete operation this returns null. For a Event.Type.BULK_DML operation, this is the set of parameters to the statement used for a prepared statement, or null if there are no parameters. For a Event.Type.BULK_INSERT operation this throws an UnsupportedOperationException.

Returns:
the new or updated row values, or null if this is a delete operation, or a Event.Type.BULK_DML operation having no parameters
Throws:
UnsupportedOperationException - for a Event.Type.BULK_INSERT operation

getNewRowsAsResultSet

ResultSet getNewRowsAsResultSet()
Get the new rows being inserted/updated as a ResultSet.TYPE_FORWARD_ONLY ResultSet. For Event.Type.BULK_INSERT operation, it returns the set of rows being inserted. For delete operations, it returns null. For all other operations, the returned ResultSet is already positioned at the returned single row with ResultSet.next() always returning false, whose column values can be retrieved using the ResultSet getter methods. The meta-data returned by the ResultSet's getMetaData method will be a projection TableMetaData of the columns updated for the update operation, a projection ResultSetMetaData of the columns updated for Event.Type.BULK_DML operation, and the full table meta-data (i.e. same as getResultSetMetaData() for other operations.

Returns:
the rows being inserted/updated as a ResultSet

getResultSetMetaData

TableMetaData getResultSetMetaData()
Gets the metadata information of the table being updated.

Returns:
the TableMetaData of the table being updated.

getDMLString

String getDMLString()
                    throws UnsupportedOperationException
Get the DML string for a Event.Type.BULK_DML or Event.Type.BULK_INSERT operation.

Returns:
the DML string for the bulk DML/insert operation
Throws:
UnsupportedOperationException - for operations other than Event.Type.BULK_DML and Event.Type.BULK_INSERT

getSchemaName

String getSchemaName()
The schema for the current operation.

Returns:
the current schema for this event

getTableName

String getTableName()
The fully qualified table name for the current operation.

Returns:
the fully qualified table name for this event

getModifiedColumns

@Deprecated
int[] getModifiedColumns()
                         throws UnsupportedOperationException
Deprecated. Will be removed in a future release. Use returned TableMetaData by ResultSet.getMetaData() instead on the getNewRowsAsResultSet() to get the meta-data of the updated columns.

Get the positions of the columns that were updated as an ordered array. The details of the modified columns can be retrieved from the metadata returned by getResultSetMetaData(). The modified column values can be obtained from the new value from getNewRowsAsResultSet().

Returns:
the int[] of 1-based column positions for the columns that were updated.
Throws:
UnsupportedOperationException - for Event.Type.BULK_DML and Event.Type.BULK_INSERT operations

getPrimaryKey

@Deprecated
Object[] getPrimaryKey()
                       throws UnsupportedOperationException
Deprecated. use getPrimaryKeysAsResultSet() instead which will provide more flexible ways to extract the column values and avoid having to create java objects for all the columns

Returns the Primary key of the manipulated row. If the table has no primary key defined, then a long value uniquely identifying the row would be returned. In such cases, users can correlate the row ID during creation with that during update & delete.

Returns:
Object[] of values of the primary key columns
Throws:
UnsupportedOperationException - for Event.Type.BULK_DML and Event.Type.BULK_INSERT operations

getPrimaryKeysAsResultSet

ResultSet getPrimaryKeysAsResultSet()
                                    throws UnsupportedOperationException
Get the primary key of the changed rows as a ResultSet having ResultSet.TYPE_FORWARD_ONLY cursor. For Event.Type.BULK_INSERT operation, it returns all the primary key column values being inserted. If there is no primary key defined on the table then it returns null for Event.Type.BULK_INSERT. For other operations, the returned ResultSet does not support the cursor movement operations like ResultSet.next() etc. returning just a single current row whose column values can be retrieved using the ResultSet getter methods. A single column having a unique long row ID is returned for the case there is no primary key defined on the table.

Returns:
values of the primary key columns as a ResultSet
Throws:
UnsupportedOperationException - for a Event.Type.BULK_DML operation

hasParameters

boolean hasParameters()
Returns true if this is a Event.Type.BULK_INSERT operation or a Event.Type.BULK_DML operation having parameters for the prepared statement and false otherwise.


tableHasAutogeneratedColumns

boolean tableHasAutogeneratedColumns()
Returns true if the table for current operation has auto-generated columns. For a table having auto-generated columns the AsyncEventListener receives the operation as a Event.Type.BULK_DML operation rather than as an insert operation since the auto-generated column values will be skipped from the parameter values.


isOriginRemote

boolean isOriginRemote()
Indicates whether this event originated in a VM other than this one. When using JDBC clients, this will be false on the server to which the client is connected and true on other servers when the event is propagated.

Returns:
true if this event originated in another VM or false if originated in this VM.

isPossibleDuplicate

boolean isPossibleDuplicate()
Indicates whether the event received is possibly a duplicate. Duplicate events may be received when a fail-over happens during DML statement execution.

Returns:
true if the event is a possible duplicate.

isTransactional

boolean isTransactional()
Indicates whether the event received is from commit of a transaction.

Returns:
true if the event is from commit of a transaction

isLoad

boolean isLoad()
Returns whether the event is generated due to a RowLoader invocation

Returns:
true if the event got generated as a result of RowLoader invocation or false otherwise

isExpiration

boolean isExpiration()
Returns whether the event is generated due to expiration of a row.

Returns:
true if yes false otherwise

isEviction

boolean isEviction()
Returns whether the event is generated due to eviction of a row.

Returns:
true if yes false otherwise

SQLFire 1.1

Copyright © 2010-2013 VMware, Inc. All rights reserved.