OK... From what I have read, the "prepare...execute" method is no more acceptable than the "do" method. My understanding is that if you are going to be inserting multiple instances, without looping, then you are better served with using the "prepare...execute" method. If you are looping through data, then using the "do" method is no worse. I am going to create a copy using the "prepare...execute" method exclusively, and time that against the existing version. This will give me very real world comparison. Thanks for the feedback again.
Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -----Original Message----- From: David N Murray [mailto:[EMAIL PROTECTED] Sent: Thursday, January 22, 2004 2:07 PM To: NIPP, SCOTT V (SBCSI) Cc: Hardy Merrill; [EMAIL PROTECTED] Subject: RE: Strange matching problem... On Jan 22, NIPP, SCOTT V (SBCSI) scribed: > OK. I am working on converting this to use placeholders and the > "qq" quoting option. I am obviously very new to placeholders, so this is > probably a stupid question, but here goes. I execute the script and receive > the following error: > > [EMAIL PROTECTED]:/home/sadmin/sn4265/perl> timex ./passwd2db.pl > Name "main::passwd" used only once: possible typo at ./passwd2db.pl line 25. > Password file for argon found. Now processing... > Undefined subroutine &main::NOW called at ./passwd2db.pl line 33, <FILE> > line 11. > > The following is the section of code that includes the "NOW" on line > 33. Obviously there is a problem with the way I am doing the placeholders > here. > > $dbh->do(qq{ > INSERT INTO acct_db VALUES(?,?,?,?,?,?,?)}, > undef,$key1,$uid,$gid,$gcos,$home,$shell,NOW()) > or print "Error updating database: ", $dbh->errstr, "\n"; That's not how its done: my $ih = $dbh->prepare("insert into acct_db values (?,?,?,?,?,?,NOW())"); # presuming NOW() is a function in your database; its not a perl function $ih->execute(undef,$key1,$uid,$gid,$gcos,$home,$shell); (and the prepare() goes outside the loop). Look at the section on Performance for an example in perldoc DBI. You probably wouldn't be hurt by buying Tim's book. HTH, Dave