use of org.firebirdsql.gds.ServiceRequestBuffer in project jaybird by FirebirdSQL.
the class FBNBackupManager method getFixupSRB.
private ServiceRequestBuffer getFixupSRB(FbService service) {
ServiceRequestBuffer restoreSPB = service.createServiceRequestBuffer();
restoreSPB.addArgument(isc_action_svc_nfix);
restoreSPB.addArgument(isc_spb_dbname, getDatabase());
int options = getOptions();
if (options != 0) {
restoreSPB.addArgument(isc_spb_options, options);
}
return restoreSPB;
}
use of org.firebirdsql.gds.ServiceRequestBuffer 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);
}
}
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 traceSessionName
* The trace session name
* @param configuration
* The trace configuration. For an example, look into fbtrace.conf in the root directory of your Firebird
* installation
* @return the "trace" service request buffer for the Service Manager.
* @throws SQLException
*/
private ServiceRequestBuffer getTraceSPB(FbService service, int action, String traceSessionName, String configuration) throws SQLException {
ServiceRequestBuffer traceSPB = getTraceSPB(service, action);
traceSPB.addArgument(isc_spb_trc_name, traceSessionName);
traceSPB.addArgument(isc_spb_trc_cfg, configuration);
return traceSPB;
}
use of org.firebirdsql.gds.ServiceRequestBuffer in project jaybird by FirebirdSQL.
the class FBUserManager method getUserSRB.
/**
* Generate the service request buffer for the specified action.
*
* @param service
* Service handle
* @param action
* @param user
* @return the service request buffer for the specified action.
*/
private ServiceRequestBuffer getUserSRB(FbService service, int action, User user) {
ServiceRequestBuffer srb = service.createServiceRequestBuffer();
srb.addArgument(action);
if (user.getUserName() != null) {
srb.addArgument(isc_spb_sec_username, user.getUserName());
}
if (user.getPassword() != null) {
srb.addArgument(isc_spb_sec_password, user.getPassword());
}
if (user.getFirstName() != null) {
srb.addArgument(isc_spb_sec_firstname, user.getFirstName());
}
if (user.getMiddleName() != null) {
srb.addArgument(isc_spb_sec_middlename, user.getMiddleName());
}
if (user.getLastName() != null) {
srb.addArgument(isc_spb_sec_lastname, user.getLastName());
}
if (user.getUserId() != -1) {
srb.addArgument(isc_spb_sec_userid, user.getUserId());
}
if (user.getGroupId() != -1) {
srb.addArgument(isc_spb_sec_groupid, user.getGroupId());
}
return srb;
}
use of org.firebirdsql.gds.ServiceRequestBuffer in project jaybird by FirebirdSQL.
the class FBUserManager method userAction.
/**
* Perform the specified action.
*
* @param action
* @param user
* @throws SQLException
* @throws IOException
*/
private void userAction(int action, User user) throws SQLException, IOException {
try (FbService service = attachServiceManager()) {
ServiceRequestBuffer srb = getUserSRB(service, action, user);
setSecurityDatabaseArgument(srb);
executeServicesOperation(service, srb);
}
}
Aggregations