Changeset 240:d7613fb27e8f
- Timestamp:
- 07/27/08 23:28:53 (4 years ago)
- Author:
- Anselm Lingnau <anselm@…>
- Branch:
- default
- Message:
-
Treat addresses "modulo capitalisation" when retrieving from the database.
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r225
|
r240
|
|
| 1126 | 1126 | unless UNIVERSAL::isa($address, "Email::Address"); |
| 1127 | 1127 | |
| 1128 | | my($cmd) = q{SELECT id FROM subscribers WHERE local || '@' || domain = ?}; |
| | 1128 | my($cmd) = q{SELECT id FROM subscribers WHERE LOWER(local || '@' || domain) = LOWER(?)}; |
| 1129 | 1129 | $ref = $self->{dbh}->selectrow_arrayref($cmd, {}, $address->address); |
| 1130 | 1130 | unless ($ref) { |
| … |
… |
|
| 1140 | 1140 | # Delete the address |
| 1141 | 1141 | $self->{dbh}->begin_work; |
| 1142 | | $self->{dbh}->do("DELETE FROM confirmations WHERE address = ?", |
| | 1142 | $self->{dbh}->do("DELETE FROM confirmations WHERE LOWER(address) = LOWER(?)", |
| 1143 | 1143 | {}, $address->address) or $result = 0; |
| 1144 | 1144 | if ($result) { |
| … |
… |
|
| 1233 | 1233 | my ($hash) = $self->{dbh}->selectrow_hashref(<<"", {}, $address->address); |
| 1234 | 1234 | SELECT * FROM subscribers |
| 1235 | | WHERE local || '\@' || domain = ? |
| | 1235 | WHERE LOWER(local || '\@' || domain) = LOWER(?) |
| | 1236 | |
| | 1237 | return {} unless defined $hash; |
| 1236 | 1238 | |
| 1237 | 1239 | my (%result); |
-
|
r225
|
r240
|
|
| 1 | 1 | #!/usr/bin/perl -w |
| 2 | 2 | |
| 3 | | use Test::More tests => 186; |
| | 3 | use Test::More tests => 196; |
| 4 | 4 | use Test::DatabaseRow; |
| 5 | 5 | use Test::Exception; |
| … |
… |
|
| 317 | 317 | |
| 318 | 318 | can_ok($db, 'get_address_options'); |
| 319 | | foreach my $i (0 .. $#options) { |
| 320 | | $db->set_address_options($address, { $options[$i] => 1 }); |
| 321 | | my $opts; |
| 322 | | $ref->{$options[$i]} = 1; |
| 323 | | ok( $opts = $db->get_address_options($address), "getting address options" ); |
| 324 | | is_deeply($opts, $ref, "option $options[$i] set"); |
| 325 | | $db->set_address_options($address, { $options[$i] => 0 }); |
| 326 | | $ref->{$options[$i]} = 0; |
| | 319 | foreach my $a ($address, ucfirst($address)) { |
| | 320 | foreach my $i (0 .. $#options) { |
| | 321 | $db->set_address_options($a, { $options[$i] => 1 }); |
| | 322 | my $opts; |
| | 323 | $ref->{$options[$i]} = 1; |
| | 324 | ok( $opts = $db->get_address_options($a), "getting address options" ); |
| | 325 | is_deeply($opts, $ref, "option $options[$i] set"); |
| | 326 | $db->set_address_options($a, { $options[$i] => 0 }); |
| | 327 | $ref->{$options[$i]} = 0; |
| | 328 | } |
| 327 | 329 | } |
| 328 | 330 | |