Rollbacking Multiple Databases

A

Anonymous

Guest
Hi everyone !

I have a php file that contains a set of 10 queries to be executed. if anyone fails then i am in trouble..

please help .. this is the structure

<?php
//opening database1
//executing query1 of database1
//executing query2 of database1
//executing query3 of database1
//opening database2
//executing query1 of database2
//executing query2 of database2
//executing query3 of database2 //A
//executing query4 of database2
?>

If failure occurs at A.. then i have to rollback the whole process , even the updated values of databse1.


How to do it ? Please someone help.
 
a tough one!!!
this is called a Distributed Transaction,
but what you can do at max is can you set up the one single query, which will inturn call a stored procedure.

this stored procedure will handle all the transactions, including the new dB transactions.

If this is not possible, as mostly in MySQL(<5.0.x),
then you need to store what query has succeded and which has not..

say you have 5 transactions...
make a table say trans
Code:
TRANS
* some id
* tran1 int default 0
* tran2 int default 0
* tran3 int default 0
* tran4 int default 0
* tran4 int

now when you insert / update/ delete for the first query,
insert a row in the trans table.

in php, for every successive transaction, insert the primary_key on which the transaction was made in the "transx" field of your TRANS table.

if you are able to finish all the transactions, as in completing the TRANS row, ! that is good, if not, your either column would be still 0, and that is the transaction u would want to revert.
 
Thanks rutrajv but i can't get you properly..

Is there any locking schemes in php or mysql and rollback options.. so that if any one query fails then i can rollback the original one..

I think u understand my situation.

Anyhow thanks for the reply.
 
Instead of running a non-transaction safe MyISAM you should be running an InnoDB that is a transaction-safe engine
This will make it possible to use BEGIN TRANSACTION commands and such. you will be able to scpecify what to do in case an error accures..

more infomration could be found att http://dev.mysql.com
 
Hehe, thanx but i will make some changes to the site only when i have time for it...
and right now its justtoo many projects so i dont even have time for that...
 
Ok thanks for reply...

If you have time visit my site too.. bye Admin
 
i just did :) i like what you have done with flash, however am i little bit sceptic about the flash forum part...
but, you never know: it might just work :D
 
:? Did you find any bug there ??? Please tell me if so....


I you like then i will put your site name as an ad.. Is it ok 4 u ?

Please reply :)
 
I dind find the bug no, however i dindt really like the "look and feel"
Hehe. Fowever if you will redistribute this with all the *.fla files for full modification: it might just work fine :)
The problem is that people like to mod their forums. And as i understand: you wanted this to be an opensource project -- then all the sources should follow.
 
ok.. i heard many didn't like the color but many of them too liked the site.. :?

i dont know what to do to cover all users perspective... :eek:

My forum is not yet over.. you can see my site's homepage update section.. i will be implementing a series of tests and add-ons to my project.

I think this site uses phpBB :) It;'s a fantastic board package with a wide variety of skins .. right ??

Ok alex thanks for having a look at my site and helping my query.

If anything u want to convey please reply to this thread.. ok bye

:D
 
the most annoying thing is tons of rows that say that no post has been made.. wht do you have a fixed amount of rows?
the color..welll it should actually be a customizable thing.. just like skins here, you should have an XML file with all the color declarations..
 
In my site Everything is just below 20KB , it will be loaded fast.

I think you are pretty educated.. you could have created a nice bulletin by yourself instead of using phpBB.. you are that much well in every tech.
 
d.shankar said:
I think you are pretty educated.. you could have created a nice bulletin by yourself instead of using phpBB.. you are that much well in every tech.
Shankar,

Its not about creating stuff, But if there is a tool in the market at your disposal which does exactly what you need, PLUS you are able to configure it, WHY NOT USE IT. Why spend time and money on it, (you can do that if u are learning stuff from that, just as an excercise)

Apart from that, your website is full in flash, have you tried SEO on your site ? How good is it ?
 
ruturajv said:
d.shankar said:
I think you are pretty educated.. you could have created a nice bulletin by yourself instead of using phpBB.. you are that much well in every tech.
Shankar,

Its not about creating stuff, But if there is a tool in the market at your disposal which does exactly what you need, PLUS you are able to configure it, WHY NOT USE IT. Why spend time and money on it, (you can do that if u are learning stuff from that, just as an excercise)

Apart from that, your website is full in flash, have you tried SEO on your site ? How good is it ?


I am not discouraging anyone.. rutrajv. I just meant that if anyone has talent they must express it.. that's it.

Alexei is very well talented and he can do a lot that's what i meant.

Yeah ! My ultimate focus was to create my site in Flash , if it is in normal HTML i would have done it easily ;

By the way what is SEO ?? I haven't heard it can you help me out....rut

Thanks
 
Sorry for replying too late.. where shall i use the SEO in my site??
Can u tell me ?? :)
 
Back
Top