[Affelio-cvs 714] CVS update: affelio/lib/Affelio/Managing

Back to archive index

Tadashi Okoshi slash****@users*****
2005年 10月 27日 (木) 20:15:01 JST


Index: affelio/lib/Affelio/Managing/AccessLogManager.pm
diff -u affelio/lib/Affelio/Managing/AccessLogManager.pm:1.7 affelio/lib/Affelio/Managing/AccessLogManager.pm:1.8
--- affelio/lib/Affelio/Managing/AccessLogManager.pm:1.7	Sat Jul  2 01:24:40 2005
+++ affelio/lib/Affelio/Managing/AccessLogManager.pm	Thu Oct 27 20:15:01 2005
@@ -14,7 +14,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
-# $Id: AccessLogManager.pm,v 1.7 2005/07/01 16:24:40 slash5234 Exp $
+# $Id: AccessLogManager.pm,v 1.8 2005/10/27 11:15:01 slash5234 Exp $
 
 package Affelio::Managing::AccessLogManager;
 {
@@ -69,7 +69,7 @@
 	################################
 	my $create_tbl_cmd = "CREATE TABLE AFuser_CORE_accesslog(id INTEGER PRIMARY KEY, id2 INTEGER, timestamp BIGINT, nickname TEXT, afid TEXT, type TEXT)";
 	eval{
-	    $af->{db}->do($create_tbl_cmd);
+	    $af->getDB()->do($create_tbl_cmd);
 	};
 	if($@){
 	}else{
@@ -84,12 +84,12 @@
 	$query1 = "SELECT * FROM AFuser_CORE_accesslog WHERE timestamp >= $startoftheday AND afid = '$afid'";
 	debug_print("AccessLog:save: q=[$query1]");
 	eval{
-	    $sth1 = $af->{db}->prepare($query1);
+	    $sth1 = $af->getDB()->prepare($query1);
 	    $sth1->execute();
 	    @row1 = $sth1->fetchrow_array;
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB()->errstr);
 	}
 
 	if(@row1 == () ){
@@ -101,11 +101,11 @@
 	    my $query2 = 'SELECT max(id) FROM AFuser_CORE_accesslog';
 	    my $sth2;
 	    eval{
-		$sth2 = $af->{db}->prepare($query2);
+		$sth2 = $af->getDB()->prepare($query2);
 		$sth2->execute;
 	    };
 	    if($@){
-		throw Affelio::exception::DBException($af->{db}->errstr);
+		throw Affelio::exception::DBException($af->getDB()->errstr);
 	    }
 
 	    my @row2 = $sth2->fetchrow_array;
@@ -125,11 +125,11 @@
 	    if($afid =~ /http/){
 		$query2 = 'SELECT max(id2) FROM AFuser_CORE_accesslog';
 		eval{
-		    $sth2 = $af->{db}->prepare($query2);
+		    $sth2 = $af->getDB()->prepare($query2);
 		    $sth2->execute;
 		};
 		if($@){
-		    throw Affelio::exception::DBException($af->{db}->errstr);
+		    throw Affelio::exception::DBException($af->getDB()->errstr);
 		}
 
 		@row2 = $sth2->fetchrow_array;
@@ -149,12 +149,12 @@
 	    my $query3; my $sth3;
 	    $query3 = "insert into AFuser_CORE_accesslog(id, id2, timestamp, nickname, afid, type) values ($newid, $newid2, $cur_time, '$nickname', '$afid', '$type')";
 	    eval{
-		$sth3 = $af->{db}->prepare($query3);
+		$sth3 = $af->getDB()->prepare($query3);
 		$sth3->execute();
 	    };
 	    debug_print("AccessLog:save: inserted [$query3]");
 	    if($@){
-		throw Affelio::exception::DBException($af->{db}->errstr);
+		throw Affelio::exception::DBException($af->getDB()->errstr);
 	    }
 
 	    debug_print("AccessLog:save: recorded!");
@@ -179,7 +179,7 @@
 	################################
 	my $create_tbl_cmd = "CREATE TABLE AFuser_CORE_accesslog(id INTEGER PRIMARY KEY, id2 INTEGER, timestamp INTEGER, nickname TEXT, afid TEXT, type TEXT)";
 	eval{
-	    $af->{db}->do($create_tbl_cmd);
+	    $af->getDB()->do($create_tbl_cmd);
 	};
 	if($@){
 	}else{
@@ -191,11 +191,11 @@
 	my $query = "SELECT * FROM AFuser_CORE_accesslog WHERE timestamp > $from AND timestamp < $to order by id desc";
 	my $sth;
 	eval{
-	    $sth = $af->{db}->prepare($query); 
+	    $sth = $af->getDB()->prepare($query); 
 	    $sth->execute;
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB()->errstr);
 	}
 	return($sth);
     }
Index: affelio/lib/Affelio/Managing/ApplicationManager.pm
diff -u affelio/lib/Affelio/Managing/ApplicationManager.pm:1.8 affelio/lib/Affelio/Managing/ApplicationManager.pm:1.9
--- affelio/lib/Affelio/Managing/ApplicationManager.pm:1.8	Mon Oct 24 17:52:49 2005
+++ affelio/lib/Affelio/Managing/ApplicationManager.pm	Thu Oct 27 20:15:01 2005
@@ -14,7 +14,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
-# $Id: ApplicationManager.pm,v 1.8 2005/10/24 08:52:49 slash5234 Exp $
+# $Id: ApplicationManager.pm,v 1.9 2005/10/27 11:15:01 slash5234 Exp $
 
 package Affelio::Managing::ApplicationManager;
 {
@@ -78,7 +78,7 @@
 
 	    debug_print("AppManager::get_summed_app_perm: q=[$query]");
 	    
-	    my $sth = $af->{db}->prepare($query) or 
+	    my $sth = $af->getDB()->prepare($query) or 
 		throw Affelio::exception::DBException("cannot insert");
 	    $sth->execute() or 
 		throw Affelio::exception::DBException("cannot insert");
@@ -103,7 +103,7 @@
 	    #(1) as a friend
 	    my $query = "select $action_type from AFuser_" . $app_name 
 		."_permission where type = 'f' and target_id = '$visitor_mode'";
-	    my $sth = $af->{db}->prepare($query) or 
+	    my $sth = $af->getDB()->prepare($query) or 
 		throw Affelio::exception::DBException("cannot insert");
 	    $sth->execute() or 
 		throw Affelio::exception::DBException("cannot insert");
@@ -118,10 +118,10 @@
 	    #Get the visitor's UID
 	    my ($t_uid, $t_afid, $t_nickname, $t_time,
 		$t_pass, $t_intro, $t_pid, $t_lastupdated, $t_f2list) 
-		= $af->{fm}->get_friend_by_afid($visitor_id);
+		= $af->getFM->get_friend_by_afid($visitor_id);
 
 	    #Get the visitor's groups
-	    my $SQL_result = $af->{gm}->get_groups_by_uid($t_uid);
+	    my $SQL_result = $af->getGM->get_groups_by_uid($t_uid);
 
 	    #For each group...
 	    my @g_data=();
@@ -131,7 +131,7 @@
 
 		my $query = "select $action_type from AFuser_" . $app_name 
 		    ."_permission where type = 'g' and target_id = '$gid'";
-		my $sth = $af->{db}->prepare($query) or 
+		my $sth = $af->getDB()->prepare($query) or 
 		    throw Affelio::exception::DBException("cannot insert");
 		$sth->execute() or 
 		    throw Affelio::exception::DBException("cannot insert");
@@ -163,11 +163,11 @@
 	my $query = 'SELECT * FROM AFuser_' . $app_name . '_permission';
 	my $sth;
 	eval{
-	    $sth = $af->{db}->prepare($query);
+	    $sth = $af->getDB()->prepare($query);
 	    $sth->execute;
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB()->errstr);
 	}
 
 	debug_print("get_all_premission: end");
@@ -188,7 +188,7 @@
 
 	my $query = "SELECT * FROM " . $my_table_name;
 	eval{
-	    my $sth = $af->{db}->prepare($query);
+	    my $sth = $af->getDB()->prepare($query);
 	    my @dummy = $sth->execute();
 	};
 	if($@){
@@ -218,7 +218,7 @@
 
 	    debug_print("AppManager::check_table: create_SQL = [".$create_table_SQL."]");
 
-	    my $sth = $af->{db}->prepare($create_table_SQL) or 
+	    my $sth = $af->getDB()->prepare($create_table_SQL) or 
 		throw Affelio::exception::DBException("cannot create table");
 	    $sth->execute() or 
 		throw Affelio::exception::DBException("cannot create table");
@@ -229,7 +229,7 @@
 	    #Synchronized the table
 	    # Find all records from AFuser_CORE_permission and
 	    # prepare 0-filled records into my table
-	    my $CORE_perm_tbl = $af->{perm}->get_all_permission();
+	    my $CORE_perm_tbl = $af->getPERM->get_all_permission();
 	    while( my($pid, $type, $target, $dummy) = $CORE_perm_tbl->fetchrow_array ){
 
 		my $SQL = $new_rec_SQL . " values ('$pid','$type','$target',1,0,";
@@ -240,7 +240,7 @@
 		$SQL .= ")";
 		
 		debug_print("AppManager::check_table: insert_SQL = [".$SQL."]");
-		my $sth = $af->{db}->prepare($SQL) or 
+		my $sth = $af->getDB()->prepare($SQL) or 
 		    throw Affelio::exception::DBException("cannot insert");
 		$sth->execute() or 
 		    throw Affelio::exception::DBException("cannot insert");
@@ -272,11 +272,11 @@
 	#access DB
 	my $sth;
 	eval{
-	    $sth = $af->{db}->prepare($query);
+	    $sth = $af->getDB()->prepare($query);
 	    $sth->execute;
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB()->errstr);
 	}
 
 	#debug_print("AppManager::update_permission end.");
Index: affelio/lib/Affelio/Managing/GroupManager.pm
diff -u affelio/lib/Affelio/Managing/GroupManager.pm:1.6 affelio/lib/Affelio/Managing/GroupManager.pm:1.7
--- affelio/lib/Affelio/Managing/GroupManager.pm:1.6	Fri Jul  1 13:00:30 2005
+++ affelio/lib/Affelio/Managing/GroupManager.pm	Thu Oct 27 20:15:01 2005
@@ -14,7 +14,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-# $Id: GroupManager.pm,v 1.6 2005/07/01 04:00:30 slash5234 Exp $
+# $Id: GroupManager.pm,v 1.7 2005/10/27 11:15:01 slash5234 Exp $
 
 package Affelio::Managing::GroupManager;
 {
@@ -62,11 +62,11 @@
 	my $query = 'SELECT max(gid) FROM AFuser_CORE_group';
 	my $sth;
 	eval{
-	    $sth = $af->{db}->prepare($query);
+	    $sth = $af->getDB->prepare($query);
 	    $sth->execute;
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 
 	my @row = $sth->fetchrow_array;
@@ -82,11 +82,11 @@
 	#Insert a new record
 	$query = 'insert into AFuser_CORE_group(gid, group_name, members, option_pid) values (?,?,?,?)';
 	eval{
-	    $sth = $af->{db}->prepare($query);
+	    $sth = $af->getDB->prepare($query);
 	    $sth->execute($maxid+1, $group_name, ",", -1);
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 
 	debug_print("add_group: end.");
@@ -106,11 +106,11 @@
 	my $query1 = 'SELECT option_pid FROM AFuser_CORE_group WHERE gid = ?';
 	my $sth1;
 	eval{
-	    $sth1 = $af->{db}->prepare($query1);
+	    $sth1 = $af->getDB->prepare($query1);
 	    $sth1->execute($gid);
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 
 	my @row1 = $sth1->fetchrow_array;
@@ -119,15 +119,15 @@
 	my $query2 = 'DELETE FROM AFuser_CORE_group WHERE gid = ?';
 	my $sth2;
 	eval{
-	    $sth2 = $af->{db}->prepare($query2);
+	    $sth2 = $af->getDB->prepare($query2);
 	    $sth2->execute($gid);
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 
 	use Affelio::Managing::PermissionManager;
-	$af->{perm}->remove_permission_by_pid($perm_id);
+	$af->getPERM->remove_permission_by_pid($perm_id);
 
 	debug_print("remove_group: end.");
     }
@@ -148,11 +148,11 @@
 	my $query = "update AFuser_CORE_group set group_name = '$new_name' where gid = $gid";
 	my $sth;
 	eval{
-	    $sth = $af->{db}->prepare($query);
+	    $sth = $af->getDB->prepare($query);
 	    $sth->execute;
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 
 	debug_print("rename_group: end.");
@@ -172,11 +172,11 @@
 	my $query = 'SELECT members FROM AFuser_CORE_group WHERE gid = ?';
 	my $sth;
 	eval{
-	    $sth = $af->{db}->prepare($query);
+	    $sth = $af->getDB->prepare($query);
 	    $sth->execute($gid);
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 
 	my @row = $sth->fetchrow_array;
@@ -207,11 +207,11 @@
 	my $query = 'SELECT * FROM AFuser_CORE_group WHERE gid = ?';
 	my $sth;
 	eval{
-	    $sth = $af->{db}->prepare($query);
+	    $sth = $af->getDB->prepare($query);
 	    $sth->execute($gid); 
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 	my @row = $sth->fetchrow_array;
 
@@ -238,11 +238,11 @@
 	#Update DB
 	$query = "update AFuser_CORE_group set members = '$new_mem' where gid = $gid";
 	eval{
-	    $sth = $af->{db}->prepare($query);
+	    $sth = $af->getDB->prepare($query);
 	    $sth->execute;
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 
 	debug_print("add_member: end.");
@@ -258,7 +258,7 @@
 
 	my $af=$self->{af};
 
-	db_value_replace($af->{db},
+	db_value_replace($af->getDB,
 			 "AFuser_CORE_group",
 			 "gid",
 			 "members",
@@ -282,11 +282,11 @@
 	my $query = 'SELECT members FROM AFuser_CORE_group WHERE gid = ?';
 	my $sth;
 	eval{
-	    $sth = $af->{db}->prepare($query);
+	    $sth = $af->getDB->prepare($query);
 	    $sth->execute($gid);
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 	my @row = $sth->fetchrow_array;
 
@@ -302,11 +302,11 @@
 	my $query2 = "update AFuser_CORE_group set members = '$row[0]' where gid = $gid";
 	my $sth2;
 	eval{
-	    $sth2= $af->{db}->prepare($query2);
+	    $sth2= $af->getDB->prepare($query2);
 	    $sth2->execute;
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 
 	debug_print("remove_member: end.");
@@ -333,11 +333,11 @@
 	#retrieve a friend record from DB
 	my $sth;
 	eval{
-	    $sth = $af->{db}->prepare($query);
+	    $sth = $af->getDB->prepare($query);
 	    $sth->execute();
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 	return($sth);
     }
@@ -363,11 +363,11 @@
 	#retrieve a friend record from DB
 	my $sth;
 	eval{
-	    $sth = $af->{db}->prepare($query);
+	    $sth = $af->getDB->prepare($query);
 	    $sth->execute();
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 	return($sth);
     }
@@ -388,11 +388,11 @@
 	my $query = 'SELECT * FROM AFuser_CORE_group';
 	my $sth;
 	eval{
-	    $sth= $af->{db}->prepare($query);
+	    $sth= $af->getDB->prepare($query);
 	    $sth->execute;
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 
 	return($sth);
@@ -434,11 +434,11 @@
 	my $query = "update AFuser_CORE_group set members = '$uids_str' where gid = $gid";
 	my $sth;
 	eval{
-	    $sth= $af->{db}->prepare($query);
+	    $sth= $af->getDB->prepare($query);
 	    $sth->execute;
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 
 	debug_print("set_member_by_string: end.");
@@ -460,11 +460,11 @@
 	my $query = "update AFuser_CORE_group set option_pid = $pid where gid = $gid";
 	my $sth;
 	eval{
-	    $sth= $af->{db}->prepare($query);
+	    $sth= $af->getDB->prepare($query);
 	    $sth->execute;
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 
 	debug_print("set_pid: end.");
Index: affelio/lib/Affelio/Managing/MessageManager.pm
diff -u affelio/lib/Affelio/Managing/MessageManager.pm:1.8 affelio/lib/Affelio/Managing/MessageManager.pm:1.9
--- affelio/lib/Affelio/Managing/MessageManager.pm:1.8	Fri Jul  1 16:56:31 2005
+++ affelio/lib/Affelio/Managing/MessageManager.pm	Thu Oct 27 20:15:01 2005
@@ -14,7 +14,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
-# $Id: MessageManager.pm,v 1.8 2005/07/01 07:56:31 slash5234 Exp $
+# $Id: MessageManager.pm,v 1.9 2005/10/27 11:15:01 slash5234 Exp $
 
 package Affelio::Managing::MessageManager;
 {
@@ -62,11 +62,11 @@
 
 	my $sth;
 	eval{
-	    $sth = $af->{db}->prepare(q{SELECT * FROM AFuser_CORE_message where readflag=0});
+	    $sth = $af->getDB->prepare(q{SELECT * FROM AFuser_CORE_message where readflag=0});
 	    $sth->execute;
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	    return("");
 	}
 
@@ -92,11 +92,11 @@
 	my $query = "update AFuser_CORE_message set readflag = 1 where mid = $mid";
 	my $sth;
 	eval{
-	    $sth = $af->{db}->prepare($query);
+	    $sth = $af->getDB->prepare($query);
 	    $sth->execute;
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 
 	debug_print("MM::retrieve_all: end");
@@ -119,11 +119,11 @@
 	#retrieve all friend records from DB
 	my $sth;
 	eval{
-	    $sth = $af->{db}->prepare(q{SELECT * FROM AFuser_CORE_message order by timestamp desc});
+	    $sth = $af->getDB->prepare(q{SELECT * FROM AFuser_CORE_message order by timestamp desc});
 	    $sth->execute;
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 
 	debug_print("MM::retrieve_all: end");
@@ -146,11 +146,11 @@
 	#retrieve all friend records from DB
 	my $sth;
 	eval{
-	    $sth = $af->{db}->prepare("SELECT * FROM AFuser_CORE_message where mid = $mid");
+	    $sth = $af->getDB->prepare("SELECT * FROM AFuser_CORE_message where mid = $mid");
 	    $sth->execute;
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 
 	my @row = $sth->fetchrow_array;
@@ -189,11 +189,11 @@
 	#Get existing max ID
 	my $sth;
 	eval{
-	    $sth = $af->{db}->prepare(q{SELECT max(mid) FROM AFuser_CORE_message});
+	    $sth = $af->getDB->prepare(q{SELECT max(mid) FROM AFuser_CORE_message});
 	    $sth->execute;
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 
 	my @row = $sth->fetchrow_array;
@@ -217,11 +217,11 @@
 	#Insert a new record
 	my $str10 = "insert into AFuser_CORE_message(msgbody, mid, timestamp, msgtitle, msgtype, msgfrom, readflag) values ('$body', $newid, '$cur_time', '$title', '$type', '$from', 0)";
 	eval{
-	    $sth = $af->{db}->prepare($str10);
+	    $sth = $af->getDB->prepare($str10);
 	    $sth->execute;
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 	undef($sth);
 
Index: affelio/lib/Affelio/Managing/PermissionManager.pm
diff -u affelio/lib/Affelio/Managing/PermissionManager.pm:1.4 affelio/lib/Affelio/Managing/PermissionManager.pm:1.5
--- affelio/lib/Affelio/Managing/PermissionManager.pm:1.4	Fri Jul  1 11:00:08 2005
+++ affelio/lib/Affelio/Managing/PermissionManager.pm	Thu Oct 27 20:15:01 2005
@@ -14,7 +14,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
-# $Id: PermissionManager.pm,v 1.4 2005/07/01 02:00:08 slash5234 Exp $
+# $Id: PermissionManager.pm,v 1.5 2005/10/27 11:15:01 slash5234 Exp $
 
 package Affelio::Managing::PermissionManager;
 {
@@ -73,11 +73,11 @@
 	my $query = 'SELECT max(pid) FROM AFuser_CORE_permission';
 	my $sth;
 	eval{
-	    $sth= $af->{db}->prepare($query);
+	    $sth= $af->getDB->prepare($query);
 	    $sth->execute;
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 
 	my @row = $sth->fetchrow_array;
@@ -103,11 +103,11 @@
 
 	#DB access
 	eval{
-	    $sth = $af->{db}->prepare($query);
+	    $sth = $af->getDB->prepare($query);
 	    $sth->execute($newid, $type, $id);
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 
 	debug_print("add_permission DB access done.");
@@ -118,7 +118,7 @@
 	if($type eq "p"){
 	    #Set this new pid into Friend table record.
 	    try{
-		$af->{fm}->set_attribute_by_id($id, "option_pid", $newid); 
+		$af->getFM->set_attribute_by_id($id, "option_pid", $newid); 
 	    }catch Affelio::exception::DBException with {
 		my $e = shift; 
 		throw $e;
@@ -126,7 +126,7 @@
 	}
 	if($type eq "g"){
 	    #Set this new pid into Group table record.
-	    $af->{gm}->set_pid($id, $newid);
+	    $af->getGM->set_pid($id, $newid);
 	}
 
 	debug_print("add_permission end.");
@@ -165,11 +165,11 @@
 	#access DB
 	my $sth;
 	eval{
-	    $sth = $af->{db}->prepare($query);
+	    $sth = $af->getDB->prepare($query);
 	    $sth->execute;
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 
 	debug_print("PermissionManager::update_permission end.");
@@ -191,11 +191,11 @@
 
 	my $sth;
 	eval{
-	    $sth = $af->{db}->prepare($query);
+	    $sth = $af->getDB->prepare($query);
 	    $sth->execute;
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 
 	debug_print("get_permission end.");
@@ -217,11 +217,11 @@
 
 	my $sth;
 	eval{
-	    $sth = $af->{db}->prepare($query);
+	    $sth = $af->getDB->prepare($query);
 	    $sth->execute($pid);
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 
 	debug_print("get_permission_by_pid end.");
@@ -241,11 +241,11 @@
 	my $query = 'DELETE FROM AFuser_CORE_permission WHERE pid = ?';
 	my $sth;
 	eval{
-	    $sth = $af->{db}->prepare($query);
+	    $sth = $af->getDB->prepare($query);
 	    $sth->execute($pid);
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 	
 	debug_print("remove_permission_by_pid end.");
@@ -268,11 +268,11 @@
 
 	my $sth;
 	eval{
-	    $sth = $af->{db}->prepare($query);
+	    $sth = $af->getDB->prepare($query);
 	    $sth->execute;
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 
 	debug_print("get_all_premission: end");
Index: affelio/lib/Affelio/Managing/ProfileManager.pm
diff -u affelio/lib/Affelio/Managing/ProfileManager.pm:1.4 affelio/lib/Affelio/Managing/ProfileManager.pm:1.5
--- affelio/lib/Affelio/Managing/ProfileManager.pm:1.4	Fri Jul  1 11:00:08 2005
+++ affelio/lib/Affelio/Managing/ProfileManager.pm	Thu Oct 27 20:15:01 2005
@@ -14,7 +14,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-# $Id: ProfileManager.pm,v 1.4 2005/07/01 02:00:08 slash5234 Exp $
+# $Id: ProfileManager.pm,v 1.5 2005/10/27 11:15:01 slash5234 Exp $
 
 package Affelio::Managing::ProfileManager;
 {
@@ -92,11 +92,11 @@
 	my $query = "SELECT * FROM AFuser_CORE_prof where attribute = '$attribute'";
 	my $sth1;
 	eval{
-	    $sth1 = $af->{db}->prepare($query);
+	    $sth1 = $af->getDB->prepare($query);
 	    $sth1->execute;
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	}
 
 	my @result= $sth1->fetchrow_array();
@@ -104,11 +104,11 @@
 	    my $query2 = 'insert into AFuser_CORE_prof(attribute, value) values (?,?)';
 	    my $sth2;
 	    eval{
-		$sth2 = $af->{db}->prepare($query2);
+		$sth2 = $af->getDB->prepare($query2);
 		$sth2->execute($attribute, $value);
 	    };
 	    if($@){
-		throw Affelio::exception::DBException($af->{db}->errstr);
+		throw Affelio::exception::DBException($af->getDB->errstr);
 	    }
 
 	}else{
@@ -116,11 +116,11 @@
 
 	    my $sth3;
 	    eval{
-		$sth3 = $af->{db}->prepare($query3);
+		$sth3 = $af->getDB->prepare($query3);
 		$sth3->execute;
 	    };
 	    if($@){
-		throw Affelio::exception::DBException($af->{db}->errstr);
+		throw Affelio::exception::DBException($af->getDB->errstr);
 	    }
 	}
     }
@@ -167,11 +167,11 @@
 	my $query = 'SELECT * FROM AFuser_CORE_prof';
 
 	eval{
-	    $sth = $af->{db}->prepare($query);
+	    $sth = $af->getDB->prepare($query);
 	    $sth->execute(); 
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	};
 
 	return($sth);
@@ -191,11 +191,11 @@
 	my $sth;
 
 	eval{
-	    $sth = $af->{db}->prepare($query);
+	    $sth = $af->getDB->prepare($query);
 	    $sth->execute;
 	};
 	if($@){
-	    throw Affelio::exception::DBException($af->{db}->errstr);
+	    throw Affelio::exception::DBException($af->getDB->errstr);
 	};
 
 	return($sth);
Index: affelio/lib/Affelio/Managing/WhatsNewManager.pm
diff -u affelio/lib/Affelio/Managing/WhatsNewManager.pm:1.3 affelio/lib/Affelio/Managing/WhatsNewManager.pm:1.4
--- affelio/lib/Affelio/Managing/WhatsNewManager.pm:1.3	Fri Jul  1 11:00:08 2005
+++ affelio/lib/Affelio/Managing/WhatsNewManager.pm	Thu Oct 27 20:15:01 2005
@@ -14,7 +14,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
-# $Id: WhatsNewManager.pm,v 1.3 2005/07/01 02:00:08 slash5234 Exp $
+# $Id: WhatsNewManager.pm,v 1.4 2005/10/27 11:15:01 slash5234 Exp $
 
 package Affelio::Managing::WhatsNewManager;
 {
@@ -62,7 +62,7 @@
 
 	##############################
 	#retrieve all friend records from DB
-	my $sth = $af->{db}->prepare(q{SELECT * FROM AFuser_CORE_message}) or die $af->{db}->errstr;
+	my $sth = $af->getDB->prepare(q{SELECT * FROM AFuser_CORE_message}) or die $af->getDB->errstr;
 	$sth->execute;
 
 	debug_print("MM::retrieve: end");
@@ -95,7 +95,7 @@
 
 	##############################
 	#Get existing max ID
-	my $sth = $af->{db}->prepare(q{SELECT max(mid) FROM AFuser_CORE_message}) or die $af->{db}->errstr;
+	my $sth = $af->getDB->prepare(q{SELECT max(mid) FROM AFuser_CORE_message}) or die $af->getDB->errstr;
 	$sth->execute;
 	my @row = $sth->fetchrow_array;
 	my $maxid = $row[0];
@@ -115,8 +115,8 @@
 	##############################
 	#Insert a new record
 	my $str1 = "insert into AFuser_CORE_message(mid, timestamp, msgtitle, msgtype, msgfrom, msgbody, readflag) values ($newid, '$cur_time', '$title', '$type', '$from', '$body', 0)";
-	$sth = $af->{db}->prepare($str1) or die $af->{db}->errstr;
-	$sth->execute or  die $af->{db}->errstr;
+	$sth = $af->getDB->prepare($str1) or die $af->getDB->errstr;
+	$sth->execute or  die $af->getDB->errstr;
 
 	Affelio::misc::Debug::debug_print("MM::post_message: end.");
 


Affelio-cvs メーリングリストの案内
Back to archive index