com.ibm.db2os390.ive.da
Class DB2VisualExplain

java.lang.Object
  |
  +--com.ibm.db2os390.ive.da.DB2VisualExplain

public class DB2VisualExplain
extends java.lang.Object

DB2VisualExplain is a class to provide all external APIs which used by Visual Explain for DB2/zOS.

genXMLDynamic:
This API retrieves information from DB2/zOS system catalog tables and explain tables and to publish the desired information used by IVE in XML format.
It does the following things:
Issues the explain statement to DB2/zOS;
Retrieves the information from system catalog tables and explain tables regarding to the explain statement;
Generates the desired information by Visual Explain in XML format.

genXMLStatic:
This API retrieves information from DB2/zOS system catalog tables and explain tables and to publish the desired information used by IVE in XML format.
It does the following things:
Retrieves the information from system catalog tables and explain tables regarding to the explain statement;
Generates the desired information by Visual Explain in XML format.

enable:
This API creates the DB2/zOS runtime environment for Visual Explain.
It does the following things:
Checks if there is any existing table with the same name as the explain tables, if so, check the table format;
Migrates explain tables with v7 format to v8 format;
Creates those explain tables under the given schema which will be used by Visual Expalin;
Creates indexes against explain tables.

delete:
This API helps user to maintain size of explain tables.
It does the following things:
Deletes obsolete data which specified by user from explain tables.

migarte:
This API migrates v7 explain tables to V8 format for IVE.
It does the following things:
Creates a bakup explain table to store all data in V7 table;
Migrates v7 table to v8 format.

repair:
This API repairs the DB2/zOS runtime environment for Visual Explain.
It does the following things:
Recreates the missing explain table.


Constructor Summary
DB2VisualExplain()
           
 
Method Summary
static void delete(java.sql.Connection con, java.lang.String sqlid, java.lang.String creator_name, java.sql.Timestamp timestamp, int[] error_code, java.lang.String[] error_token)
          Delete some data in explain tables, which is older than specified timestamp.
static void enable(java.sql.Connection con, java.lang.String sqlid, java.lang.String creator_name, java.lang.String db_name, java.lang.String ts_name, int[] error_code, java.lang.String[] error_token)
          Creates all explain tables under the given schema name.
static void genXMLDynamic(java.sql.Connection con, java.lang.String sqlid, int queryno, java.lang.String sql, int degree, java.lang.String[] xml, int[] error_code, java.lang.String[] error_token)
          Explains a dynamic SQL query, retrieves information from catalog and explain tables, generates access path and correponding information in XML string format.
static void genXMLStatic(java.sql.Connection con, java.lang.String sqlid, int queryno, java.lang.String sql, java.lang.String applname, java.lang.String progname, java.lang.String collid, java.lang.String version, java.sql.Timestamp timestamp, java.lang.String[] xml, int[] error_code, java.lang.String[] error_token)
          Retrieves information from catalog and explain tables for a static SQL query, generates access path and correponding information in XML string format.
static void migrate(java.sql.Connection con, java.lang.String sqlid, java.lang.String creator_name, java.lang.String db_name, java.lang.String ts_name, java.lang.String tname, int[] error_code, java.lang.String[] error_token)
          Migrate those v7 explain tables under the given schema which are used by IVE.
static void repair(java.sql.Connection con, java.lang.String sqlid, java.lang.String db_name, java.lang.String ts_name, java.lang.String tname, int[] error_code, java.lang.String[] error_token)
          Repairs those explain tables under the given schema which are used by IVE.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DB2VisualExplain

public DB2VisualExplain()
Method Detail

enable

public static void enable(java.sql.Connection con,
                          java.lang.String sqlid,
                          java.lang.String creator_name,
                          java.lang.String db_name,
                          java.lang.String ts_name,
                          int[] error_code,
                          java.lang.String[] error_token)
Creates all explain tables under the given schema name.

Parameters:
con - a database connection
sqlid - current sqlid
creator_name - the schema name under which the user intends to create explain tables
db_name - the database name, the default is DSNDB04
ts_name - the tablespace name, the default is the first 8 characters of the creating table names
error_code - stores the error code returned, only the first entry of the array is used
error_token - stores the detailed error information returned, only the first entry of the array is used

delete

public static void delete(java.sql.Connection con,
                          java.lang.String sqlid,
                          java.lang.String creator_name,
                          java.sql.Timestamp timestamp,
                          int[] error_code,
                          java.lang.String[] error_token)
Delete some data in explain tables, which is older than specified timestamp.

Parameters:
con - a database connection
sqlid - current sqlid
creator_name - the schema name under which the user intends to create explain tables
timestamp - user specified timestamp, DeleteIVE will delete all data older than this timestamp
error_code - stores the error code returned, only the first entry of the array is used
error_token - stores the detailed error information returned, only the first entry of the array is used

migrate

public static void migrate(java.sql.Connection con,
                           java.lang.String sqlid,
                           java.lang.String creator_name,
                           java.lang.String db_name,
                           java.lang.String ts_name,
                           java.lang.String tname,
                           int[] error_code,
                           java.lang.String[] error_token)
Migrate those v7 explain tables under the given schema which are used by IVE.

Parameters:
con - a database connection
sqlid - current sqlid
creator_name - the schema name under which the user intends to create explain tables
db_name - the database name, the default is DSNDB04
ts_name - the tablespace name, the default is the first 8 characters of the creating table names
tname - the name of the table to be migrated
error_code - stores the error code returned, only the first entry of the array is used
error_token - stores the detailed error information returned, only the first entry of the array is used

repair

public static void repair(java.sql.Connection con,
                          java.lang.String sqlid,
                          java.lang.String db_name,
                          java.lang.String ts_name,
                          java.lang.String tname,
                          int[] error_code,
                          java.lang.String[] error_token)
Repairs those explain tables under the given schema which are used by IVE.

Parameters:
con - a database connection
sqlid - the schema name under which the explain table is created
db_name - the database name, the default is DSNDB04
ts_name - the tablespace name
tname - the name of the table to be repaired
error_code - stores the error code returned, only the first entry of the array is used
error_token - stores the detailed error information returned, only the first entry of the array is used

genXMLDynamic

public static void genXMLDynamic(java.sql.Connection con,
                                 java.lang.String sqlid,
                                 int queryno,
                                 java.lang.String sql,
                                 int degree,
                                 java.lang.String[] xml,
                                 int[] error_code,
                                 java.lang.String[] error_token)
Explains a dynamic SQL query, retrieves information from catalog and explain tables, generates access path and correponding information in XML string format.

Parameters:
con - a database connection
sqlid - the schema name under which the explain tables are created
queryno - a number to identify the SQL query being explained
sql - the dynamic SQL query need to explained
degree - the degree number to be set
xml - stores the XML string representing access path and other corresponding information
error_code - stores the error code returned, only the first entry of the array is used
error_token - stores the detailed error information returned, only the first entry of the array is used

genXMLStatic

public static void genXMLStatic(java.sql.Connection con,
                                java.lang.String sqlid,
                                int queryno,
                                java.lang.String sql,
                                java.lang.String applname,
                                java.lang.String progname,
                                java.lang.String collid,
                                java.lang.String version,
                                java.sql.Timestamp timestamp,
                                java.lang.String[] xml,
                                int[] error_code,
                                java.lang.String[] error_token)
Retrieves information from catalog and explain tables for a static SQL query, generates access path and correponding information in XML string format.

Parameters:
con - a database connection
sqlid - the schema name under which the explain tables are created
queryno - a number to identify the SQL query being explained
sql - the SQL statement stored in SYSIBM.SYSSTMT table
applname - the name of the application plan
progname - the name of the program or package containg the query being explained
collid - collection identifier
version - the package version
timestamp - the explain time
xml - stores the XML string representing access path and other corresponding information, only the first entry of the array is used
error_code - stores the error code returned, only the first entry of the array is used
error_token - stores the detailed error information returned, only the first entry of the array is used