Subject isc_info_svc_svr_db_info query does not return database name
Author ece1a04
I am writing a set of C library routines to manage the Interbase /
Firebird. I am using Firebird 1.5 to try out the routines. When the
isc_info_svc_svr_db_info configuration items is included in the
request table all it returns are the following :

32 04 00 02 00 00 00 32 04 00 02 00 00 01 00 ..

The numbers are in hexadecimal. They are all zeroes after this.
0x32(50) is the value for isc_info_svc_svr_db_info. However the
additional arguments of :

isc_spb_num_att ,
isc_spb_num_db ,
isc_spb_dbname
and isc_info_flag_end

are missing.

Because isc_info_flag_end is missing my code crashed as it was
looking for isc_info_flag_end.

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.

What am I doing wrong ? Please help !


Codes I used to extract the information :

/* Extract data from result Buffer */
do
{
switch(*p++)
{
- - - other working services here -----

case isc_info_svc_svr_db_info :
{
NumberOfDatabases = 0 ;
NumberOfAttachments = 0 ;
do
{
switch(*p++)
{
case isc_spb_dbname :
{
/* Data base name in use */
path_length = (unsigned short) isc_vax_integer(p
, sizeof(unsigned short)) ;
p += sizeof(unsigned short) ;
DBName[NumberOfDatabases] = (char *)
malloc(path_length+1) ;
strncpy(DBName[NumberOfDatabases] , p ,
path_length) ;
DBName[NumberOfDatabases][path_length] = 0 ;

p += path_length ;
NumberOfDatabases++ ;
break ;
}

case isc_spb_num_att :
{
p += sizeof(unsigned short) ;
NumberOfAttachments = (unsigned long)
isc_vax_integer(p , sizeof(unsigned long)) ;

p += sizeof(unsigned long) ;

break ;
}

case isc_spb_num_db :
{
unsigned long nDatabases ;

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

p += sizeof(unsigned long) ;

break ;
}
}
} while (*p != isc_info_flag_end) ;

break ;

..... the rest of the codes .......