If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Perl and the DBI > multiple user scenario

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Jul 2011
Posts: 14
multiple user scenario

Perl and database is Mysql.

Hi,


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

Doubts:
(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;


~Thanks
Reply With Quote
  #2 (permalink)  
Old
Registered User
 
Join Date: Dec 2012
Posts: 32
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On