Subject Re: [firebird-support] Meaning of fb_interpret parameters
Author Vlad Khorsun
> Good morning,

Good evening or even night ? ;)

> I recently decide to remove procedure isc_interprete to fb_interpret, but it looks like there are some problems
>
> I've tried with 2.0.4,2.0.5,2.1.1 and 2.1.2 embedded version but fb_interpret seems not return any error, while isc_interprete
> returns all error, as expected.

Both fb_interpret and isc_interprete returns length of just interpreted string.

isc_interprete inputs is
char* buffer - buffer where message will be stored
ISC_STATUS** vector - adress of pointer to the current status-vector item which is about
to interpret. This pointer is propagated to the next status-vector item.

isc_interprete is unsafe as it have no knowledge about buffer length and could easy overwrite
short user's buffer and corrupt memory in user application. Therefore safe replacement was
introduced : fb_interpret. It have the same input parameters plus buffer_length.

> To try this create a project but do not creare any .fdb file.
>
> Just a simple example
>
> isc_attach_database
> fb_interpret
> isc_sqlcode
> isc_sql_interprete
>
> After calling isc_attach_database function you should call fb_interpret to check if there are errors (in this case firebird should
> raise error -902).
>
> fb_interpret
> returns 0
> buffer is empty
> bufsize is 0

Because you passed zero bufsize into fb_interpret. It just did nothing.

> Status vector stored info parse by isc_sqlcode and isc_sql_interprete
> which result is error 902 message ...
>
> isc_interprete
> returns 50

Because it assumed non-zero buffer length and made its job. Buffer now contains
a string with length of 50.

> buffer display a message error (Error 902 message ..)
> Status vector stored info parse by isc_sqlcode and isc_sql_interprete
> which result is error 902 message ...
>
> So my question is .. What are the meaning of fb_intpret parameters?

Hope it is clear now for you ;)

Regards,
Vlad