freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: [freetds] Rows truncated at 176 chars when using CT-Lib interface
- From: Frediano Ziglio <freddy77 AT gmail.com>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] Rows truncated at 176 chars when using CT-Lib interface
- Date: Wed, 29 Apr 2009 11:18:56 +0200
2009/4/29 Alejandro Guerrieri <alejandro.guerrieri AT gmail.com>:
> Frediano,
> Thanks for replying.
>
> I've just solved the issue. The problem was with the CS_DATAFMT structure
> member not being a pointer. I've replaced by:
>
Mmm.... quite strange... I think that real problem is ct_bind, on
first mail you have
ct_bind(conn->command, i+1, &data[i].format, &data[i].data,
&data[i].size, &data[i].ind);
while on second
ct_bind(conn->command, i+1, data[i].format, data[i].data,
&data[i].size, &data[i].ind);
you have changed data[i].format cause you used a pointer but
data[i].data change is the real fix.
freddy77
> struct data_s {
>
> CS_CHAR *data;
>
> CS_DATAFMT *format;
>
> CS_INT size;
>
> CS_SMALLINT ind;
>
> };
>
> struct data_s *data;
>
> And fixed the references on the code:
>
> data[i].format = malloc(sizeof(CS_DATAFMT));
>
> memset(data[i].format, 0, sizeof(CS_DATAFMT));
>
> if (ct_describe(conn->command, i+1, data[i].format) != CS_SUCCEED) {
>
> error(0, "Error fetching column description");
>
> free(data);
>
> return -1;
>
> }
>
> data[i].format->maxlength++;
>
> data[i].data = malloc(data[i].format->maxlength);
>
> data[i].format->datatype = CS_CHAR_TYPE;
>
> data[i].format->format = CS_FMT_NULLTERM;
>
> ct_bind(conn->command, i+1, data[i].format, data[i].data,
>
> &data[i].size, &data[i].ind);
>
> And that was it :)
>
> Regarding the select, it's a simple command:
>
> ct_command(conn->command, CS_LANG_CMD,
>
> "SELECT col1, col2, col3 FROM table",
>
> CS_NULLTERM, CS_UNUSED);
>
-
[freetds] Rows truncated at 176 chars when using CT-Lib interface,
Alejandro Guerrieri, 04/27/2009
-
Re: [freetds] Rows truncated at 176 chars when using CT-Lib interface,
Frediano Ziglio, 04/29/2009
-
Re: [freetds] Rows truncated at 176 chars when using CT-Lib interface,
Alejandro Guerrieri, 04/29/2009
-
Re: [freetds] Rows truncated at 176 chars when using CT-Lib interface,
Frediano Ziglio, 04/29/2009
- Re: [freetds] Rows truncated at 176 chars when using CT-Lib interface, Alejandro Guerrieri, 04/29/2009
-
Re: [freetds] Rows truncated at 176 chars when using CT-Lib interface,
Frediano Ziglio, 04/29/2009
-
Re: [freetds] Rows truncated at 176 chars when using CT-Lib interface,
Alejandro Guerrieri, 04/29/2009
-
Re: [freetds] Rows truncated at 176 chars when using CT-Lib interface,
Frediano Ziglio, 04/29/2009
Archive powered by MHonArc 2.6.24.