Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2011

    Unanswered: multiple user scenario

    Perl and database is Mysql.


    Assume user1 does his activity as given below.
    While user-1 completed step-2, user-2 does this activity as given below.

    (1). Will user-2 get a chance to
    insert in to 'common_table' while the db connection is still kept open by user-1.

    (2). If (1) given above is true then how to make sure that certain table is not accessible by other users (for example user-2) while a user is operating on it.

    Activity of user-1:
    #Step-1 Open database using DBI->connect

    #Step-2 SELECT few rows from table called 'common_table' do some operation

    #Step-3 Based on selection in step-2 INSERT INTO common_table

    #Step-4 Close database using $dbh->disconnect;

    Activity of user-2
    #Step-1 Open database using DBI->connect

    #Step-2 INSERT more columns to 'common_table'

    #Step-3 Close database using $dbh->disconnect;


  2. #2
    Join Date
    Dec 2012
    After connecting to the database one or more tables can be locked by the client program and unlocked when the operations are finished.

    More information about LOCK TABLE:
    MySQL :: MySQL 5.5 Reference Manual :: 13.3.5 LOCK TABLES and UNLOCK TABLES Syntax

    If the tables are created with "InnoDB" engine you can also use TRANSACTIONS.
    See also:
    MySQL :: MySQL 5.5 Reference Manual :: 13.3.1 START TRANSACTION, COMMIT, and ROLLBACK Syntax

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts