1 | public class ViewSourceTab extends FormattedSourceTab↵ | | 1 | public class ViewSourceTab extends FormattedSourceTab↵
|
2 | {↵ | | 2 | {↵
|
3 | /** SQL that retrieves the source of a stored procedure. */↵ | | 3 | /** SQL that retrieves the source of a stored procedure. */↵
|
4 | private static String SQL =↵ | | 4 | private static String SQL =↵
|
5 | "select view_definition " +↵ | | 5 | "select view_definition " +↵
|
6 | "from information_schema.views " +↵ | | 6 | "from information_schema.views " +↵
|
7 | "where table_schema = ? " +↵ | | 7 | "where table_schema = ? " +↵
|
8 | "and table_name = ? ";↵ | | 8 | "and table_name = ? ";↵
|
9 | ↵ | | 9 | ↵
|
10 | /** Logger for this class. */↵ | | 10 | /** Logger for this class. */↵
|
11 | private final static ILogger s_log =↵ | | 11 | private final static ILogger s_log =↵
|
12 | LoggerController.createLogger(ViewSourceTab.class);↵ | | 12 | LoggerController.createLogger(ViewSourceTab.class);↵
|
|
13 | public ViewSourceTab(String hint, String stmtSep)↵ | | 13 | public ViewSourceTab(String hint, String stmtSep)↵
|
14 | {↵ | | 14 | {↵
|
15 | super(hint);↵ | | 15 | super(hint);↵
|
16 | super.setCompressWhitespace(true);↵ | | 16 | super.setCompressWhitespace(true);↵
|
17 | super.setupFormatter(stmtSep, null);↵ | | 17 | super.setupFormatter(stmtSep, null);↵
|
18 | }↵ | | 18 | }↵
|
|
19 | protected PreparedStatement createStatement() throws SQLException↵ | | 19 | protected PreparedStatement createStatement() throws SQLException↵
|
20 | {↵ | | 20 | {↵
|
21 | final ISession session = getSession();↵ | | 21 | final ISession session = getSession();↵
|
22 | final IDatabaseObjectInfo doi = getDatabaseObjectInfo();↵ | | 22 | final IDatabaseObjectInfo doi = getDatabaseObjectInfo();↵
|
|
23 | ISQLConnection conn = session.getSQLConnection();↵ | | 23 | ISQLConnection conn = session.getSQLConnection();↵
|
24 | if (s_log.isDebugEnabled()) {↵ | | 24 | if (s_log.isDebugEnabled()) {↵
|
25 | s_log.debug("Running SQL for View source tab: "+SQL);↵ | | 25 | s_log.debug("Running SQL for View source tab: "+SQL);↵
|
26 | }↵ | | 26 | }↵
|
27 | PreparedStatement pstmt = conn.prepareStatement(SQL);↵ | | 27 | PreparedStatement pstmt = conn.prepareStatement(SQL);↵
|
28 | ↵ | | 28 | ↵
|
29 | pstmt.setString(1, doi.getSchemaName());↵ | | 29 | pstmt.setString(1, doi.getSchemaName());↵
|
30 | pstmt.setString(2, doi.getSimpleName());↵ | | 30 | pstmt.setString(2, doi.getSimpleName());↵
|
31 | return pstmt;↵ | | 31 | return pstmt;↵
|
32 | | | 32 |
|