diff options
author | christopherm <christopherm@4979c152-3d1c-0410-bac9-87ea11338e46> | 2006-11-12 21:30:47 +0000 |
---|---|---|
committer | christopherm <christopherm@4979c152-3d1c-0410-bac9-87ea11338e46> | 2006-11-12 21:30:47 +0000 |
commit | 67b84f7a38c60b8ec8bde69c52258522362508b6 (patch) | |
tree | 1728b13726b399e88534c0810b54ac251a56844b | |
parent | 470ab6c726593acbb063a5b1a2a8ae6ff1d27ccf (diff) |
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
-rwxr-xr-x | import_members.pl | 11 |
1 files 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; |