Help for this page

Select Code to Download


  1. or download this
    tie $dbfh, 'Tie::DBI', $dsn, $user, $pass, 'id, name from foo';
    while (my $record = <$dbfh>) {
     print "ID:   ", $record->{id}, "\n";
     print "Name: ", $record->{name}, "\n";
    }
    
  2. or download this
    # $dbfh continues from above
    $dbfh->print(join $/, (id => '42', name => 'Answer', '');
    
  3. or download this
    my $dbfh = tie $dbfh, 'Tie::DBI', $dsn, $user, $pass, 'id, name from f
    +oo'; # Support optional prameters to give the defintion of comma, new
    +line, etc?  Take ideas from CSV_XS
    while (<$dbfh>) {
    ...
    
    print $dbfh (qq(42, "Answer"\n));
    # Note that the \n isn't optional; you should wait for it, putting inp
    +ut in an interal buffer until you see it, then flush the whole line. 
    + Support some special syntax to specifiy a NULL, or to leave it out a
    +nd let an AUTONUMBER column do it's thing?