By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,137 Members | 2,242 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,137 IT Pros & Developers. It's quick & easy.

Is there a good way to implement file updating? such as lock, update,reload...

P: n/a
Hello -

My script use a DB file which is written by XML, and the user load
this DB file (XML tree in memory), and then do some updating about
this tree, such as delete element, generate new element or move
element.

The thing is, my script is a cmd based program (based on module
"cmd"), and there are many users would use this script at same time,
in a shell style prompt (module "cmd"), so I want to implement a
updating after a user update the XML tree, it such as a "signal
console", so that all the user can keep same DB, or other user can
see update a few seconds later.

What I did is, create a new file calling "db_change", and put a number
"1" in file, and then update the real "DB" file (by change uid to lock
file), other user to check this file and then re-load XML file, but I
do not think it is a good idea, the performance is not good.

I would like to know if you could help on this matter, I hope I can
get inspiration/example from you guys.

Thanks,
Jul 7 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Evan wrote:
Hello -

My script use a DB file which is written by XML, and the user load
this DB file (XML tree in memory), and then do some updating about
this tree, such as delete element, generate new element or move
element.

The thing is, my script is a cmd based program (based on module
"cmd"), and there are many users would use this script at same time,
in a shell style prompt (module "cmd"), so I want to implement a
updating after a user update the XML tree, it such as a "signal
console", so that all the user can keep same DB, or other user can
see update a few seconds later.

What I did is, create a new file calling "db_change", and put a number
"1" in file, and then update the real "DB" file (by change uid to lock
file), other user to check this file and then re-load XML file, but I
do not think it is a good idea, the performance is not good.

I would like to know if you could help on this matter, I hope I can
get inspiration/example from you guys.
Start using a proper database. And get rid of the XML. If you need it for
output/exchange purposes, generate it from the DB.

Diez
Jul 7 '08 #2

P: n/a
If I get rid of the XML, I have to change my script more and more, it
is not easy to do that. :( :(

Thanks,
Jul 7 '08 #3

P: n/a
Evan wrote:
If I get rid of the XML, I have to change my script more and more, it
is not easy to do that. :( :(

Thanks,
It is even harder to write a multi-user XML database (which is what you are
wanting). Put the data in a multi-user database and convert to XML as needed.

-Larry
Jul 7 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.