Search in sources :

Example 26 with ServiceRequestBuffer

use of org.firebirdsql.gds.ServiceRequestBuffer in project jaybird by FirebirdSQL.

the class FBStatisticsManager method getHeaderPage.

public void getHeaderPage() throws SQLException {
    try (FbService service = attachServiceManager()) {
        ServiceRequestBuffer srb = createStatsSRB(service, isc_spb_sts_hdr_pages);
        executeServicesOperation(service, srb);
    }
}
Also used : ServiceRequestBuffer(org.firebirdsql.gds.ServiceRequestBuffer) FbService(org.firebirdsql.gds.ng.FbService)

Example 27 with ServiceRequestBuffer

use of org.firebirdsql.gds.ServiceRequestBuffer in project jaybird by FirebirdSQL.

the class FBStatisticsManager method getDatabaseStatistics.

public void getDatabaseStatistics() throws SQLException {
    try (FbService service = attachServiceManager()) {
        ServiceRequestBuffer srb = createDefaultStatsSRB(service);
        executeServicesOperation(service, srb);
    }
}
Also used : ServiceRequestBuffer(org.firebirdsql.gds.ServiceRequestBuffer) FbService(org.firebirdsql.gds.ng.FbService)

Example 28 with ServiceRequestBuffer

use of org.firebirdsql.gds.ServiceRequestBuffer 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 29 with ServiceRequestBuffer

use of org.firebirdsql.gds.ServiceRequestBuffer in project jaybird by FirebirdSQL.

the class FBTraceManager method getTraceSPB.

/**
 * Creates and returns the "trace" service request buffer for the Service
 * Manager.
 *
 * @param service Service handle
 * @param action
 *         The isc_action_svc_trace_* action to be used
 * @param traceSessionId
 *         The trace session ID
 * @return the "trace" service request buffer for the Service Manager.
 * @throws SQLException
 */
private ServiceRequestBuffer getTraceSPB(FbService service, int action, int traceSessionId) throws SQLException {
    ServiceRequestBuffer traceSPB = getTraceSPB(service, action);
    traceSPB.addArgument(isc_spb_trc_id, traceSessionId);
    return traceSPB;
}
Also used : ServiceRequestBuffer(org.firebirdsql.gds.ServiceRequestBuffer)

Example 30 with ServiceRequestBuffer

use of org.firebirdsql.gds.ServiceRequestBuffer 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)

Aggregations

ServiceRequestBuffer (org.firebirdsql.gds.ServiceRequestBuffer)40 FbService (org.firebirdsql.gds.ng.FbService)20 SQLException (java.sql.SQLException)10 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 IOException (java.io.IOException)2 OutputStream (java.io.OutputStream)2 FBManager (org.firebirdsql.management.FBManager)2 Test (org.junit.Test)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 FileOutputStream (java.io.FileOutputStream)1 ServiceParameterBuffer (org.firebirdsql.gds.ServiceParameterBuffer)1 AbstractFbWireService (org.firebirdsql.gds.ng.wire.AbstractFbWireService)1 FbWireService (org.firebirdsql.gds.ng.wire.FbWireService)1 WireServiceConnection (org.firebirdsql.gds.ng.wire.WireServiceConnection)1