[freetds] SQL_SUCCESS_WITH[out]_INFO in ODBC lib

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Fri Apr 11 11:15:10 EDT 2008


> 
> Nathan Bird wrote:
> > Reading data in chunks with SQLGetData if the buffer is not 
> long enough 
> > for the value to copy, it should fill the buffer, and return 
> > SQL_SUCCESS_WITH_INFO, along with setting the 
> StrLen_or_IndPtr to point 
> > at the how much data is available. At least according to  
> > http://msdn2.microsoft.com/en-us/library//ms715441.aspx [1] 
> the info 
> > should be "01004" to indicate the string is right 
> truncated-- this isn't
> > 
> > being set right now.
> 
> The attached patch implements the change you suggest, along with a few
> cosmetic changes.  
> 
> I committed the change to to CVS HEAD.  I'll apply it to 0.82 
> before it's
> released unless Frediano sees a problem.  
> 
> (My compliments, if I may, on a fine problem report.  Thanks.)  
> 
> > I ran into a problem recently where trying to read data 
> through the ODBC
> > 
> > lib gave me a number of problems, updating to 0.82RC4 fixed most of 
> > them....
> 
> Very good to hear, too.  
> 
> > From my searching this was the most definitive source for ODBC spec 
> > I could find
> 
> That's what I use.  I figure ODBC for SQL Server is whatever Microsoft
> says it is, standard or no.  
> 

I think tha patch could be splitted in:
1- current_results instead of resinfo
2- some style/typo fixes
3- fixes for problem in ML

3 is just

-			/* not all readed ?? */
-			if (colinfo->column_text_sqlgetdatapos <
colinfo->column_cur_size)
-				/* TODO add diagnostic */
+			
+			if (colinfo->column_text_sqlgetdatapos <
colinfo->column_cur_size) {	/* not all read ?? */
+				odbc_errs_add(&stmt->errs, "1004",
"String data, right truncated");
 				ODBC_RETURN(stmt,
SQL_SUCCESS_WITH_INFO);
+			}

IMO is correct!
2 is ok, even odbc refer as remaining bytes.
I would merge part 3 in 0.82 and 2 and 3 in CVS HEAD.

bye
  freddy77



More information about the FreeTDS mailing list