/**
* This class will display the source for an Postgres view.
*
* @author manningr
*/
/**
* This class will display the source for an H2 view.
*
* @author manningr
*/
public class ViewSourceTab extends FormattedSourceTab {
/** SQL that retrieves the source of a stored procedure. */
private static String SQL = "select view_definition " + "from information_schema.views " + "where table_schema = ? " + "and table_name = ? ";
/** Logger for this class. */
private final static ILogger s_log = LoggerController.createLogger(ViewSourceTab.class );
public ViewSourceTab(String hint, String stmtSep) {
super(hint);
super.setCompressWhitespace(true);
super.setupFormatter(stmtSep, null);
}
protected PreparedStatement createStatement() throws SQLException {
final ISession session = getSession();
final IDatabaseObjectInfo doi = getDatabaseObjectInfo();
ISQLConnection conn = session.getSQLConnection();
if (s_log.isDebugEnabled()) {
s_log.debug("Running SQL for View source tab: " + SQL);
}
PreparedStatement pstmt = conn.prepareStatement(SQL);
pstmt.setString(1, doi.getSchemaName());
pstmt.setString(2, doi.getSimpleName());
return pstmt;
}
}
|