|Subject||Re: [Firebird-Architect] Re: C API Upgrade?|
> 1. The DPBIn my Delphi programs, connecting to the database consists of two statements:
> This is certainly an area where the developer is required to manipulate
> something in a way that is very clumsy and error prone.
dpb := isc_dpb_version1 +
FormatPBParam(isc_dpb_user_name, User.Text) +
FormatPBParam(isc_dpb_password, Pwd.Text) +
isc_attach_database(status_vector, 0, db_name, Fdb, Length(dpb), dpb);
(where helper function FormatPBParam() contains single statement)
I can't imagine anything simpler :)
> 2. The XSQLDA...
> isc_dsql_allocate_xsqlda(XSQLDA **xsqlda, unsigned short xsqlda_size)But XSQLDA is client side sturcture, and different programing environments
> This function would allocate the initial XSQLDA with some reasonable size
> if none
> was specified.
can prefere different memory managers.
> isc_dspl_prepare_xsqlda(XSQLDA *xsqlda)FB does not retrieve data as zero terminated string,
> This function would handle all of the required memory allocation for both
> and data. An additional null byte would be allocated for string based
and not all languages use such "structure" either.
> 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)
> short isc_dsql_get_type(XSQLDA *xsqlda, unsigned short colno)Type of the column ? You can read it directly from xsqlda, what else is such function
expected to do ? In delphi it is just
xsqlda.sqlvar[col].sqltype and $FFFFFFFE
> void *isc_dsql_get_bytes(XSQLDA *xsqlda, unsigned short colno)So these functions would allocate memory for result ? It can be awkward
> char *isc_dsql_get_string(XSQLDA *xsqlda, unsigned short colno)
for some languages.
> long isc_dsql_get_long(XSQLDA *xsqlda, unsigned short colno)You omitted the more complicated scaled numbers and date/time
(because support for such types vary between different languages)