Permalink
Browse files

fix missing $dbh->quote_identifiers()

  • Loading branch information...
1 parent f938428 commit c4faf38b3ef36aaf21f355bf4639f46b57d44dc1 @EvanCarroll committed Mar 8, 2010
Showing with 12 additions and 8 deletions.
  1. +3 −0 Changes
  2. +4 −4 lib/Catalyst/Authentication/Store/DBI.pm
  3. +5 −4 lib/Catalyst/Authentication/Store/DBI/User.pm
View
@@ -1,3 +1,6 @@
+0.02
+ - Moosified
+
0.01 Sun Nov 23 04:18:03 CET 2008
- apply knf
@@ -19,7 +19,7 @@ sub find_user {
my @col = map { $_ } sort keys %$authinfo;
my $sql =
- 'SELECT * FROM ' . $self->config->{'user_table'}
+ 'SELECT * FROM ' . $dbh->quote_identifier( $self->config->{'user_table'} )
. ' WHERE ' . join( ' AND ', map "$_ = ?", @col )
;
@@ -55,11 +55,11 @@ sub from_session {
my $sql = sprintf(
'SELECT * FROM %s WHERE %s = ?'
- , $self->config->{'user_table'}
- , $self->config->{'user_key'}
+ , $dbh->quote_identifier( $self->config->{'user_table'} )
+ , $dbh->quote_identifier( $self->config->{'user_key'} )
);
- my $sth = $dbh->prepare($sql) or die($dbh->errstr());
+ my $sth = $dbh->prepare_cached($sql) or die($dbh->errstr());
$sth->execute($frozen) or die($dbh->errstr());
my %user;
@@ -34,11 +34,12 @@ has 'roles' => (
'user_role_table', 'user_role_user_key',
);
- my $sql = sprintf('SELECT %s.%s FROM %s' .
- ' INNER JOIN %s ON %s.%s = %s.%s WHERE %s.%s = ?',
- map { $dbh->quote_identifier($store->config->{$_}) } @field);
+ my $sql = sprintf(
+ 'SELECT %s.%s FROM %s INNER JOIN %s ON %s.%s = %s.%s WHERE %s.%s = ?'
+ , map { $dbh->quote_identifier($store->config->{$_}) } @field
+ );
- $sth = $dbh->prepare($sql) or die($dbh->errstr());
+ $sth = $dbh->prepare_cached($sql) or die($dbh->errstr());
$sth->execute( $self->get($store->config->{'user_key'}) ) or
die( $dbh->errstr() );

0 comments on commit c4faf38

Please sign in to comment.