Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

Perl/MySql Multiple Insert Question

3:56 am on Feb 16, 2012 (gmt 0)

New User

5+ Year Member

joined:Feb 16, 2012
posts: 7
votes: 0

Hi, I have a question as to how perl processes scripts. When a script is activated by a user, say by submitting a form does the script have to finish processing before another request can begin? The reason I ask this is has to do with mysql insert statements.

If a perl script involves multiple mysql inserts and one of the columns has a auto increment it seems as though some type of havoc could be wreaked if more than one request were being processed at any given time. What I mean is if there are more than one table with auto increment involved and more than one script were being processed couldn't a table end up with a number that does not match the number in an adjacent table. If this is possible problem is there a work around? The question came to me when I found out that multiple table inserts are not possible with one insert statement. Although this is not the mysql forum this does have something to do with the way input is inserted by perl. Or....am I over reacting over something that is really no cause for alarm?

I can only hope I'm being clear enough with this question and will try to re-word it if necessary.
7:31 am on Feb 16, 2012 (gmt 0)


WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
votes: 116

welcome to WebmasterWorld, rugrat!

in most cases the issues you are pondering are handled by the db server.
you should probably read the mysql reference sections on table locking and concurrent inserts.
MySQL 5.0 Reference Manual :: 7.7 Locking Issues:
http://dev.mysql.com/doc/refman/5.0/en/locking-issues.html [dev.mysql.com]

also from your description it sounds like you are relying on related rows in separate tables having the same primary index values.
if this is your intent you probably want to use something like a foreign key to cross-reference between tables.