Search in sources :

Example 6 with FbService

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

the class FBMaintenanceManager method handleTransaction.

private void handleTransaction(final long transactionId, final int action32bit, final int action64bit) throws SQLException {
    if (transactionId < 0) {
        throw new SQLException("Only positive transactionIds are supported");
    }
    final boolean is32Bit = NumericHelper.fitsUnsigned32BitInteger(transactionId);
    try (FbService service = attachServiceManager()) {
        ServiceRequestBuffer srb = createDefaultRepairSRB(service);
        srb.addArgument(is32Bit ? action32bit : action64bit, transactionId);
        executeServicesOperation(service, srb);
    }
}
Also used : ServiceRequestBuffer(org.firebirdsql.gds.ServiceRequestBuffer) SQLException(java.sql.SQLException) FbService(org.firebirdsql.gds.ng.FbService)

Example 7 with FbService

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

the class FBMaintenanceManager method shutdownDatabase.

// ----------- Database Shutdown -------------------
public void shutdownDatabase(int shutdownMode, int timeout) throws SQLException {
    if (shutdownMode != SHUTDOWN_ATTACH && shutdownMode != SHUTDOWN_TRANSACTIONAL && shutdownMode != SHUTDOWN_FORCE) {
        throw new IllegalArgumentException("Shutdown mode must be " + "one of: SHUTDOWN_ATTACH, SHUTDOWN_TRANSACTIONAL, SHUTDOWN_FORCE");
    }
    if (timeout < 0) {
        throw new IllegalArgumentException("Timeout must be >= 0");
    }
    try (FbService service = attachServiceManager()) {
        ServiceRequestBuffer srb = createDefaultPropertiesSRB(service);
        srb.addArgument(shutdownMode, timeout);
        executeServicesOperation(service, srb);
    }
}
Also used : ServiceRequestBuffer(org.firebirdsql.gds.ServiceRequestBuffer) FbService(org.firebirdsql.gds.ng.FbService)

Example 8 with FbService

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

the class FBMaintenanceManager method setPageFill.

public void setPageFill(int pageFill) throws SQLException {
    if (pageFill != PAGE_FILL_FULL && pageFill != PAGE_FILL_RESERVE) {
        throw new IllegalArgumentException("Page fill must be either PAGE_FILL_FULL or PAGE_FILL_RESERVE");
    }
    try (FbService service = attachServiceManager()) {
        ServiceRequestBuffer srb = createDefaultPropertiesSRB(service);
        srb.addArgument(isc_spb_prp_reserve_space, (byte) pageFill);
        executeServicesOperation(service, srb);
    }
}
Also used : ServiceRequestBuffer(org.firebirdsql.gds.ServiceRequestBuffer) FbService(org.firebirdsql.gds.ng.FbService)

Example 9 with FbService

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

the class FBStatisticsManager method getTableStatistics.

public void getTableStatistics(String[] tableNames) throws SQLException {
    // create space-separated list of tables
    StringBuilder commandLine = new StringBuilder();
    for (int i = 0; i < tableNames.length; i++) {
        commandLine.append(tableNames[i]);
        if (i < tableNames.length - 1)
            commandLine.append(' ');
    }
    try (FbService service = attachServiceManager()) {
        ServiceRequestBuffer srb = createStatsSRB(service, isc_spb_sts_table);
        srb.addArgument(SpbItems.isc_spb_command_line, commandLine.toString());
        executeServicesOperation(service, srb);
    }
}
Also used : ServiceRequestBuffer(org.firebirdsql.gds.ServiceRequestBuffer) FbService(org.firebirdsql.gds.ng.FbService)

Example 10 with FbService

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

the class FBTraceManager method listTraceSessions.

/**
 * List all currently registered trace sessions
 *
 * @throws SQLException
 */
public void listTraceSessions() throws SQLException {
    try (FbService service = attachServiceManager()) {
        service.startServiceAction(getTraceSPB(service, isc_action_svc_trace_list));
        queueService(service);
    } catch (IOException ioe) {
        throw new SQLException(ioe);
    }
}
Also used : SQLException(java.sql.SQLException) 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