[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [536] trunk/import_members.pl



Revision: 536
          http://svn.sourceforge.net/ledger-smb/?rev=536&view=rev
Author:   christopherm
Date:     2006-11-12 13:30:47 -0800 (Sun, 12 Nov 2006)

Log Message:
-----------
fixing unparametrised query, removing improper useage of $sth->rows

Modified Paths:
--------------
    trunk/import_members.pl

Modified: trunk/import_members.pl
===================================================================
--- trunk/import_members.pl	2006-11-12 21:20:17 UTC (rev 535)
+++ trunk/import_members.pl	2006-11-12 21:30:47 UTC (rev 536)
@@ -25,7 +25,6 @@
 #
 # http://www.ledgersmb.org/help/
 #
-
 use LedgerSMB::User;
 use LedgerSMB::Form;
 use LedgerSMB::Sysconfig;
@@ -95,6 +94,7 @@
 
 print "\n\nParsing members file completed. Now trying to import user data.\n\n";
 
+
 foreach (@users) {
 
 	$myUser = $member{$_};
@@ -125,12 +125,10 @@
 
 	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 @@
 		# 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;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.