Skip to Content.
Sympa Menu

freetds - RE: [freetds] what size indicator

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] what size indicator
  • Date: Fri, 4 Jun 2004 14:50:39 +0200

>
> typedef struct tds_column
> {
> ...
> TDS_SMALLINT *column_nullbind;
> ...
> } TDSCOLUMN;
>
> blk_bind(CS_BLKDESC * blkdesc, CS_INT item, CS_DATAFMT *
> datafmt, CS_VOID
> * buffer, CS_INT * datalen, CS_SMALLINT * indicator)
>
> dbnullbind(DBPROCESS * dbproc, int column, DBINT * indicator)
> ^^^^^
>
> Bill,
>
> As you can see, db-lib defines the nullbind indicator as an
> address of a
> 32-bit pointer, and ct-lib a 16-bit pointer. Compiling db-lib with a
> modern compiler will yield complaints. (I take it yours is
> pre-modern, or
> you have the volume turned down. ;-) )
>
> How best to resolve this? I think we need to define it as 32-bits in
> TDSCOLUMN, and cast the ct-lib down to 16. I don't think
> anything else is
> safe. But I thought I'd check.
>
> Interestingly, the bugger used to be (as you know) CHAR*. I
> wonder why I
> never saw this warning before.
>
> Regards,
>

Last Bill patch change the pointer from TDS_CHAR* to TDS_INT *.

>From include/tds.h

...
/* related to binding or info stored by client libraries */
/* FIXME find a best place to store these data, some are unused
*/
TDS_SMALLINT column_bindtype;
TDS_SMALLINT column_bindfmt;
TDS_UINT column_bindlen;
TDS_SMALLINT *column_nullbind;
TDS_CHAR *column_varaddr;
TDS_INT *column_lenbind;
TDS_INT column_textpos;
TDS_INT column_text_sqlgetdatapos;
BCPCOLDATA *bcp_column_data;
...

These fields are only used by client libraries (not libTDS) so every
library should use as they like. Perhaps an union like

union {
struct {
...
} db;
struct {
...
} ct;
} lib;
would be better ??

>From this page
http://sybooks.sybase.com/onlinebooks/group-cn/cng1251e/comlib/@Generic_
_BookTextView/12663 blk_init declaration seems

CS_RETCODE blk_bind(blkdesc, colnum, datafmt, buffer,
datalen, indicator)

CS_BLKDESC *blkdesc;
CS_INT colnum;
CS_DATAFMT *datafmt;
CS_VOID *buffer;
CS_INT *datalen;
CS_SMALLINT *indicator;

however from the same page, below:

indicator

A pointer to a CS_INT variable, or for array binding, an array of
CS_INT. At row-transfer time, blk_rowxfer_mult or blk_rowxfer read the
indicator's contents to determine certain conditions about the bulk-copy
data. See the "List of Bulk-Library routines" section for details.

??? a pointer to CS_SMALLINT or to CS_INT ???

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page