OSDN Git Service
(root)
/
mubot4fb
/
mubot4fb.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e6355ad
)
add bulkget latest method
author
ISHIKAWA Mutsumi
<ishikawa@hanzubon.jp>
Fri, 2 Nov 2012 10:32:25 +0000
(19:32 +0900)
committer
ISHIKAWA Mutsumi
<ishikawa@hanzubon.jp>
Fri, 2 Nov 2012 10:32:25 +0000
(19:32 +0900)
lib/Mubot4FB/DB.pm
patch
|
blob
|
history
diff --git
a/lib/Mubot4FB/DB.pm
b/lib/Mubot4FB/DB.pm
index
664f4ea
..
cb5b642
100644
(file)
--- a/
lib/Mubot4FB/DB.pm
+++ b/
lib/Mubot4FB/DB.pm
@@
-114,6
+114,19
@@
sub search_lastpost_by_submitter {
return $ret;
}
+sub bulkget_latest {
+ my ($me, $db_args) = @_;
+ my $limit = defined $db_args->{limit} ? $db_args->{limit} : 100;
+
+ my $sth = $me->{dbh}->prepare('select * from posts order by post_time desc limit ?');
+ $sth->bind_param(1, $limit, SQL_INTEGER);
+ $sth->execute();
+
+ my $ret = $sth->fetchall_arrayref({});
+ $sth->finish;
+ return $ret;
+}
+
sub commit {
my ($me) = @_;
$me->{dbh}->commit;