isc_database_info() Call Example (API Guide)

From InterBase

Go Up to Requesting Information About an Attachment (API Guide)


The following code requests the page size and the number of buffers for the currently attached database, then examines the result buffer:

char db_items[] = {isc_info_page_size, isc_info_num_buffers, isc_info_ end};
char res_buffer[40], *p, item;
int length;
SLONG page_size = 0L, num_buffers = 0L;
ISC_STATUS status_vector[20];

isc_database_info( status_vector,
&handle, /* Set in previous isc_attach_database() call. */
sizeof(db_items), db_items, sizeof(res_buffer), res_buffer);
if (status_vector[0] == 1 && status_vector[1]) {
/* An error occurred. */
isc_print_status(status_vector);
return(1);
};
/* Extract the values returned in the result buffer. */
for (p = res_buffer; *p != isc_info_end ; ) {
item = *p++
length = isc_portable_integer(p, 2);
p += 2;
switch (item) {
case isc_info_page_size:
page_size = isc_portable_integer(p, length);
break;
case isc_info_num_buffers:
num_buffers = isc_portable_integer(p, length);
break;
default:
break;
}
p += length;
};

Advance To: