Skip to Content.
Sympa Menu

freetds - RE: [freetds] C Project

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] C Project
  • Date: Mon, 3 Jan 2005 11:18:13 -0500

> From: Richard Cook
> Sent: Monday, January 03, 2005 11:03 AM
>
> I need to convert my application that uses the MySQL database engine
to use
> MS-SQL. Can anyone point me in the right directions for which
libraries I
> need to use?
>
> I have some sample code that does a connect and an Insert. I'd like
some
> sample code for Selecting data.
>
> Here are the libraries that I have so far:
> #include <tds.h>
> #include <tdsconvert.h>
> #include <ctype.h>
...
> Does anyone have some more complete sample code? My application needs
to
> maintain a persistent connection, and perform multiple row Selects and
> Inserts/Updates.

First recommendation is not to use libtds. It's a low-level library
that supports our client libraries. Cf.
http://www.freetds.org/faq.html#Which_API.

If you know ODBC, use ODBC. Else I always recommend db-lib. It's well
documented, easier than ODBC to set up (and use, IMHO), and supports
bcp, which may come in handy.

BTW, one difference between MySQL SQL dialect and T-SQL is that the
latter doesn't support multi-row inserts. MySQL accepts something like:

INSERT INTO A (a, v) VALUES ('key1', 'value1', 'key2', 'value2')

The T-SQL INSERT syntax allows only one row's values in the VALUES
clause.

In src/apps/bsqldb.c, you'll find a reasonably complete query processor
built on db-lib.

HTH.

--jkl

-----------------------------------------
The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the original
message. Please note that we do not accept account orders and/or instructions
by e-mail, and therefore will not be responsible for carrying out such orders
and/or instructions.
If you, as the intended recipient of this message, the purpose of which is to
inform and update our clients, prospects and consultants of developments
relating to our services and products, would not like to receive further
e-mail correspondence from the sender, please "reply" to the sender
indicating your wishes. In the U.S.: 1345 Avenue of the Americas, New York,
NY 10105.






Archive powered by MHonArc 2.6.24.

Top of Page