OSDN Git Service
(root)
/
newslash
/
newslash.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b8cc661
)
Model::Events: add delete_all()
author
hylom
<hylom@users.sourceforge.jp>
Fri, 31 Mar 2017 11:39:46 +0000
(20:39 +0900)
committer
hylom
<hylom@users.sourceforge.jp>
Fri, 31 Mar 2017 11:39:46 +0000
(20:39 +0900)
src/newslash_web/lib/Newslash/Model/Events.pm
patch
|
blob
|
history
diff --git
a/src/newslash_web/lib/Newslash/Model/Events.pm
b/src/newslash_web/lib/Newslash/Model/Events.pm
index
17a997a
..
01224fd
100644
(file)
--- a/
src/newslash_web/lib/Newslash/Model/Events.pm
+++ b/
src/newslash_web/lib/Newslash/Model/Events.pm
@@
-161,4
+161,20
@@
sub fetch {
return;
}
+sub delete_all {
+ my $self = shift;
+ my $table = EVENTS_TABLE_NAME;
+ my $sql = "DELETE FROM $table";
+
+ my $dbh = $self->connect_db;
+ my $rs = $dbh->do($sql);
+ if (!defined $rs) {
+ $self->set_error("delete failed", $dbh->{mysql_errorno});
+ $self->disconnect_db;
+ return;
+ }
+ $self->disconnect_db;
+ return $rs;
+}
+
1;