Subject | Re: [Firebird-Architect] Re: C API Upgrade? |
---|---|
Author | Ivan Prenosil |
Post date | 2008-02-01T00:37:23Z |
> 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) +
FormatPBParam(isc_dpb_sql_role_name, Role.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
> information
> and data. An additional null byte would be allocated for string based
> data.
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)
Ivan