Subject How to query using isc_info_svc_svr_db_info service ?
Author ece1a04
I am writing a set of C library routines to manage the Interbase /
Firebird. I had tried with both Firebird 1.5 and interbase 6 to try
out the routines. When the isc_info_svc_svr_db_info item is placed
in the request table the returned value from the server are :

0x32 0x04 0x00 0x02 0x00 0x00 0x00 0x32 0x04 0x00 0x02 0x00 0x00
0x01 0x00 ..

The rest of the 100 byte dump are zeroes. By doing a manual
decoding 0x32(50) is the value for isc_info_svc_svr_db_info. This is
correct and is expected However the additional arguments of :

isc_spb_num_att , (0x05)
isc_spb_num_db , (0x06)
isc_spb_dbname (0x6A)
and isc_info_flag_end (0x7F)

are missing.

To test this out I have 2 processes attached to 2 separate
databases. I used IBConsole to check if it could detect the number
of attachment and databases. It could.

I have looked through ibx admin source code to see how it was done
and the codes doesn't differ much from what I have used. However in
the Ibx admin source code it checks for each of the arguments
following isc_info_svc_svr_db_info. If it is not present a parsing
error message is generated.

What am I doing wrong ? Is there something else that I need to do.
Please help ! Thanks.

Codes I used to extract the information . No error was generated at
the request stage (checked using (status[0] == 1 && status[1]))

I have changed my code to follow the IBX admin source code.

/* Extract data from result Buffer */
if (*p == isc_info_svc_svr_db_info)
p++ ; // move to next argument
NumberOfDatabases = 0 ;
NumberOfAttachments = 0 ;

if (*p != isc_spb_num_att)
GenerateParsingError() ;
return ;

p += sizeof(unsigned short);// point at isc_spb_num_att data
NumberOfAttachments = (unsigned long) isc_vax_integer(p,sizeof
(unsigned long)) ;

p += sizeof(unsigned long) ;// move to next argument

if (*p != isc_spb_num_db)
GenerateParsingError() ;
return ;

p += sizeof(unsigned short) ;
NumberOfDatabases = (unsigned long) isc_vax_integer(p , sizeof
(unsigned long)) ;

p += sizeof(unsigned long) ; // point to next argument.

if (*p != isc_spb_dbname)
GenerateParsingError() ;
return ;

i = 0 ;
// read in all the databases name
while (*p != isc_info_flag_end)
/* Data base name in use */
path_length = (unsigned short) isc_vax_integer(p, sizeof(unsigned
short)) ;
p += sizeof(unsigned short) ;
DBName[i] = (char *) malloc(path_length+1) ;
strncpy(DBName[i] , p , path_length) ;
DBName[i][path_length] = 0 ;

p += path_length ;
i++ ;

----- the rest of the code -----