Search in sources :

Example 31 with ServiceRequestBuffer

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

Example 32 with ServiceRequestBuffer

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

the class FBMaintenanceManager method setDatabaseAccessMode.

public void setDatabaseAccessMode(int mode) throws SQLException {
    if (mode != ACCESS_MODE_READ_WRITE && mode != ACCESS_MODE_READ_ONLY) {
        throw new IllegalArgumentException("mode must be one of ACCESS_MODE_READ_WRITE or ACCESS_MODE_READ_ONLY");
    }
    try (FbService service = attachServiceManager()) {
        ServiceRequestBuffer srb = createDefaultPropertiesSRB(service);
        srb.addArgument(isc_spb_prp_access_mode, (byte) mode);
        executeServicesOperation(service, srb);
    }
}
Also used : ServiceRequestBuffer(org.firebirdsql.gds.ServiceRequestBuffer) FbService(org.firebirdsql.gds.ng.FbService)

Example 33 with ServiceRequestBuffer

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

the class FBMaintenanceManager method executePropertiesOperation.

/**
 * Execute a isc_spb_prp_* (properties) services operation.
 *
 * @param operation
 *         The identifier for the operation to be executed
 * @throws SQLException
 *         if a database access error occurs
 */
private void executePropertiesOperation(int operation) throws SQLException {
    try (FbService service = attachServiceManager()) {
        ServiceRequestBuffer srb = createPropertiesSRB(service, operation);
        executeServicesOperation(service, srb);
    }
}
Also used : ServiceRequestBuffer(org.firebirdsql.gds.ServiceRequestBuffer) FbService(org.firebirdsql.gds.ng.FbService)

Example 34 with ServiceRequestBuffer

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

the class FBMaintenanceManager method setDefaultCacheBuffer.

public void setDefaultCacheBuffer(int pageCount) throws SQLException {
    if (pageCount != 0 && pageCount < 50) {
        throw new IllegalArgumentException("page count must be 0 or >= 50, value was: " + pageCount);
    }
    try (FbService service = attachServiceManager()) {
        ServiceRequestBuffer srb = createDefaultPropertiesSRB(service);
        srb.addArgument(isc_spb_prp_page_buffers, pageCount);
        executeServicesOperation(service, srb);
    }
}
Also used : ServiceRequestBuffer(org.firebirdsql.gds.ServiceRequestBuffer) FbService(org.firebirdsql.gds.ng.FbService)

Example 35 with ServiceRequestBuffer

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

the class FBMaintenanceManager method bringDatabaseOnline.

public void bringDatabaseOnline(byte operationMode) throws SQLException {
    if (operationMode != OPERATION_MODE_NORMAL && operationMode != OPERATION_MODE_MULTI && operationMode != OPERATION_MODE_SINGLE) {
        throw new IllegalArgumentException("Operation mode must be " + "one of: OPERATION_MODE_NORMAL, OPERATION_MODE_MULTI, OPERATION_MODE_SINGLE");
    }
    try (FbService service = attachServiceManager()) {
        ServiceRequestBuffer srb = createDefaultPropertiesSRB(service);
        srb.addArgument(isc_spb_prp_online_mode, operationMode);
        executeServicesOperation(service, srb);
    }
}
Also used : ServiceRequestBuffer(org.firebirdsql.gds.ServiceRequestBuffer) 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