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

Discussion in 'Python' started by Evan, Jul 7, 2008.

  1. Evan

    Evan Guest

    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,
    Evan, Jul 7, 2008
    #1
    1. Advertising

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

    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
    Diez B. Roggisch, Jul 7, 2008
    #2
    1. Advertising

  3. Evan

    Evan Guest

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

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

    Thanks,
    Evan, Jul 7, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fuzzyman
    Replies:
    3
    Views:
    476
    Andrew MacIntyre
    Dec 5, 2003
  2. Robert Brewer
    Replies:
    0
    Views:
    478
    Robert Brewer
    Dec 5, 2003
  3. k3xji
    Replies:
    7
    Views:
    785
    Gabriel Genellina
    Dec 30, 2008
  4. nano2k

    Application.Lock()/UnLock() or lock(Application)

    nano2k, Jul 23, 2007, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    265
    nano2k
    Aug 9, 2007
  5. Sara
    Replies:
    3
    Views:
    71
    Tassilo v. Parseval
    Aug 26, 2004
Loading...

Share This Page