Search in sources :

Example 16 with FbService

use of org.firebirdsql.gds.ng.FbService in project jaybird by FirebirdSQL.

the class FBStatisticsManager method getDatabaseStatistics.

public void getDatabaseStatistics(int options) throws SQLException {
    if (options != 0 && (options | possibleStatistics) != possibleStatistics) {
        throw new IllegalArgumentException("options must be 0 or a " + "combination of DATA_TABLE_STATISTICS, " + "SYSTEM_TABLE_STATISTICS, INDEX_STATISTICS, or 0");
    }
    try (FbService service = attachServiceManager()) {
        ServiceRequestBuffer srb = createStatsSRB(service, options);
        executeServicesOperation(service, srb);
    }
}
Also used : ServiceRequestBuffer(org.firebirdsql.gds.ServiceRequestBuffer) FbService(org.firebirdsql.gds.ng.FbService)

Example 17 with FbService

use of org.firebirdsql.gds.ng.FbService in project jaybird by FirebirdSQL.

the class FBTraceManager method stopTraceSession.

/**
 * Stops a trace session with the given trace session ID
 *
 * @param traceSessionId
 *         The trace session ID
 * @throws SQLException
 */
public void stopTraceSession(int traceSessionId) throws SQLException {
    try (FbService service = attachServiceManager()) {
        service.startServiceAction(getTraceSPB(service, isc_action_svc_trace_stop, traceSessionId));
        queueService(service);
    } catch (IOException ioe) {
        throw new SQLException(ioe);
    }
}
Also used : SQLException(java.sql.SQLException) FbService(org.firebirdsql.gds.ng.FbService)

Example 18 with FbService

use of org.firebirdsql.gds.ng.FbService in project jaybird by FirebirdSQL.

the class FBTraceManager method resumeTraceSession.

/**
 * Resumes a trace session with the given trace session ID
 *
 * @param traceSessionId
 *         The trace session ID
 * @throws SQLException
 */
public void resumeTraceSession(int traceSessionId) throws SQLException {
    try (FbService service = attachServiceManager()) {
        service.startServiceAction(getTraceSPB(service, isc_action_svc_trace_resume, traceSessionId));
        queueService(service);
    } catch (IOException ioe) {
        throw new SQLException(ioe);
    }
}
Also used : SQLException(java.sql.SQLException) FbService(org.firebirdsql.gds.ng.FbService)

Example 19 with FbService

use of org.firebirdsql.gds.ng.FbService in project jaybird by FirebirdSQL.

the class FBTraceManager method startTraceSession.

/**
 * Starts a trace session with an optional trace session name and configuration
 *
 * @param traceSessionName
 *         The trace session name (optional)
 * @param configuration
 *         The trace configuration. For an example, look into fbtrace.conf in the root directory of your
 *         Firebird installation
 * @throws SQLException
 */
public void startTraceSession(String traceSessionName, String configuration) throws SQLException {
    if (configuration == null || configuration.equals("")) {
        throw new SQLException("No configuration provided");
    }
    if (traceSessionName == null) {
        traceSessionName = "";
    }
    synchronized (this) {
        OutputStream currentLogger = getLogger();
        if (currentLogger instanceof TraceStream) {
            currentLogger = ((TraceStream) currentLogger).unwrap();
        }
        setLogger(new TraceStream(currentLogger, traceSessionName));
        FbService service = attachServiceManager();
        ServiceRequestBuffer traceSPB = getTraceSPB(service, isc_action_svc_trace_start, traceSessionName, configuration);
        Thread t = new Thread(new TraceTask(service, traceSPB));
        t.start();
    }
}
Also used : ServiceRequestBuffer(org.firebirdsql.gds.ServiceRequestBuffer) SQLException(java.sql.SQLException) FbService(org.firebirdsql.gds.ng.FbService)

Example 20 with FbService

use of org.firebirdsql.gds.ng.FbService in project jaybird by FirebirdSQL.

the class FBUserManager method adminRoleAction.

/**
 * Services API execution for setting and dropping the auto admin role mapping
 *
 * @param action
 * @throws SQLException
 * @throws IOException
 */
private void adminRoleAction(int action) throws SQLException, IOException {
    try (FbService service = attachServiceManager()) {
        ServiceRequestBuffer srb = service.createServiceRequestBuffer();
        srb.addArgument(action);
        setSecurityDatabaseArgument(srb);
        executeServicesOperation(service, srb);
    }
}
Also used : ServiceRequestBuffer(org.firebirdsql.gds.ServiceRequestBuffer) FbService(org.firebirdsql.gds.ng.FbService)

Aggregations

FbService (org.firebirdsql.gds.ng.FbService)29 ServiceRequestBuffer (org.firebirdsql.gds.ServiceRequestBuffer)20 SQLException (java.sql.SQLException)6 Test (org.junit.Test)1