}
sub _select_rows {
- my ($self, $sql, $key, $value) = @_;
+ my ($self, $sql, $value) = @_;
my $dbh = $self->connect_db;
my $sth = $dbh->prepare($sql);
- $sth->execute($key, $value);
- my $rs = $sth->fetchall_arrayref({});
+ $sth->execute($value);
+ my $rs = $sth->fetchall_arrayref(+{});
$sth->finish;
$dbh->disconnect();
my ($self, $key, $value) = @_;
my $sql = <<"EOSQL";
SELECT * FROM users_acl
- WHERE ? = ?
+ WHERE $key = ?
EOSQL
- my $rs = $self->_select_rows($sql, $key, $value);
+ my $rs = $self->_select_rows($sql, $value);
return if (@$rs == 0);
my $ret = $rs->[0];
my ($self, $key, $value) = @_;
my $sql = <<"EOSQL";
SELECT * FROM users_info
- WHERE ? = ?
+ WHERE $key = ?
EOSQL
- my $rs = $self->_select_rows($sql, $key, $value);
+ my $rs = $self->_select_rows($sql, $value);
return if (@$rs == 0);
my $ret = $rs->[0];
sub _comments {
my ($self, $key, $value) = @_;
- my $sql = <<"EOSQL";
-SELECT * FROM users_comments
- WHERE ? = ?
-EOSQL
- my $rs = $self->_select_rows($sql, $key, $value);
+ my $sql = "SELECT * FROM users_comments WHERE $key = ?";
+ my $rs = $self->_select_rows($sql, $value);
return if (@$rs == 0);
my $ret = $rs->[0];
my ($self, $key, $value) = @_;
my $sql = <<"EOSQL";
SELECT param_id, name, value FROM users_param
- WHERE ? = ?
+ WHERE $key = ?
EOSQL
my $dbh = $self->connect_db;
my $sth = $dbh->prepare($sql);
- $sth->execute($key, $value);
+ $sth->execute($value);
my $rs = $sth->fetchall_hashref('name');
$sth->finish;