Subject Re: [Firebird-Architect] Re: C API Upgrade?
Author Vitaly Prapirny
Ivan Prenosil wrote:
> >> > char *isc_dsql_get_name(XSQLDA *xsqlda, unsigned short colno)
> >>
> >> Do you mean name of the column ? It is stored in xsqlda, just read it.
> >> In Delphi it is just
> >>
> >> Copy(xsqlda.sqlvar[col].sqlname, 1, xsqlda.sqlvar[col].sqlname_length)
> >
> > But this is more clear and omits dependence from XSQLDA internals:
> >
> > name = isc_dsql_get_name(xsqlda, col);
>
> It looks much better.
>
> But, what would such function exactly do ? Allocate the memory and copy
> the name into it ? It is perhaps good for C, but useless for Delphi where
> I would need to copy it again into string and free the memory.

You could use another new function isc_dsql_get_name2(xsqlda, col, name,
maxlen) that fills preallocated memory or even don't change your Delphi
code at all. If some function doesn't hit your target - don't use it. If
one day sqlname field become null-terminated than this function can
simply return appropriate pointer.

> And do you think language specific helper functions belong to general API ?

It is C API and some C helper functions should be justified. Helper
functions and access libraries for other languages from official
sources would be great also.

> Would not short include file with simple macro do the same for C
> programmers ?
> (and I agree that such official include would be nice)

Old include file or new include file or even new library - it doesn't
matter for novice users.

Good luck!
Vitaly

P.S. I understand that fb community resources is limited :)