freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Joe Losco <joe AT sqpuv.com>
- To: freetds AT lists.ibiblio.org
- Subject: [freetds] FreeTDS dbwillconvert discrepancy
- Date: Wed, 26 Nov 2008 12:56:11 -0500
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.
--
Joe L
-
[freetds] FreeTDS dbwillconvert discrepancy,
Joe Losco, 11/26/2008
- Re: [freetds] FreeTDS dbwillconvert discrepancy, Joe Losco, 11/26/2008
- Re: [freetds] FreeTDS dbwillconvert discrepancy, Frediano Ziglio, 11/29/2008
-
Re: [freetds] FreeTDS dbwillconvert discrepancy,
James K. Lowden, 11/29/2008
- Re: [freetds] FreeTDS dbwillconvert discrepancy, Joe Losco, 11/30/2008
- Re: [freetds] FreeTDS dbwillconvert discrepancy, Joe Losco, 11/30/2008
Archive powered by MHonArc 2.6.24.