* - have one ocifree() call.
* - make it possible to have persistent statements?
* - implement connection pooling in ZTS mode.
- * - implement automatic commit *OR* rollback on script end
* - failover
* - change all the lob stuff to work without classes (optional)!
* - make sure that the callbacks terminate the strings with \0
* - add Collection iterator object for INDEX BY tables
* - make auto-rollabck only happen if we have an outstanding transaction
* - implement ocidisconnect
- * - add bind patch
*/
/* {{{ includes & stuff */
oci_debug("START _oci_conn_list_dtor: id=%d",connection->id);
if (connection->pServiceContext) {
- CALL_OCI_RETURN(connection->error,OCITransRollback(
- connection->pServiceContext,
- connection->pError,
- (ub4)0));
-
- if (connection->error) {
- oci_error(connection->pError, "failed to rollback outstanding transactions!", connection->error);
+
+ if (connection->needs_commit) {
+ oci_debug("OCITransRollback");
+ CALL_OCI_RETURN(connection->error,OCITransRollback(
+ connection->pServiceContext,
+ connection->pError,
+ (ub4)0));
+
+ if (connection->error) {
+ oci_error(connection->pError, "failed to rollback outstanding transactions!", connection->error);
+ }
+ connection->needs_commit = 0;
+ } else {
+ oci_debug("nothing to do..");
}
CALL_OCI(OCIHandleFree(
mode));
statement->error = oci_error(statement->pError, "OCIStmtExecute", error);
+
if (statement->binds) {
zend_hash_apply(statement->binds, (apply_func_t) _oci_bind_post_exec TSRMLS_CC);
}
if (statement->error) {
return 0;
}
+
+ if (mode & OCI_COMMIT_ON_SUCCESS) {
+ statement->conn->needs_commit = 0;
+ } else {
+ statement->conn->needs_commit = 1;
+ }
}
if ((statement->stmttype == OCI_STMT_SELECT) && (statement->executed == 0)) {
OCI_GET_CONN(connection,conn);
+ oci_debug("<OCITransRollback");
+
CALL_OCI_RETURN(connection->error, OCITransRollback(
connection->pServiceContext,
connection->pError,
(ub4) 0));
+ connection->needs_commit = 0;
+
+ oci_debug(">OCITransRollback");
+
if (connection->error) {
oci_error(connection->pError, "OCIRollback", connection->error);
oci_handle_error(connection, connection->error);
connection->pError,
(ub4) 0));
+ connection->needs_commit = 0;
+
oci_debug(">OCITransCommit");
if (connection->error) {