Subject fb_interpret does not do argument substtitution for database error messsages
Author scstdenis
I get messages like "Table @1 does not exist." I know the ssecond
cluster contains an address for the table name. Should fb_interpret
be in a loop like isc_interprete had to be?

I am running Firebird 2.1.0 on Windows XP (SP2).

Thanks for your help in advance.

Code:

int BuildFBMessage(ISC_STATUS* ErrorCodes, char* buf) {
short SQLCODE;
char s[1024], *t, *p;
const ISC_STATUS *pvector = ErrorCodes;

t = buf;
SQLCODE = isc_sqlcode(ErrorCodes);

/* Check if status vector contains an error. */
if (ErrorCodes[0] == 1 && ErrorCodes[1] > 0) {

/* Check if there is a valid SQL error code */
if (SQLCODE != -999) {
sprintf(s, "SQLCODE = %d: ", SQLCODE);
for(p = s; *p; ){
*t++ = *p++;
}

/* Build the SQL error message text from
SQLCODE. */
isc_sql_interprete(SQLCODE, s, 256);
for(p = s; *p; ){
*t++ = *p++;
}
*t++ = '\n';

}
/* Build the interbase error message text from the
status vector. */
while(fb_interpret(s, sizeof(s), &pvector)) {
for(p = s; *p; ){
*t++ = *p++;
}
*t++ = '\n';
} // End While
*t = '\0';
printf("buf: %s\n", buf);
}
else
strcpy(t,"No error.\n\n");

return SUCCESS;
}