Subject | Re: [ib-support] API XSQLVAR struct ? |
---|---|
Author | Raul Chirea |
Post date | 2002-07-23T20:10:38Z |
Hi William,
From: "William L. Thomson Jr." <support@...>
VARCHAR means that at the begining of the data buffer first 2 bytes contains
a short int (2 bytes) and next bytes are the string itself having a length
indicated by that short int at the begining of buffer. Note that the string
is not a NULL terminated string.
Instead of converting output data to VARCHAR (SQL_VARYING) you should
convert it to SQL_TEXT which is the standard NULL terminated string used in
C/C++.
HTH !
Raul.
PS: Thanking me once per message is more than enough !
:-)))
From: "William L. Thomson Jr." <support@...>
> I then do a loop like....
>
> for(int i=0;i<num_cols;i++) {
> osqlda->sqlvar[i].sqldata = (char *)&var[i];
> osqlda->sqlvar[i].sqltype = SQL_VARYING + 1;
> osqlda->sqlvar[i].sqlind = &flag[i];
> }
> So I am asking why the only way I can get at the data is by passing aThat is because you set the output type for all fields to be SQL_VARYING:
> struct.
>
> osqlda->sqlvar[i].sqldata = (char *)&var[i];
>
> and then doing
>
> var[i].var_string
>
> To get at my data. I would like to not use a struct if possible?
> But every attempt at something other than a struct fails?
> osqlda->sqlvar[i].sqltype = SQL_VARYING + 1;This way the server+API converts data in a field to VARCHAR.
VARCHAR means that at the begining of the data buffer first 2 bytes contains
a short int (2 bytes) and next bytes are the string itself having a length
indicated by that short int at the begining of buffer. Note that the string
is not a NULL terminated string.
Instead of converting output data to VARCHAR (SQL_VARYING) you should
convert it to SQL_TEXT which is the standard NULL terminated string used in
C/C++.
HTH !
Raul.
PS: Thanking me once per message is more than enough !
:-)))