Re: Problem with FreeTDS validating SQL commands

"ZIGLIO, Frediano, VF-IT" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
> 
> 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.
> [email protected]
> 

>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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.