Skip to Content.
Sympa Menu

freetds - Re: [freetds] FreeTDS dbwillconvert discrepancy

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] FreeTDS dbwillconvert discrepancy
  • Date: Sat, 29 Nov 2008 10:37:59 +0100

Il giorno mer, 26/11/2008 alle 12.56 -0500, Joe Losco ha scritto:
> Hello all,
> I'm in the process of writing an application for OS X using FreeTDS and
> objective c. I have come to a point however, that I am pretty confused.
> My application at this point is still using the sample provided with
> FreeTDS as in http://www.freetds.org/userguide/samplecode.htm but I am
> beginning to convert it to be part of a GUI application in Cocoa.
>
> I first used the sample to make sure that I can use it as shown, and
> with a specific query. The sample as shown works completely. I took
> the same code and with minor modifications put it into the GUI app and
> it does not work. Now to give some more detailed information.
>
> My problem that I've narrowed it down to is with this stub of code
> if (SYBCHAR != pcol->type) {
> pcol->size = dbwillconvert(pcol->type, SYBCHAR);
> }
>
> I've placed "printf("name:%s type:%d size:%d\n", pcol->name,
> pcol->type, pcol->size);" around this piece of code so that I can see
> the before and after effects. In the command line pure C application
> dbwillconvert returns the size of the would be data converted to the
> correct type. This then lets the memory be allocated properly in the
> later calloc that uses pcol->size+1, as well as everything else to work
> as intended.
>
> However, in the Objective C/GUI version it appears to return a Bool. It
> seems to return 1 if it is convertable and 0 if it is not. This
> obviously messes up the rest of the allocations in the sample resulting
> in truncation and overflow errors. I then looked into this farther and
> found http://www.freetds.org/reference/a00275.html#ga24 which from what
> I can tell is that the desired effect of that function is to return the
> bool.
>
> I'm not sure where to go to look for any more information. Any advice
> is greatly appreciated.
>

It returns a bool, you could see vendors (Sybase or MS) documentation
(ie
http://manuals.sybase.com/onlinebooks/group-cnarc/cng1110e/dblib/@ebt-link;pt=2814?target=%25N%15_45151_START_RESTART_N%25)

freddy77






Archive powered by MHonArc 2.6.24.

Top of Page