Skip to Content.
Sympa Menu

freetds - Re: ct_res_info(...CS_ROW_COUNT...) core dump

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Mark Schaal <mark AT champ.tstonramp.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Re: ct_res_info(...CS_ROW_COUNT...) core dump
  • Date: Thu, 16 Nov 2000 14:24:24 -0800 (PST)


>
> I've been working on a project called SQL Relay for some time now and
> recently added functionality for returning the number of affected rows.
>
> In my FreeTDS connection, I've had to comment out the code that gets the
> number of affected rows because invoking ct_res_info(...CS_ROW_COUNT...)
> causes a core dump.
>
> My code is available at http://sourceforge.net/projects/sqlrelay
> In the distribution, the specific file that has the problem is
> src/connections/freetds/freetdsconnection.C
>
> I worked from sqsh as an example, and I don't think I'm doing anything
> wrong. Is this a known bug? Is there a workaround?
>
> Thanks,
>
> David Muse
> david.muse AT zapmedia.com

It is a known bug, actually scheduled for fixing before the
next release. I'm not updating the source until this release
becomes official, but I've appended a patch that should fix
the problem. Be warned I haven't done any testing. Please
let us know if this works or not.

Hope that helps,

Mark
--
Mark J. Schaal Phone: (909) 620-7724
TST On Ramp Fax: (909) 620-8174
System Administrator E-Mail: mark AT tstonramp.com


Index: ct.c
===================================================================
RCS file: /Repository/freetds/src/ctlib/ct.c,v
retrieving revision 1.57
diff -c -r1.57 ct.c
*** ct.c 2000/11/04 20:41:43 1.57
--- ct.c 2000/11/16 22:16:09
***************
*** 753,761 ****
}
CS_RETCODE ct_res_info(CS_COMMAND *cmd, CS_INT type, CS_VOID *buffer,
CS_INT b
uflen, CS_INT *out_len)
{
! TDSRESULTINFO *resinfo = cmd->con->tds_socket->res_info;
CS_INT int_val;

tdsdump_log("%L inside ct_res_info()\n");
switch(type) {
case CS_NUMDATA:
--- 753,766 ----
}
CS_RETCODE ct_res_info(CS_COMMAND *cmd, CS_INT type, CS_VOID *buffer,
CS_INT b
uflen, CS_INT *out_len)
{
! TDSRESULTINFO *resinfo;
CS_INT int_val;

+ if (!cmd || !cmd->con || !cmd->con->tds_socket) {
+ return CS_FAIL;
+ }
+ resinfo = cmd->con->tds_socket->res_info;
+
tdsdump_log("%L inside ct_res_info()\n");
switch(type) {
case CS_NUMDATA:
***************
*** 763,769 ****
memcpy(buffer, &int_val, sizeof(CS_INT));
break;
case CS_ROW_COUNT:
! int_val = resinfo->row_count;
memcpy(buffer, &int_val, sizeof(CS_INT));
break;
default:
--- 768,778 ----
memcpy(buffer, &int_val, sizeof(CS_INT));
break;
case CS_ROW_COUNT:
! if (resinfo) {
! int_val = resinfo->row_count;
! } else {
! int_val = cmd->con->tds_socket->rows_affected;
! }
memcpy(buffer, &int_val, sizeof(CS_INT));
break;
default:




Archive powered by MHonArc 2.6.24.

Top of Page