Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: Does SQLBindParameter work with SQLExecDirect: msg#00149

db.tds.freetds

Subject: Re: Does SQLBindParameter work with SQLExecDirect

Thanks for the info Freddy. It's as I suspected. The Prepare/Execute
method will work fine for me just now.

However...

For what it's worth, wisely or otherwise, I checked out the
latest 0.62-devel code from CVS to try it out, and with this code
I find that SQLBindParameter NEVER works (and no diagnostic
is forthcoming) - whereas it worked with 0.61 with Prepare/Execute.

Perhaps you know about this already and its my problem for taking
code under-development.

I should say I'm using it with iODBC (3.0.6). (The iODBC version
was constant throughout).
I did some investigation and have the following observations (based on
a little bit of gdb'ing and gross assumptions about the code - I stand by
to be corrected - but here's my take...)

1) In 0.61 there was no SQLBindParam in odbc.c - just
SQLBindParameter.
2) In iODBC's prepare.c when SQLBindParameter is invoked it
actually invokes the driver's (new) SQLBindParam function.
Although - if there had been no SQLBindParam driver function
then it would have invoked the driver's SQLBindParameter
instead. This last was the behaviour with 0.61 - but not any
more.
3) Now the driver's SQLBindParam function is a simple wrapper
- it invokes SQLBindParameter. Now I suspect it wants to
invoke the driver's SQLBindParameter, but it actually
invokes iODBC's SQLBindParameter - which takes us back
to step 2 - i.e. there is no way the driver's SQLBindParameter
will get called. (as far as I can see). Anyway, here's the gdb
stack dump to back up my suspicion. #0 and #2 are the same
function.

>#0 SQLBindParameter (hstmt=0x806a130, ipar=1, fParamType=1, fCType=-15,
> fSqlType=4, cbColDef=0, ibScale=0, rgbValue=0xbfffe038, cbValueMax=0,
> pcbValue=0xbfffe03c) at prepare.c:449
>#1 0x401535ae in SQLBindParam (hstmt=0x806a130, ipar=1, fCType=-15,
> fSqlType=4, cbColDef=0, ibScale=0, rgbValue=0xbfffe038,
> pcbValue=0xbfffe03c) at odbc.c:785
>#2 0x40054706 in SQLBindParameter (hstmt=0x804dd88, ipar=1, fParamType=1,
> fCType=-15, fSqlType=4, cbColDef=0, ibScale=0, rgbValue=0xbfffe038,
> cbValueMax=0, pcbValue=0xbfffe03c) at prepare.c:428
>#3 0x08049b16 in TestRawODBCPreparedQuery() () at dbtest.cpp:272
>#4 0x0804a985 in main () at dbtest.cpp:489


It strikes me that SQLBindParam needs re-written to call something
that doesn't look like an iODBC function - perhaps by factoring out
the contents of SQLBindParameter into a common function with
a local name. Just a thought - based on little knowledge I admit :-)

BTW - perhaps it could be argued that the iODBC code is wrong.
I don't know. I tried ifdef'ing out the call to SQLBindParam from
iODBC's SQLBindParameter so that
it does call the driver's SQLBindParameter and it works a treat
including with SQLExecDirect. So that workaround works (which
fixes my original problem!)
I'll leave it to you to figure out whether iODBC or FreeTDS is right
or wrong on this new issue.

Hope this half-baked analysis helps,

David

----- Original Message -----
From: "ZIGLIO Frediano" <Frediano.Ziglio@xxxxxxxxxxxx>
To: "FreeTDS Development Group" <freetds@xxxxxxxxxxxxxxxxx>
Sent: Wednesday, August 06, 2003 4:33 PM
Subject: RE: [freetds] Does SQLBindParameter work with SQLExecDirect


>
> Hi,
>
> I'm using FreeTDS 0.61 and TDS-ver is 7.0.
>
> I can get SQLBindParameter to work with
> SQLPrepare/SQLExecute, but it fails when I try SQLExecDirect.
>
> I get sqlState of HY000, nativeError=1, and the message
> is "Line 1: Incorrect syntax near '?'".
>
> Is this a known bug, or am I doing something daft? The MS API
> Reference implies this is a legal sequence of ODBC API calls.
> Alternatively - as this just not been implemented (yet)?
> (i.e. "just use SQLPrepare stoopid!" :-)
>
> For reference (and ridicule :-) here's a test snippet that fails...
>

This was fixed in CVS. I don't think to merge this stuff in 0.61 so
there are two solutions:
- wait 0.62 version (not that good...)
- use SQLPrepare.

Thanks for report and test.

freddy77
_______________________________________________
FreeTDS mailing list
FreeTDS@xxxxxxxxxxxxxxxxx
http://lists.ibiblio.org/mailman/listinfo/freetds


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
hardware.arm.at...    cms.citadel.dev...    video.gstreamer...    java.facelets.u...    misc.basics.qna...    web.wiki.instik...    network.uip.use...    xdg.devel/2003-...    tex.bibtex.bibd...    finance.quotesp...    ietf.zeroconf/2...    redhat.blinux.g...    suse.db2/2003-0...    php.phpesp/2004...    uml.devel/2003-...    gnome.labyrinth...    qnx.openqnx.dev...    boot-loaders.gr...    db.dataperfect....    audio.audacity....    linux.uclinux.m...    editors.j.devel...    os.openbsd.tech...    kde.users.multi...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation