public class UpdatableMyConnectionView
extends org.h2.tools.TriggerAdapter
Modifier and Type | Field and Description |
---|---|
private static java.util.Map<java.lang.Integer,java.lang.Class<?>> |
FJTYPES
Map SQL types to Java classes
|
private static java.util.List<java.lang.Integer> |
FTYPES
meta_mayconnection table column types
|
private java.sql.PreparedStatement |
prepDelete
PreparedStatement for DELETE
|
private java.sql.PreparedStatement |
prepInsert
PreparedStatement for INSERT
|
Constructor and Description |
---|
UpdatableMyConnectionView() |
Modifier and Type | Method and Description |
---|---|
void |
close()
This method is called when the trigger is dropped.
|
void |
fire(java.sql.Connection conn,
java.sql.ResultSet oldRow,
java.sql.ResultSet newRow)
This method is called for each triggered action by the default
fire(Connection conn, Object[] oldRow, Object[] newRow) method.
|
void |
init(java.sql.Connection conn,
java.lang.String schemaName,
java.lang.String triggerName,
java.lang.String tableName,
boolean before,
int type)
This method is called by the database engine once when initializing the
trigger.
|
private java.lang.Class<?> |
javaType(int nc)
Get the Java data type of the column.
|
private java.lang.Integer |
sqlType(int nc)
Get the SQL data type of the column;
|
private static final java.util.List<java.lang.Integer> FTYPES
private static final java.util.Map<java.lang.Integer,java.lang.Class<?>> FJTYPES
private java.sql.PreparedStatement prepDelete
private java.sql.PreparedStatement prepInsert
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
init
in interface org.h2.api.Trigger
init
in class org.h2.tools.TriggerAdapter
conn
- A connection to the database.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 performedtype
- The operation type: INSERT, UPDATE, DELETE, SELECT, or a combination (this parameter is a bit
field)java.sql.SQLException
public void fire(java.sql.Connection conn, java.sql.ResultSet oldRow, java.sql.ResultSet newRow) throws java.sql.SQLException
For "before" triggers, the new values of the new row may be changed using the ResultSet.updateX methods.
fire
in class org.h2.tools.TriggerAdapter
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).java.sql.SQLException
- if the operation must be undone.public void close() throws java.sql.SQLException
close
in interface org.h2.api.Trigger
close
in class org.h2.tools.TriggerAdapter
java.sql.SQLException
private java.lang.Class<?> javaType(int nc)
nc
- Column position.private java.lang.Integer sqlType(int nc)
nc
- Column position.