Skip to Content.
Sympa Menu

freetds - Re: [freetds] prepared statements in db-lib

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Paul Thurston" <pthurston AT netegrate.com>
  • To: <a_wake AT earthlink.net>, "'FreeTDS Development Group'" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] prepared statements in db-lib
  • Date: Sun, 21 Feb 2010 14:57:24 -0500

Andy:



If you are programming in, say C++, it is fairly straightforward to write a
function with this capability.

Have the function take as parameters the tablename, along with vector of
pointers to a user-defined class Parameter.

If each Parameter contains type information, along with the value,
formatting & executing the query string is a snap.





Best,



Paul





-----Original Message-----
From: freetds-bounces AT lists.ibiblio.org
[mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of Andrew H. Wakefield
Sent: Sunday, February 21, 2010 2:27 PM
To: freetds AT lists.ibiblio.org
Subject: [freetds] prepared statements in db-lib



I have been playing with db-lib, and find it to be a very nice

interface. But there is one thing that I seem to be missing, and can't

figure out -- does it not have any way to do a "prepared statement" --

IOW, a statement with parameters that are filled in before execution --

other than as an actual stored procedure?



Here's what I want to be able to do, in a mixture of sql and

pseudo-code:



sql_statement: INSERT INTO test_tbl VALUES ( ?, ?, ? );

set_param(1, 52)

set_param(2, 'Testing')

set_param(3, 123.456)

execute prepared statement



If db-lib cannot do this, can ct-lib? Or do I have to go down to the

libtds layer?



Many thanks ...





Andy Wakefield

a_wake AT earthlink.net



On Mon, 2010-01-11 at 21:55 -0500, James K. Lowden wrote:



> Andrew H. Wakefield wrote:

> > I

> > downloaded the "nightly snapshot" yesterday and tried to cross-compile

> > for Windows. It failed during the make, using the settings that worked

> > successfully for freetds-0.82. IIRC, the error had something to do with

> > types.h inclusion.

>

> Tonight's version should be better. Let us know.

>

> --jkl

_______________________________________________

FreeTDS mailing list

FreeTDS AT lists.ibiblio.org

http://lists.ibiblio.org/mailman/listinfo/freetds





Archive powered by MHonArc 2.6.24.

Top of Page