php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3327 its-not-a-bug-but-a-feature: odbc_free_result does an implicit COMMIT WORK
Submitted: 2000-01-27 08:22 UTC Modified: 2005-03-31 16:13 UTC
From: gordon+php at vip dot fi Assigned:
Status: Wont fix Package: Solid related
PHP Version: 3.0.14 OS: All (?)
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gordon+php at vip dot fi
New email:
PHP Version: OS:

 

 [2000-01-27 08:22 UTC] gordon+php at vip dot fi
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...

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-31 16:13 UTC] php-bugs at lists dot php dot net
We are sorry, but we do not support PHP 3 related problems anymore.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC