Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Basic Perl trumps DBI? Or my poor DB design?

by punch_card_don (Curate)
on Oct 23, 2004 at 13:34 UTC ( [id://401827]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        $num_respondents = 20000;
        $offset = 0;
    ...
            if ($offset < 4) {$offset++;}
            else {$offset = 0;}
        }
    
  2. or download this
    respondent_1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0...
    respondent_2, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0...
    respondent_3, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0...
    
  3. or download this
        $sql = "INSERT INTO theTable (response, respondent) VALUES (?,?)";
        $sth = $dbh->prepare($sql) or die("Could not prepare!" . $dbh->err
    +str);
    ...
            if ($i < 5) {$i++;}
            else {$i = 1;}
        }
    
  4. or download this
    1, 1
    6,1
    ...
    8, 3
    13, 3
    ...
    
  5. or download this
        $respondents_by_5 = 4000;
        $sql = "SHOW TABLES";
    ...
                $stf->execute($respondent) or die("Could not execute!" . $
    +dbh->errstr);
            }
        }
    
  6. or download this
    Table_1:1, 6, 11, 16, ..., 19996
    Table_2:2, 7, 12, 17, ..., 19997
    ...
    Table_5:5, 10, 15, 20, .., 20000
    Table_6:1, 6, 11, 16, ..., 19996
    etc.
    
  7. or download this
        $j = 1;
        for $r (1 .. $num_responses) {
    ...
        &write_lines_to_file(1, $table, @lines_6666);
        $table = ">".$db_dir."/r9999";
        &write_lines_to_file(1, $table, @lines_9999);
    
  8. or download this
    sub write_lines_to_file {
        my $add_line_return = shift;
    ...
           close(FILE);
        select($STDOUT_Handle);
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://401827]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-23 22:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found