On Fri, Nov 09, 2001 at 03:15:14PM -0800, Mike Bresnahan wrote:
> > Another thing I'm wondering about is how placeholders work in Java?
> > (I'm assuming it has got that)
> 
> What do you mean by "placeholders"?

If you want to execute a query many times (and I mean many), you use
placeholders in perl to get a huge performance increase. Basically it
means that the query only needs to be parsed once and then you have
the value of the placeholder inserted on executes. (In most cases this
is implemented by the DBI driver in perl, since most databases don't
support it natively. Although Oracle does.)

In perl you'd write something like this:

my $sth = $dbh->prepare("insert into table (field) values (?)"); # ? is the placeholder in DBI

while (my $input = <>) { # user input
      chomp $input;
      $sth->execute($input);
}

$sth->finish();

So most of the query gets cached and you gain the benefit of not needing
to quote the input from the user since that automatically happens by the
binding of the placeholders.

Does something similar exist in Java?

-- 
  Thomas Eibner <http://thomas.eibner.dk/> DnsZone <http://dnszone.org/>
  mod_pointer <http://stderr.net/mod_pointer>