Search in sources :

Example 16 with DBGException

use of org.jkiss.dbeaver.debug.DBGException in project dbeaver by dbeaver.

the class PostgreDebugSession method getSource.

/**
 * Return source for func OID in debug session
 *
 * @return String
 */
public String getSource(int OID) throws DBGException {
    acquireReadLock();
    String src = "";
    String sql = SQL_GET_SRC.replaceAll("\\?sessionid", String.valueOf(sessionId)).replaceAll("\\?oid", String.valueOf(OID));
    try (Statement stmt = getConnection().createStatement();
        ResultSet rs = stmt.executeQuery(sql)) {
        while (rs.next()) {
            src = rs.getString(1);
        }
    } catch (SQLException e) {
        throw new DBGException("SQL error", e);
    } finally {
        lock.readLock().unlock();
    }
    return src;
}
Also used : DBGException(org.jkiss.dbeaver.debug.DBGException) SQLException(java.sql.SQLException) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) ResultSet(java.sql.ResultSet)

Example 17 with DBGException

use of org.jkiss.dbeaver.debug.DBGException in project dbeaver by dbeaver.

the class DebugCore method findProcedureController.

public static DBGController findProcedureController(DBPDataSourceContainer dataSourceContainer) throws DBGException {
    DBGController controller = Adapters.adapt(dataSourceContainer, DBGController.class);
    if (controller != null) {
        return controller;
    }
    String providerId = dataSourceContainer.getDriver().getProviderId();
    String message = NLS.bind("Unable to find controller for datasource \"{0}\"", providerId);
    throw new DBGException(message);
}
Also used : DBGException(org.jkiss.dbeaver.debug.DBGException) DBGController(org.jkiss.dbeaver.debug.DBGController)

Example 18 with DBGException

use of org.jkiss.dbeaver.debug.DBGException in project dbeaver by dbeaver.

the class DatabaseDebugTarget method resume.

@Override
public void resume() throws DebugException {
    suspended = false;
    try {
        controller.resume(sessionKey);
    } catch (DBGException e) {
        String message = NLS.bind("Error resuming {0}", getName());
        IStatus status = DebugCore.newErrorStatus(message, e);
        throw new DebugException(status);
    }
    if (thread.isSuspended()) {
        thread.resumedByTarget();
    }
    fireResumeEvent(DebugEvent.CLIENT_REQUEST);
}
Also used : DBGException(org.jkiss.dbeaver.debug.DBGException) IStatus(org.eclipse.core.runtime.IStatus) DebugException(org.eclipse.debug.core.DebugException)

Example 19 with DBGException

use of org.jkiss.dbeaver.debug.DBGException in project dbeaver by dbeaver.

the class DatabaseDebugTarget method breakpointAdded.

@Override
public void breakpointAdded(IBreakpoint breakpoint) {
    if (!terminated) {
        DBGBreakpointDescriptor descriptor = describeBreakpoint(breakpoint);
        if (descriptor == null) {
            String message = NLS.bind("Unable to describe breakpoint {0}", breakpoint);
            Status error = DebugCore.newErrorStatus(message);
            DebugCore.log(error);
            return;
        }
        try {
            controller.addBreakpoint(sessionKey, descriptor);
        } catch (DBGException e) {
            String message = NLS.bind("Unable to add breakpoint {0}", breakpoint);
            Status error = DebugCore.newErrorStatus(message, e);
            DebugCore.log(error);
        }
    }
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) DBGException(org.jkiss.dbeaver.debug.DBGException) DBGBreakpointDescriptor(org.jkiss.dbeaver.debug.DBGBreakpointDescriptor)

Aggregations

DBGException (org.jkiss.dbeaver.debug.DBGException)19 SQLException (java.sql.SQLException)13 ResultSet (java.sql.ResultSet)8 Statement (java.sql.Statement)8 PreparedStatement (java.sql.PreparedStatement)6 IStatus (org.eclipse.core.runtime.IStatus)5 ArrayList (java.util.ArrayList)4 Scanner (java.util.Scanner)4 DBGBreakpointDescriptor (org.jkiss.dbeaver.debug.DBGBreakpointDescriptor)4 DebugException (org.eclipse.debug.core.DebugException)3 DBCExecutionContext (org.jkiss.dbeaver.model.exec.DBCExecutionContext)3 Status (org.eclipse.core.runtime.Status)2 DBGSession (org.jkiss.dbeaver.debug.DBGSession)2 DBGStackFrame (org.jkiss.dbeaver.debug.DBGStackFrame)2 JDBCExecutionContext (org.jkiss.dbeaver.model.impl.jdbc.JDBCExecutionContext)2 Connection (java.sql.Connection)1 DebugPlugin (org.eclipse.debug.core.DebugPlugin)1 IBreakpointManager (org.eclipse.debug.core.IBreakpointManager)1 DBGBaseController (org.jkiss.dbeaver.debug.DBGBaseController)1 DBGController (org.jkiss.dbeaver.debug.DBGController)1