Services API Query Example
From InterBase
Go Up to Querying the Services Manager
In this chapter, a complete C/C++ code sample shows use of the isc_service_query()
function. The sample is split into several parts, to illustrate query items described in later sections. The code sample assumes that you have successfully attached to a Services Manager (see Attaching to the Services Manager with isc_service_attach( )) and that you have a valid service handle.
The first part of the example shows how to set up the request buffer and invoke isc_service_query()
.
Services API queries: setting up and invoking the query
char spb_buffer[6], *spb = spb_buffer;
char request_buffer[] = {
isc_info_svc_server_version,
isc_info_svc_implementation,
isc_info_svc_get_licensed_users,
isc_info_svc_user_dbpath,
isc_info_svc_get_env,
isc_info_svc_get_env_lock,
isc_info_svc_get_env_msg,
isc_info_svc_get_license,
isc_info_svc_svr_db_info,
isc_info_svc_version,
isc_info_svc_get_config};
char result_buffer[1024], *p = result_buffer;
*spb++ = isc_info_svc_timeout;
ADD_SPB_NUMERIC(spb, 60); /* 1 minute timeout */
if (isc_service_query (status, &service_handle, NULL, spb - spb_buffer,
spb_buffer, sizeof(request_buffer), request_buffer,
sizeof(result_buffer), result_buffer)) {
isc_print_status(status);
isc_service_detach(status, &svc_handle);
return;
}
do {
switch (*p++)
{
. . .
The code sample is continued in later examples.