freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "James K. Lowden" <jklowden AT schemamania.org>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] (newbie) Using tsql in C/C++
- Date: Thu, 21 Apr 2005 21:59:38 -0400
Ben Borofka <bborofka AT gmail.com> wrote:
>
> I'm writing an app (in Objective-C/Cocoa) that needs to connect to a
> MS SQL 2000 Server. I'm able to compile and run tsql on OS X and it
> works fine. I can connect to the server and issue SQL commands. Now I
> just need to figure out how to put this functionality in my program.
Welcome.
> This is where I'm getting really confused. I need to find some C/C++
> code to do this, and the source code for freetds is really
> overwhelming and complicated. All I need to be able to do is connect
> to the server, exec a few stored procedures and get some output. I'm
> looking for some samples, but the Documentation doesn't explain much
> of using freetds w/ C at all.
I wrote apps/bsqldb.c just for you. You might not need everything it
does, but it's meant to be so that you can pull out what you need.
As Brian said, db-lib is documented online by both vendors. There is also
a reference manual included in the distribution.
For a super-brief introduction:
install error and message handlers
dblogin
dbconnect
dbcmd
dbsqlexec
while dbresults
dbbind col1
...
dbbind colN
while dbnextrow
[process data]
wend
wend
We speak of "results" as the output of a select statement. Because a
query sent with dbcmd may have more than one select statement, we may get
several results. Hence the nested loop.
--jkl
-
[freetds] (newbie) Using tsql in C/C++,
Ben Borofka, 04/21/2005
- Re: [freetds] (newbie) Using tsql in C/C++, Brian Bruns, 04/21/2005
-
Re: [freetds] (newbie) Using tsql in C/C++,
James K. Lowden, 04/21/2005
-
Re: [freetds] (newbie) Using tsql in C/C++,
Ben Borofka, 04/26/2005
- Re: [freetds] (newbie) Using tsql in C/C++, Brian Bruns, 04/26/2005
-
Re: [freetds] (newbie) Using tsql in C/C++,
Ben Borofka, 04/26/2005
Archive powered by MHonArc 2.6.24.