Skip to Content.
Sympa Menu

freetds - Re: [freetds] Problem with FreeTDS validating SQL commands

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Problem with FreeTDS validating SQL commands
  • Date: Thu, 22 May 2008 08:57:56 +0200

>
> Hi,
>
> I'm currently converting PPC based Mac Software to Universal
> binaries, and I'm using FreeTDS as the replacement for the
> SybaseOpenClient framework. We used the 0.64 source to build a
> Mac .framework which is what we're still using. I've built a new
> framework from the 0.82 source, but it did not address the problem
> I'm seeing.
>
> The basic problem that I am having is that when I attempt to execute
> an incorrectly formatted SQL statement, or a stored procedure that
> isn't properly stored on the server, the FreeTDS library returns a
> CS_SUCCEED result instead of CS_FAIL. Does anyone know if this is a
> known issue with FreeTDS or if there is a workaround?
>
> I'll attach the code below that we are using to execute our query:
>
> theRetcode = ct_command(itsCmdPtr, CS_LANG_CMD,
> aCmdStr,
> CS_NULLTERM, CS_UNUSED) ;
> if (theRetcode != CS_SUCCEED) return (theRetcode) ;
>
> /* Send the command to the server */
> theRetcode = ct_send (itsCmdPtr) ;
> if (theRetcode != CS_SUCCEED) return (theRetcode) ;
>
> /* Process the results of the command */
> theResType = 0 ;
>
> DisposeData () ;
> DisposeParam () ;
> DisposeStatus () ;
> DisposeCompute () ;
>
> while ((theRetcode = ct_results(itsCmdPtr,
> &theResType)) ==
> CS_SUCCEED) {
> etc.
>
> So, basically, we're calling ct_command() and then calling ct_send()
> right after.
>
> Please correct me if I'm wrong, but it's my understanding that
> ct_command() is used to initiate the SQL request and will also
> determine if it is valid SQL syntax or if the Stored Procedure call
> is valid.
>
> In contrast, the SybaseOpenClient framework will return the CS_FAIL
> result if the SQL isn't properly formatted. However, the source
> isn't readily available to us so we can't compare the two.
>
>
> Thanks for any feedback, your time is appreciated,
>
> Stephane Magne
> Atimi Software Inc.
> smagne AT atimi.com
>

>From my knowledge ct_command prepare the buffer to send while ct_send
send the query. Query is not parsed by client to only during result
fetching the error raise.

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page