- Timestamp:
- 04/06/09 02:13:06 (15 years ago)
- Location:
- trunk/lib/Vote
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Vote/DB.pm
r161 r165 11 11 use Vote::DB::Ballot; # see ballot() 12 12 use Vote::DB::Voting; # see delete_voting() 13 use Vote::DB::Choice; 13 14 14 15 =head1 NAME … … 146 147 } 147 148 148 # Choice sub class ??149 150 149 sub choice_info { 151 150 my ($self, $chid) = @_; 152 my $sth = $self->db->prepare_cached( 153 q{select * from choice where key = ?} 154 ); 155 $sth->execute($chid); 156 my $res = $sth->fetchrow_hashref; 157 $sth->finish; 158 $res 159 } 160 161 sub modify_choice { 162 my ($self, $chid, $label) = @_; 163 164 my $sth = $self->db->prepare_cached( 165 q{update choice set label = ? where key = ?} 166 ); 167 $sth->execute($label, $chid); 151 Vote::DB::Choice->new($self->{dbstring}, $chid)->info; 168 152 } 169 153 -
trunk/lib/Vote/DB/Poll.pm
r161 r165 10 10 use Vote::DB::Ballot; 11 11 use Vote::DB::Voting; 12 use Vote::DB::Choice; 12 13 13 14 =head1 NAME … … 212 213 } 213 214 215 sub choice { 216 my ($self, $chid) = @_; 217 218 my $sth = $self->db->prepare_cached( 219 q{ 220 select key from choice where poll = ? and key = ? 221 } 222 ); 223 $sth->execute($self->voteid, $chid); 224 my $res = $sth->fetchrow_hashref; 225 $sth->finish; 226 return $res ? Vote::DB::Choice->new($self->{dbstring}, $chid) : undef; 227 } 228 214 229 sub choices { 215 230 my ($self) = @_; … … 242 257 243 258 1 259 } 260 261 sub delete_choice { 262 my ($self, $chid) = @_; 263 264 my $sth = $self->db->prepare_cached( 265 q{delete from choice where key = ?} 266 ); 267 268 $sth->execute($chid); 244 269 } 245 270
Note: See TracChangeset
for help on using the changeset viewer.