in reply to Re: SQL::Statement limit clause with placeholders
in thread SQL::Statement limit clause with placeholders

OK. Facts accepted. So what would be the best way to implement paging of records in chunks of, say, 20 per page?
  • Comment on Re^2: SQL::Statement limit clause with placeholders

Replies are listed 'Best First'.
Re^3: SQL::Statement limit clause with placeholders
by dragonchild (Archbishop) on Jun 03, 2005 at 14:26 UTC
    The immediate solution is to dynamically generate the SQL. This could be as simple as:
    my $sql = <<__END_SQL__; YOUR STATEMENT HERE __END_SQL__ $sql .= "LIMIT $start, $chunk_size\n"; my $sth = $dbh->prepare( $sql ); # etc.

    • In general, if you think something isn't in Perl, try it out, because it usually is. :-)
    • "What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?"
      Ok. Looks reasonable.

      Untainting offset und limit (coming from query params) via regex should be safe then.

      Thanks for the help!
Re^3: SQL::Statement limit clause with placeholders
by jZed (Prior) on Jun 03, 2005 at 14:27 UTC
    Variable interpolation?