@@ -0,0 +1,2804 @@
+package com.splicemachine.triggers;%0A%0Aimport java.sql.Connection;%0Aimport java.sql.DriverManager;%0Aimport java.sql.ResultSet;%0Aimport java.sql.SQLException;%0Aimport java.sql.Statement;%0A%0A/**%0A * Stored Procedures for trigger testing.%0A * Test procedures to install in the splice server.%0A * %3Cp/%3E%0A * For an example as to how to install and run these procedures, see Trigger_Exec_Stored_Proc_IT in%0A * splice_machine_test.%0A *%0A *%0A */%0Apublic class TriggerProcs %7B%0A%0A    /**%0A     * A stored procedure which gets called from a trigger.%3Cbr/%3E%0A     * Updates an %22audit%22 table with the name of the user who initiated the trigger%0A     * and the timestamp of execution.%0A     * @param schema the name of the schema in which the table to update lives%0A     * @param table the name of the %22audit%22 table%0A     * @throws SQLException%0A     */%0A    public static void proc_call_audit(String schema, String table) throws SQLException %7B%0A        Connection conn = null;%0A        Statement statement = null;%0A        try %7B%0A            conn = DriverManager.getConnection(%22jdbc:default:connection%22);%0A            String username = conn.getMetaData().getUserName();%0A            statement = conn.createStatement();%0A            statement.execute(String.format(%22insert into %25s.%25s (username,insert_time) values ('%25s', CURRENT_TIMESTAMP)%22,%0A                                            schema,table, username));%0A        %7D finally %7B%0A            closeQuietly(statement);%0A            closeQuietly(conn);%0A        %7D%0A%0A    %7D%0A%0A    /**%0A     * A stored procedure which gets called from a trigger.%3Cbr/%3E%0A     * Updates an %22audit%22 table with the name of the user who initiated the trigger%0A     * and the timestamp of execution.%0A     * @param schema the name of the schema in which the table to update lives%0A     * @param table the name of the %22audit%22 table%0A     * @throws SQLException%0A     */%0A    public static void proc_call_audit_with_result(String schema, String table, ResultSet%5B%5D rs) throws SQLException %7B%0A        Connection conn = null;%0A        Statement statement = null;%0A        try %7B%0A            conn = DriverManager.getConnection(%22jdbc:default:connection%22);%0A            String username = conn.getMetaData().getUserName();%0A            statement = conn.createStatement();%0A            statement.execute(String.format(%22insert into %25s.%25s (username,insert_time) values ('%25s', CURRENT_TIMESTAMP)%22,%0A                                            schema,table, username));%0A            rs%5B0%5D = statement.getResultSet();%0A        %7D finally %7B%0A            closeQuietly(statement);%0A            closeQuietly(conn);%0A        %7D%0A%0A    %7D%0A%0A    private static void closeQuietly(AutoCloseable closeable) %7B%0A        if (closeable != null) %7B%0A            try %7B%0A                closeable.close();%0A            %7D catch (Exception e) %7B%0A                // ignore%0A            %7D%0A        %7D%0A    %7D%0A%7D%0A

support calling stored procs from triggers. Added java store procedures file referenced from IT in splice_machine_test.