dvd420 Posted January 22, 2009 Share Posted January 22, 2009 Hi All, This is regarding oci. When the script ends, PHP ROLLBACKs all the transactions, if we are not passing OCI_COMMIT_ON_SUCCESS while calling oci_execute(). My problem is, I don't need this ROLLBACK after the script ends. I want to do COMMIT/ROLLBACK myself. So is there any way to do so. Quote Link to comment https://forums.phpfreaks.com/topic/141920-preventing-auto-commitrollback/ Share on other sites More sharing options...
RussellReal Posted January 22, 2009 Share Posted January 22, 2009 when a php script ends, your script destroys all resources, objects, variables, streams, etc.. not sure what OCI is but I'm sure the above explains your problem Quote Link to comment https://forums.phpfreaks.com/topic/141920-preventing-auto-commitrollback/#findComment-743070 Share on other sites More sharing options...
dvd420 Posted January 22, 2009 Author Share Posted January 22, 2009 Hi Russel, Thanks, This explains everything. But I just want to know is there a way to prevent this behaviour?? I tried using SESSION & Write to file. But no luck. Quote Link to comment https://forums.phpfreaks.com/topic/141920-preventing-auto-commitrollback/#findComment-743081 Share on other sites More sharing options...
RussellReal Posted January 22, 2009 Share Posted January 22, 2009 ok most times with objects (I'm assuming OCI is a package or something) when you do like $oci = new OCI; echo $oci; when you echo the variable it activates the ->toString() method inside the function which then gives the output in STRING form.. most pre-built objects have this, however, if you're working on a class you'd use __toString with the prepended underscores. now, you can't store a resource/stream/object inside of a session or file either basically because its impossible for the script to keep the connection/stream alive when php terminates. what you can do, is pass the data that you will USE with OCI via sessions Quote Link to comment https://forums.phpfreaks.com/topic/141920-preventing-auto-commitrollback/#findComment-743088 Share on other sites More sharing options...
Mchl Posted January 22, 2009 Share Posted January 22, 2009 OCI is database extension for Oracle. The whole point of transactions is, that if for whatever reason database doesn't get the COMMIT command (imagine connection timing out), it will roll back all changes.I never worked with Oracle, so I don't know if it has equivalent of MySQL's AUTOCOMMIT setting, that autmatically commits every single query. See oci_commit Quote Link to comment https://forums.phpfreaks.com/topic/141920-preventing-auto-commitrollback/#findComment-743094 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.