This should build your query dynamically according to the number of items in your array.
Quoting DBI documentation: Also, placeholders can only represent single scalar values. For example, the following statement won't work as expected for more than one value: SELECT name, age FROM people WHERE name IN (?) # wrong SELECT name, age FROM people WHERE name IN (?,? ) # two names Rewrite to: my $sql = 'select * from table where ID in (?,?
,? ,? ,?)'; $sth->prepare($sql); $sth->execute(@list).
It's not possible in that way. You need to specify a placeholder for each item in your array: my @list = (1,2,3,4,5); my $sql = "select * from table where ID in (?,? ,?
,? ,? )"; $sth->prepare($sql); $sth->execute(@list); If your @list is not a fixed size, you need to build the $sql with the proper number of placeholders.
Means "as many as needed" Edit: Actually, I was a little too optimistic: "If the string (?) is present in the query, it is replaced with a list of as many question marks as @values. " So this does not seem to work: $db->query( "SELECT * FROM foo WHERE id IN (?) AND stuff=?", @ids, $stuff ) Still useful though.. For the curious, the code in the module is: # Replace (?) with (?,? ,?
, ...) sub _replace_omniholder { my ($self, $query, $binds) = @_; return if $$query! ~ /\(\? \?
\)/; my $omniholders = 0; my $q = $self->{dbd} =~ /mysql/? $quoted_mysql : $quoted; $$query =~ s($q|\(\? \?
\)) { $1 eq '(?)'? Do { Carp::croak('There can be only one omniholder') if $omniholders++; '(' . Join(', ', ('?
') x @$binds) .')' } : $1 }eg; }.
With DBD::Pg, you can use: my @list = (1, 2, 3, 4, 5); my $sql = "select * from table where ID = ANY(?::INT);"; $sth->prepare ($sql); $sth->execute (\@list).
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.