Hi,

org.h2.tools.TriggerAdapter (your Trigger should extend that class), 
provides the protected members schemaName and tableName.

Kind regards

Christoff Schmitz

F I N A R I S
Financial Software Partner GmbH
Sömmerringstrasse 23
60322 Frankfurt am Main

Fon:      +49 (0)69  / 254 98 - 24
Mobile: +49 (0)176 / 206 34 186
Fax:       +49 (0)69  / 254 98 - 50
eMail:    mailto:christoff.schm...@finaris.de
www:      http://www.finaris.de und http://www.rapidrep.com



From:   blu10 <johnmaddo...@gmail.com>
To:     h2-database@googlegroups.com
Date:   2015-05-11 10:12
Subject:        [h2] Triggers, finding the table name that trigger fired 
against?
Sent by:        h2-database@googlegroups.com



I have numerous triggers on my database and i can see the data being i'm 
entering being output on the console using the code below in the fire 
function. The problem is i cant see which table the trigger was fired 
against. 
Is there something obvious im missing.....? Id like to eventually output 
the table name with the data entered so i can see which tables are being 
updated.

        /**
         * This method is called for each triggered action.
         *
         * @param conn a connection to the database
         * @param oldRow the old row, or null if no old row is available 
(for
         *            INSERT)
         * @param newRow the new row, or null if no new row is available 
(for
         *            DELETE)
         * @throws SQLException if the operation must be undone
         */
        @Override
        public void fire(Connection conn,
                Object[] oldRow, Object[] newRow)
                throws SQLException {
            BigDecimal diff = null;
            if (newRow != null) {
 
                for (int i =0; i < newRow.length; i++) {
 
                  if (newRow[i] != null) {
                    System.out.println("Col !");
                    System.out.println(newRow[i].toString());
                  }
 
                }
 
            }
 
        }
-- 
You received this message because you are subscribed to the Google Groups 
"H2 Database" group.
To unsubscribe from this group and stop receiving emails from it, send an 
email to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


================================================================================================================
Disclaimer
The information contained in this e - mail and any attachments ( together 
the "message") is intended for the addressee only and 
may contain confidential and/or privileged information. If you have 
received the message by mistake please delete it and notify 
the sender and do not copy or distribute it or disclose its contents to 
anyone.

FINARIS Financial Software Partner GmbH, Sömmerringstr. 23, 60322 
Frankfurt/Main, Germany
Registered at Frankfurt/Main, HRB 52873, Managing Directors: Dipl. Inf. 
Hermann Friebel, Dipl. Ing. Kai Bächle, Dipl. Inf. Werner Märkl
================================================================================================================

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to