Changeset 15049 for lang/perl

Show
Ignore:
Timestamp:
07/02/08 18:44:56 (5 years ago)
Author:
33rpm
Message:

fixed invalid table names

Location:
lang/perl/Queue-Q4M/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Queue-Q4M/trunk/lib/Queue/Q4M.pm

    r14520 r15049  
    117117        grep { !/^\d+$/ } 
    118118        map  { 
    119             s/\[.*$//; 
    120             $_ 
     119            (my $v = $_) =~ s/:.*$//; 
     120            $v 
    121121        } 
    122122        @args 
  • lang/perl/Queue-Q4M/trunk/t/02_basic.t

    r14518 r15049  
    77        plan(skip_all => "Define environment variables Q4M_DSN, and optionally Q4M_USER and Q4M_PASSWORD as appropriate"); 
    88    } else { 
    9         plan(tests => 45); 
     9        plan(tests => 64); 
    1010    } 
    1111    use_ok("Queue::Q4M"); 
     
    112112} 
    113113 
     114{ 
     115    my $table   = $tables[0]; 
     116    my $timeout = 1; 
     117    my $q = Queue::Q4M->connect( 
     118        connect_info => [ $dsn, $username, $password ] 
     119    ); 
     120    ok($q); 
     121    isa_ok($q, "Queue::Q4M"); 
     122 
     123    my $max = 32; 
     124    for my $i (1..$max) { 
     125        $q->insert($table, { v => $i }); 
     126    } 
     127 
     128    my $cond  = "$table:v>16"; 
     129    my $count = 0; 
     130    while (my $rv = $q->next($cond)) { 
     131        is($rv, $table); 
     132 
     133        my $h = $q->fetch_hashref(); 
     134        $count++; 
     135        last if $h->{v} == $max; 
     136    } 
     137 
     138    is($count, 16); 
     139 
     140    $dbh->do("DELETE FROM $table"); 
     141    $q->disconnect; 
     142} 
    114143 
    115144END