Re: problem with ct_dynamic(....CS_PREPARE...) against SQL Server 2005
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <OF1207CF42.3E954D20-ONC1257574.0032E602-C1257574.0034A83D@asset-control.com> |
> > A quick fix would be to remove the else part near the bottom of > > tds_process_end(), > > so a valid affected rows count does not get overwritten.... > > http://www.freetds.org/tds.html#t255 > > Er, no, that wouldn't be a fix. The server said in its status word that > there is no row count. The protocol provides for 32/64 bits of rowcount > information in every DONEPROC packet, but doesn't require that the value > therein be valid. So, sure, you can grab the value, but it won't be the > number of rows affected except 1 time in 2^32. > I am not sure if you entirely see my issue here. I understand that a lot of the packets may not contain affected rows information. But the issue here is that I relinguish control to the freetds library by calling ct_results(). It calls the tds library to process the various result tokens and only returns control to me after all 6 result token have been processed at the tds level. And because the last token does not contain row count information, the row count information from earlier tokens that I am interested in gets overwritten and I can not retrieve it anymore with ct_res_info(). My 'fix' at least prevents this, a valid row count still gets copied into the TDSSOCKET * struct and is at least not overwritten anymore by subsequent packets without a row count. Btw. the freetds behaviour here is definitely different from the standard Sybase CT-lib behaviour where row count information is always available when ct_results() has returned a result type of CS_CMD_DONE, CS_CMD_FAIL or CS_CMD_SUCCEED. regards, Tim