From 67b84f7a38c60b8ec8bde69c52258522362508b6 Mon Sep 17 00:00:00 2001 From: christopherm Date: Sun, 12 Nov 2006 21:30:47 +0000 Subject: fixing unparametrised query, removing improper useage of $sth->rows git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@536 4979c152-3d1c-0410-bac9-87ea11338e46 --- import_members.pl | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/import_members.pl b/import_members.pl index 42da0c7f..1cd70d54 100755 --- a/import_members.pl +++ b/import_members.pl @@ -25,7 +25,6 @@ # # http://www.ledgersmb.org/help/ # - use LedgerSMB::User; use LedgerSMB::Form; use LedgerSMB::Sysconfig; @@ -95,6 +94,7 @@ close(FH); print "\n\nParsing members file completed. Now trying to import user data.\n\n"; + foreach (@users) { $myUser = $member{$_}; @@ -125,12 +125,10 @@ sub save_member { if($userID){ #got an id, check to see if it's in the users_conf table - my $userConfCheck = $dbh->prepare("SELECT id FROM users_conf WHERE id = ?"); + my $userConfCheck = $dbh->prepare("SELECT count(*) FROM users_conf WHERE id = ?"); $userConfCheck->execute($userID); - if($userConfCheck->rows){ - my $userConfExists = 1; - } + ($userConfExists) = $userConfCheck->fetchrow_array; } else{ my $userConfAdd = $dbh->prepare("SELECT create_user(?);"); @@ -213,8 +211,7 @@ sub save_member { # add login to employee table if it does not exist my $login = $self->{login}; $login =~ s/@.*//; - my $query = qq|SELECT id FROM employee WHERE login = ?|; - my $sth = $dbh->prepare($query); + my $sth = $dbh->prepare("SELECT id FROM employee WHERE login = ?;"); $sth->execute($login); my ($id) = $sth->fetchrow_array; -- cgit v1.2.3