[freetds] Transaction weirdness

John Anderson ardour at semiosix.com
Fri Oct 10 08:04:21 EDT 2003


On Fri, 2003-10-10 at 05:37, James K. Lowden wrote:
> On 09 Oct 2003, John Anderson <ardour at semiosix.com> wrote:
> > So my code processes the data (1 row) that it needs, and then tries to
> > execute the commit. Since the other (useless) resultset is still
> > pending, the commit attempt fails.
> > 
> > Seems to me that from an application point of view it would make sense
> > for a commit attempt to automatically cancel any pending result sets?
> 
> Philosophically, regardless of what documentation says? You could take
> that point of view, or you could say that an out-of-place commit indicates
> a logic flaw in the application, because results have to be fetched or
> explicitly cancelled.  
> 
> By insisting on explicit handling of the results, the designers prevent
> applications from assuming they've fetched all the rows when they haven't.
>  Lots of programmers make the mistake at one time or another of assuming a
> query will return one row when it actually may return two or more.  This
> way at least, the database won't take the heat for the bad assumption.  

Would it be possible to produce a more helpful error message? Like
"COMMIT or ROLLBACK failed  - there are pending results"?

bye
John




More information about the FreeTDS mailing list