Concurrent Access

Discussion in 'Perl Misc' started by FeelLikeANut@gmail.com, Feb 12, 2007.

  1. Guest

    When you need to update a value in a file, it's pretty simple: lock
    exclusively, read the value, manipulate it, write it, and release the
    lock. I'm not sure how this world work with an SQL database, however.
    I can use the select statement to read the value and the update
    statement to write the value, but how do I make sure that the value
    isn't tampered with between those two statements?
    , Feb 12, 2007
    #1
    1. Advertising

  2. Guest

    wrote:
    > When you need to update a value in a file, it's pretty simple: lock
    > exclusively, read the value, manipulate it, write it, and release the
    > lock. I'm not sure how this world work with an SQL database, however.
    > I can use the select statement to read the value and the update
    > statement to write the value, but how do I make sure that the value
    > isn't tampered with between those two statements?


    That depends on what database engine you use.

    Also, it has nearly nothing to do with Perl.

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
    , Feb 12, 2007
    #2
    1. Advertising

  3. >>>>> "FLAN" == FeelLikeANut <> writes:

    FLAN> I can use the select statement to read the value and the
    FLAN> update statement to write the value, but how do I make sure
    FLAN> that the value isn't tampered with between those two
    FLAN> statements?

    This has more to do with databases than with Perl, and in particular
    with your choice of databases; but the answer is generally either
    transactions, table locking, or sensible database schema design.

    Charlton


    --
    Charlton Wilbur
    Charlton Wilbur, Feb 12, 2007
    #3
  4. Ch Lamprecht Guest

    wrote:
    > When you need to update a value in a file, it's pretty simple: lock
    > exclusively, read the value, manipulate it, write it, and release the
    > lock. I'm not sure how this world work with an SQL database, however.
    > I can use the select statement to read the value and the update
    > statement to write the value, but how do I make sure that the value
    > isn't tampered with between those two statements?
    >

    Search your database docs:

    SELECT ..... FOR UPDATE

    does a row level lock for the current transaction e.g. in Postgresql, but I
    think it's standard SQL.

    Christoph

    --
    push @INC , sub{*DATA};
    require JaPH;
    __END__
    print 'Just another Perl Hacker'
    Ch Lamprecht, Feb 12, 2007
    #4
    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. Manit Chanthavong

    Cache Object Concurrent Access

    Manit Chanthavong, Nov 19, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    505
    Manit Chanthavong
    Nov 19, 2003
  2. Kevin Frey
    Replies:
    3
    Views:
    2,949
    kekoav
    Mar 6, 2008
  3. Ben
    Replies:
    1
    Views:
    562
    Robert
    Apr 15, 2005
  4. Pep
    Replies:
    6
    Views:
    819
  5. CJM
    Replies:
    12
    Views:
    348
Loading...

Share This Page