Help for this page

Select Code to Download


  1. or download this
    my $sql= new SQL::Abstract( array_datatypes => 1 );
    
    my $required = {  a => [1, 3, 5],  b => [2, 4, 6],};
    
    my($stmt, @bind)= $sql->insert( testtable => $required );
    
  2. or download this
    stmt:  "INSERT INTO testtable ( a, b) VALUES ( ?, ? )"
    @bind: (
    ...
                6
              ]
            );
    
  3. or download this
    my $data = [
      {a => 1, b => 2},
      {a => 3, b => 4},
      {a => 5, b => 6},
    ];
    
  4. or download this
    # %columns will become the hash of arrays
    my %columns;
    ...
      # push the value foreach column
      push @{$columns{$_}}, $row->{$_} foreach keys %columns;
    }