/**
   * Creates and returns the "backup" service request buffer for the Service Manager.
   *
   * @param service Service handle
   * @param options The isc_spb_bkp_* parameters options to be used
   * @return the "backup" service request buffer for the Service Manager.
   */
  protected ServiceRequestBuffer getBackupSRB(FbService service, int options) throws SQLException {
    ServiceRequestBuffer backupSPB = service.createServiceRequestBuffer();
    backupSPB.addArgument(isc_action_svc_backup);
    backupSPB.addArgument(isc_spb_dbname, getDatabase());
    addBackupsToBackupRequestBuffer(service, backupSPB);

    if (verboseBackup()) {
      backupSPB.addArgument(isc_spb_verbose);
    }

    backupSPB.addArgument(isc_spb_options, options);

    return backupSPB;
  }
  /**
   * Creates and returns the "backup" service request buffer for the Service Manager.
   *
   * @param service Service handle
   * @param options The options to be used for the backup operation
   * @return the "backup" service request buffer for the Service Manager.
   */
  protected ServiceRequestBuffer getRestoreSRB(FbService service, int options) {
    ServiceRequestBuffer restoreSPB = service.createServiceRequestBuffer();
    restoreSPB.addArgument(isc_action_svc_restore);

    // restore files with sizes except the last one
    for (Iterator<PathSizeStruct> iter = restorePaths.iterator(); iter.hasNext(); ) {
      PathSizeStruct pathSize = iter.next();

      restoreSPB.addArgument(isc_spb_dbname, pathSize.getPath());

      if (iter.hasNext() && pathSize.getSize() != -1) {
        restoreSPB.addArgument(isc_spb_res_length, pathSize.getSize());
      }
    }

    addBackupsToRestoreRequestBuffer(service, restoreSPB);

    if (restoreBufferCount != -1) {
      restoreSPB.addArgument(isc_spb_res_buffers, restoreBufferCount);
    }

    if (restorePageSize != -1) {
      restoreSPB.addArgument(isc_spb_res_page_size, restorePageSize);
    }

    restoreSPB.addArgument(
        isc_spb_res_access_mode,
        (byte) (restoreReadOnly ? isc_spb_res_am_readonly : isc_spb_res_am_readwrite));

    if (verbose) {
      restoreSPB.addArgument(isc_spb_verbose);
    }

    if ((options & RESTORE_CREATE) != RESTORE_CREATE
        && (options & RESTORE_REPLACE) != RESTORE_REPLACE) {
      options |= restoreReplace ? RESTORE_REPLACE : RESTORE_CREATE;
    }

    restoreSPB.addArgument(isc_spb_options, options);

    return restoreSPB;
  }