Skip to Content.
Sympa Menu

freetds - RE: dbdata() call inconsistent...

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Shivakumar, Pravinkumar (ODC - Satyam)" <PShivakumar AT Satyam.odc.ml.com>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: RE: dbdata() call inconsistent...
  • Date: Wed, 11 Sep 2002 16:43:28 +0530

This is what is happenning...

When I use dbdata to get only on int from each row it works coool,but the
moment I use dbdata with 2 int's from the same row it core dumps,and this
seems to happen only with INT's cos it works coool with varchar's calling
dbdata for multiple varchars in the same row...

The problem seems to be with MSSQL,it work perfect with sybase...



** CODE SNIPPET**


#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
#include <sqlfront.h>
#include <sqldb.h>

int main(int argc, char *argv[])
{
LOGINREC *login;
DBPROCESS *dbproc;

dbinit();
login = dblogin();
DBSETLPWD(login,***");
DBSETLUSER(login,***);
DBSETLAPP(login,***);

dbproc = dbopen(login,***);
dbuse(dbproc,****);
dbcmd(dbproc,"select col1 col2 from tab1"); //here col1 and col2 r
of type INT
dbsqlexec(dbproc);
dbresults(dbproc);

while (dbnextrow(dbproc) != NO_MORE_ROWS)
{

BYTE * tem1 = dbdata(dbproc,1);
BYTE * tem2 = dbdata(dbproc,2);

int temp1 = *((int *) tem1);
int temp2 = *((int *) tem2);

printf(" First INT value : %d\n",temp1);
printf("Second INT value : %d\n",temp2);

}

dbclose(dbproc);
dbexit();
}

Am I missing anything,
Thanks,
Pravin Kumar S


> ----------
> From: Marc Spoorendonk[SMTP:Marc.spoorendonk AT Globalocity.com]
> Reply To: TDS Development Group
> Sent: Tuesday, September 10, 2002 12:10 PM
> To: TDS Development Group
> Subject: [freetds] RE: dbdata() call inconsistent...
>
> please post your code snippet to the mailing list. I've used the dbdata()
> successfully...
>
> I'm not sure what level of C knowledge you have, but you understand that
> an
> int function argument that needs to be filled should be passed as a
> pointer
> to int (by reference) and not as an int value (by value), right?
>
> > -----Original Message-----
> > From: Shivakumar, Pravinkumar (ODC - Satyam)
> > [mailto:PShivakumar AT Satyam.odc.ml.com]
> > Sent: Tuesday, September 10, 2002 00:52
> > To: TDS Development Group
> > Subject: dbdata() call inconsistent...
> >
> > Hi All,
> >
> > R there any known issues with dbdata() function call present in the file
> > dblib.c.
> > I get a core dump when I invoke it with an int and the behaviour is
> > inconsistent.
> > I am currently using FreeTDS 0.53 on SUN SOLARIS 5.6.
> >
> > -Pravin Kumar S << File: footer >>
> >
> >
> --------------------------------------
> Internet E-mail Confidentiality Footer
> Privileged/Confidential Information may be contained in this message.
> If you are not the addressee indicated in this message (or responsible for
>
> delivery of the message to such person), you may not copy or deliver this
> message to anyone.
> In such case, you should destroy this message and kindly notify the sender
>
> by reply email. Please advise immediately if you or your employer do not
> consent to Internet email for messages of this kind.
> Opinions, conclusions and other information in this message that do not
> relate to the official business of my firm shall be understood as neither
> given nor endorsed by it.
> --------------------------------------
>
>
>
> ---
> You are currently subscribed to freetds as:
> [pshivakumar AT satyam.odc.ml.com]
> To unsubscribe, forward this message to
> $subst('Email.Unsub')
>

<<application/ms-tnef>>




Archive powered by MHonArc 2.6.24.

Top of Page