Problem: I used the isc_database_info() function to request a list of users connected to a database. The function returned successfully and placed results in a result buffer. How do I make sense of the information returned in the result buffer. Solution: The isc_database_info() API call is used to obtain information about a database that a process is currently attached to. The isc_database_info() function accepts a buffer called the item_list_buffer where requests for specific types of information is placed in this buffer. One type of information that can be requested is a list of name connected to the database. This information is requested by placing the isc_info_user_names constant in the item_list_buffer. The isc_database_info() function also accepts a buffer called a result_buffer where it places the results of trying to fulfill the request for information. When InterBase API function calls return results in a result buffer, the buffer usually has the following format: byte 0 - topic (a 1 byte entry) byte 1 - length of result (a 2 byte entry) byte 3 - result (a variable length entry) byte m - next topic byte m+1 - length of result byte m+3 - result byte n - next topic and so forth . . . - In this case the topic is isc_info_user_names - for the length of the result use the isc_vax_integer(, 2) to reverse the byte ordering to get the proper length of the result for the isc_info_user_names topic. - The result bytes are composed as follows for the isc_info_user_name topic: . . . where each of the user name elements are formatted similar to how a pascal string is formatted, like so: <1 byte indicating the length of the following text string> In this way the result buffer can be parsed for multiple user names without unexpectedly overrunning or under-running a buffer. For example, a result buffer might looked as follows after calling the isc_database_info() with the isc_info_user_names in the item_list_buffer: 53, 8, 0, 7, 'P', 'P', 'O', 'W', 'E', 'R', 'S', 1
Last Modified: 26-OCT-00