Bug #3327: its-not-a-bug-but-a-feature: odbc_free_result does an implicit COMMIT WORK

From: Date: Thu, 27 Jan 2000 13:22:40 +0000
Subject: Bug #3327: its-not-a-bug-but-a-feature: odbc_free_result does an implicit COMMIT WORK
Groups: php.dev 
Request: Send a blank email to php-dev+get-14948@lists.php.net to get a copy of this message
From: gordon+php@vip.fi Operating system: All (?) PHP version: 3.0.14 PHP Bug Type: Solid related Bug description: its-not-a-bug-but-a-feature: odbc_free_result does an implicit COMMIT WORK A removal of just one line from the source would suffice, but I have an inherent need to whine :) This is not a bug but rather an inconvenience set forth by Solid having to commit every transaction, even if the transaction consists of just one SELECT statement (this has to do with the fact that Solid creates a snapshot of the state of the database at statement time and needs to release the memory it uses for the snapshot - by commiting the transaction). A rather hare-brained design decision from the part of Solid, but what can you do. Currently, PHP implicitly does a SQLTransact(..., SQL_COMMIT) when odbc_free_result is called. Placing emphasis on good programming style, all allocated memory should be freed (though PHP does this automatically when it exits), but now one must do a COMMIT or ROLLBACK _before_ freeing the result handle(s), else the interim steps of the transaction (in a well-nested if staircase :) get COMMITed. Thus, my suggestion is that the implicit COMMIT is removed from odbc_free_result (unified_odbc.c lines 157-158). Thus, Solid users would need to COMMIT _explicitly_ when autocommit is off, but the "fix" would promote better programming style. odbc_close does an implicit COMMIT, but I think it should be replaced by ROLLBACK as to promote programmers to do their own COMMITs, lest their database state changes because of implicit COMMITs. I know programmers in general are rather lazy, but in a project that I have been working on I encountered some very awkward bugs because of the behaviour of odbc_free_result. I will most probably patch PHP a bit myself even if this behaviour does not change in official versions. I think this feature should be documented somewhere, anyway... Still on the Solid note, I would like to see configure handle Solid 3.0 more gracefully (the library and include names have changed). I have been changing them by hand in configure and php3_unified_odbc.h since we upgraded to Solid 3.0...

« previous php.dev (#14948) next »