/** executes the given statement on the given connection */ protected boolean implExecuteStatement(XConnection xConn, String sStatement) throws java.lang.Exception { try { XStatement xStatement = xConn.createStatement(); xStatement.execute(sStatement); } catch (com.sun.star.sdbc.SQLException e) { System.err.println(e); return false; } return true; }
/** * checks if a given table exists. * * <p>The check is made using a SELECT statement, so even if the connection is a n SDB-level * connection, which may filter tables in its table supplier, the result may be reliable .... */ protected boolean existsInvisibleTable(XConnection xConn, String sTableName) throws java.lang.Exception { String sStatement = "SELECT * FROM "; sStatement += sTableName; sStatement += " WHERE 0=1"; boolean bSuccess = false; try { XStatement xStatement = xConn.createStatement(); xStatement.execute(sStatement); // if we reached this point, the table probably exists bSuccess = true; } catch (com.sun.star.sdbc.SQLException e) { } return bSuccess; }