Tadashi Okoshi
slash****@users*****
2005年 12月 19日 (月) 16:10:20 JST
Index: affelio/lib/Affelio/SNS/FriendManager.pm
diff -u affelio/lib/Affelio/SNS/FriendManager.pm:1.17 affelio/lib/Affelio/SNS/FriendManager.pm:1.18
--- affelio/lib/Affelio/SNS/FriendManager.pm:1.17 Mon Dec 19 14:55:24 2005
+++ affelio/lib/Affelio/SNS/FriendManager.pm Mon Dec 19 16:10:20 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: FriendManager.pm,v 1.17 2005/12/19 05:55:24 slash5234 Exp $
+# $Id: FriendManager.pm,v 1.18 2005/12/19 07:10:20 slash5234 Exp $
package Affelio::SNS::FriendManager;
{
@@ -753,6 +753,61 @@
}
########################################################################
+ #set_attribute_by_afid
+ ########################################################################
+ sub set_attribute_by_afid{
+ my $self = shift;
+ my $af_id = shift; #arg(1) uid (string)
+ my $attr = shift; #arg(2) attr (string)
+ my $value = shift; #arg(3) value (string)
+
+ my $af = $self->{af};
+ $af_id = $af->getDB->quote($af_id . '%');
+ if(($attr eq "password")
+ || ($attr eq "apps")
+ || ($attr eq "nickname")
+ || ($attr eq "intro") ){
+ $value = $af->getDB->quote($value);
+ }
+
+ ##############################
+ #set value into DB
+ my $query = "update AFuser_CORE_friends set $attr = $value where af_id like $af_id";
+ my $sth;
+ eval{
+ $sth = $af->getDB->prepare($query);
+ $sth->execute;
+ };
+ if($@){
+ throw Affelio::exception::DBException($af->getDB->errstr);
+ }
+ }
+
+ ########################################################################
+ #incr_attribute_by_afid
+ ########################################################################
+ sub incr_attribute_by_afid{
+ my $self = shift;
+ my $af_id = shift; #arg(1) uid (string)
+ my $attr = shift; #arg(2) attr (string)
+
+ my $af = $self->{af};
+ $af_id = $af->getDB->quote($af_id . '%');
+
+ ##############################
+ #set value into DB
+ my $query = "update AFuser_CORE_friends set $attr = $attr + 1 where af_id like $af_id";
+ my $sth;
+ eval{
+ $sth = $af->getDB->prepare($query);
+ $sth->execute;
+ };
+ if($@){
+ throw Affelio::exception::DBException($af->getDB->errstr);
+ }
+ }
+
+ ########################################################################
#set_attribute_by_id
########################################################################
sub set_attribute_by_id{ #void