[freetds] freebcp loads -1 rows

Lowden, James K LowdenJK at bernstein.com
Fri Jun 6 15:39:21 EDT 2003


> From: Lowden, James K [mailto:LowdenJK at bernstein.com]
> Sent: June 5, 2003 1:35 PM
> 
> The message from freebcp is "-1 rows copied."
> 
> I have a feeling tds_process_simple_query() isn't playing 
> nicely in _bcp_exec_in(), but it's not clear to me what 
> should be done.  

Freddy, 

For the time being, I added "tds_do_until_done()" and substituted it for
tds_process_simple_query() at the tail end of _bcp_exec_in().  freebcp now
loads the table it was failing to load, as it had done with bcp.c revision
1.65.  

My fix probably leaves TDS 5.0 broken, because that branch of the code
relies on tds_process_simple_query().  I left it that way in case you're
intending to fix/replace tds_process_simple_query() yourself.  Let me know
which way you want to go.  

The problem, as you can see by comparing the two functions, is that
tds_process_simple_query() wasn't setting tds->rows_affected.  I think
that's because it doesn't insist on seeing a TDS_DONE_TOKEN before it
returns.  That is, it returns too early, resulting in an incomplete TDS
conversation, and the server never commits the row(s).  

Perhaps tds_process_simple_query() should be called
"tds_discard_query_results()"?  

Bill, Marc, please try tonight's snapshot and tell me how you fare.  

--jkl
-----------------------------------------
The information contained in this transmission may contain privileged and confidential information and is intended only for the use of the person(s) named above. If you are not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, any review, dissemination, distribution or duplication of this communication is strictly prohibited. If you are not the intended recipient, please contact the sender immediately by reply e-mail and destroy all copies of the original message. Please note that we do not accept account orders and/or instructions by e-mail, and therefore will not be responsible for carrying out such orders and/or instructions.





More information about the FreeTDS mailing list