Subject Re: [ib-support] API XSQLVAR struct ?
Author William L. Thomson Jr.
On Tue, 2002-07-23 at 13:10, Raul Chirea wrote:
> Hi William,
> That is because you set the output type for all fields to be SQL_VARYING:
> > 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++.

Ok, let me see if I can make my question easier.
What type of var array should I create so I can get the output out of

osqlda->sqlvar[i].sqldata = // <- Here

It says it is a char * and returns the location of the data.

osqlda->sqlvar[i].sqltype = SQL_TEXT;

But if I pass a char * var to it I have problems. Now I have swapped to
SQL_TEXT instead of SQL_VARYING. But I will have to later on create an
switch case statement to retrieve the different types of data. Or is
that even needed, since any number can become a char */[], and I can
cast it back to a number from there?

> HTH !
> Raul.
> PS: Thanking me once per message is more than enough !

Ok, I just do really appreciate your assistance. As you can see I still
have a lot to learn about C/C++. Good thing the app I am developing is
for in house use. So if it fails, and at some point it will until my
skills improve, it will not effect my cash flow to much. :)

So my single Thanks Raul :)

William L. Thomson Jr.
Support Group
Obsidian-Studios Inc.
439 Amber Way
Petaluma, Ca. 94952
Phone 707.766.9509
Fax 707.766.8989